Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log("ECClassId | Parent RelECClassId");
while (stmt.step() === DbResult.BE_SQLITE_ROW) {
const classIdValue: ECSqlValue = stmt.getValue(0);
const parentRelClassIdValue: ECSqlValue = stmt.getValue(1);
const classId: string = classIdValue.getId();
const parentRelClassId: string = parentRelClassIdValue.getId();
console.log(classId + "|" + parentRelClassId);
}
});
// __PUBLISH_EXTRACT_END__
}
const dummyIModel = IModelDb.openSnapshot("");
executeECSql_Binding(dummyIModel);
executeECSql_QueryResult(dummyIModel);
function createSnapshotFromSeed(testFileName: string, seedFileName: string): IModelDb {
const seedDb: IModelDb = IModelDb.openSnapshot(seedFileName);
const testDb: IModelDb = seedDb.createSnapshot(testFileName);
seedDb.closeSnapshot();
return testDb;
}
function doExport(iModelName: string, objName: string, mtlName: string) {
IModelHost.startup();
Logger.initializeToConsole();
Logger.setLevelDefault(LogLevel.Error);
const iModel: IModelDb = IModelDb.openSnapshot(iModelName);
process.stdout.write(`Opened ${iModelName} successfully.\n`);
const objFile = fs.openSync(objName, "w");
const mtlFile = fs.openSync(mtlName, "w");
process.stdout.write(`Writing to ${objName} and ${mtlName}.\n`);
const elementIdArray: Id64Array = [];
iModel.withPreparedStatement("SELECT ECInstanceId FROM bis.GeometricElement3d", (stmt: ECSqlStatement) => {
while (stmt.step() === DbResult.BE_SQLITE_ROW) {
elementIdArray.push(stmt.getValue(0).getId());
}
});
process.stdout.write(`Processing ${elementIdArray.length} elements...\n`);
if (elementIdArray.length === 0)
return;
public static initialize(iModelName: string, gltfName: string) {
GltfGlobals.iModel = IModelDb.openSnapshot(iModelName);
process.stdout.write(`Opened ${iModelName} successfully...\n`);
const gltfPathParts = path.parse(gltfName);
const binName = gltfPathParts.name + ".bin";
GltfGlobals.binFile = fs.openSync(path.join(gltfPathParts.dir, binName), "w");
GltfGlobals.texturesDir = gltfPathParts.dir;
process.stdout.write(`Writing to ${gltfName} and ${binName}...\n`);
GltfGlobals.gltf = {
accessors: [],
asset: {
generator: "iModel.js export-gltf",
version: "2.0",
},
buffers: [{ uri: binName, byteLength: 0 }],
bufferViews: [],