@bldrs-ai/conway 0.23.977 → 1.22.969
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -40
- package/compiled/Dist/ConwayGeomWasm.d.ts +2 -0
- package/compiled/Dist/ConwayGeomWasmNode.d.ts +2 -0
- package/compiled/Dist/ConwayGeomWasmNodeMT.d.ts +2 -0
- package/compiled/Dist/ConwayGeomWasmWeb.d.ts +2 -0
- package/compiled/Dist/ConwayGeomWasmWebMT.d.ts +2 -0
- package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
- package/compiled/dependencies/conway-geom/interface/conway_geometry.js +0 -15
- package/compiled/examples/browser-bundled.cjs +1 -1
- package/compiled/examples/cli-bundled.cjs +1 -14
- package/compiled/examples/validator-bundled.cjs +1 -1
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +33 -3
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +156 -111
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.test.js +79 -0
- package/compiled/src/AP214E3_2010/ap214_scene_builder.d.ts +10 -5
- package/compiled/src/AP214E3_2010/ap214_scene_builder.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/ap214_scene_builder.js +10 -5
- package/compiled/src/AP214E3_2010/ap214_transform_helpers.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_transform_helpers.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_transform_helpers.test.js +112 -0
- package/compiled/src/format_detection/model_format_detector.d.ts +2 -1
- package/compiled/src/format_detection/model_format_detector.d.ts.map +1 -1
- package/compiled/src/format_detection/model_format_detector.js +12 -11
- package/compiled/src/format_detection/model_format_detector.test.js +11 -0
- package/compiled/src/loaders/conway_model_loader.d.ts.map +1 -1
- package/compiled/src/loaders/conway_model_loader.js +8 -1
- package/compiled/src/version/version.js +1 -1
- package/compiled/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -6,6 +6,7 @@ export var ModelFormatType;
|
|
|
6
6
|
(function (ModelFormatType) {
|
|
7
7
|
ModelFormatType[ModelFormatType["IFC"] = 0] = "IFC";
|
|
8
8
|
ModelFormatType[ModelFormatType["AP214"] = 1] = "AP214";
|
|
9
|
+
ModelFormatType[ModelFormatType["AP203"] = 2] = "AP203";
|
|
9
10
|
})(ModelFormatType || (ModelFormatType = {}));
|
|
10
11
|
/**
|
|
11
12
|
* Format detector for finding the format of a model from a buffer in conway.
|
|
@@ -20,22 +21,22 @@ export default class ModelFormatDetector {
|
|
|
20
21
|
*/
|
|
21
22
|
static detect(input) {
|
|
22
23
|
const [stepHeader, errorCode] = StepHeaderParser.instance.parseHeader(input);
|
|
23
|
-
console.log(ParseResult[errorCode]);
|
|
24
24
|
if (errorCode === ParseResult.COMPLETE || errorCode === ParseResult.INCOMPLETE) {
|
|
25
25
|
const schema = stepHeader.headers.get("FILE_SCHEMA")?.toLocaleUpperCase();
|
|
26
26
|
if (schema !== void 0) {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const afterBrace = schema.substring(schema.indexOf("{") + 1).trimStart();
|
|
36
|
-
if (afterBrace.startsWith("1 0 10303 214")) {
|
|
27
|
+
const quotedEntries = Array.from(schema.matchAll(/'([^']+)'/g)).map((match) => match[1]);
|
|
28
|
+
const schemaEntries = quotedEntries.length > 0 ? quotedEntries : [schema];
|
|
29
|
+
for (const rawEntry of schemaEntries) {
|
|
30
|
+
const entryNoSpaces = rawEntry.replaceAll(" ", "");
|
|
31
|
+
if (entryNoSpaces.startsWith("IFC")) {
|
|
32
|
+
return ModelFormatType.IFC;
|
|
33
|
+
}
|
|
34
|
+
if (entryNoSpaces.startsWith("AUTOMOTIVE_DESIGN")) {
|
|
37
35
|
return ModelFormatType.AP214;
|
|
38
36
|
}
|
|
37
|
+
if (entryNoSpaces.startsWith("CONFIG_CONTROL_DESIGN")) {
|
|
38
|
+
return ModelFormatType.AP203;
|
|
39
|
+
}
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -5,11 +5,13 @@ import ModelFormatDetector, { ModelFormatType } from "./model_format_detector.js
|
|
|
5
5
|
const indexIfcBuffer = fs.readFileSync("data/index.ifc");
|
|
6
6
|
const tubeBuffer = fs.readFileSync("data/create-a-tube.step");
|
|
7
7
|
const gearBuffer = fs.readFileSync("data/a-gear-with-3-inch-diameter-and-20-curved-teeth.step");
|
|
8
|
+
const configControlDesignBuffer = fs.readFileSync("data/config-control-design-min.step");
|
|
8
9
|
const nativeHDBuffer = fs.readFileSync("data/native_hd.m3u8");
|
|
9
10
|
const emptyBuffer = new Uint8Array(0);
|
|
10
11
|
const indexIfcBufferInput = new ParsingBuffer(indexIfcBuffer);
|
|
11
12
|
const tubeBufferInput = new ParsingBuffer(tubeBuffer);
|
|
12
13
|
const gearBufferInput = new ParsingBuffer(gearBuffer);
|
|
14
|
+
const configControlDesignBufferInput = new ParsingBuffer(configControlDesignBuffer);
|
|
13
15
|
const nativeHDBufferInput = new ParsingBuffer(nativeHDBuffer);
|
|
14
16
|
const emptyBufferInput = new ParsingBuffer(emptyBuffer);
|
|
15
17
|
/**
|
|
@@ -30,6 +32,12 @@ function testTubeStep() {
|
|
|
30
32
|
function testGearStep() {
|
|
31
33
|
return ModelFormatDetector.detect(gearBufferInput);
|
|
32
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* @return {ModelFormatType} The type for model formats, should be AP203.
|
|
37
|
+
*/
|
|
38
|
+
function testConfigControlDesignStep() {
|
|
39
|
+
return ModelFormatDetector.detect(configControlDesignBufferInput);
|
|
40
|
+
}
|
|
33
41
|
/**
|
|
34
42
|
* @return {ModelFormatType} The type for model formats, should be AP214.
|
|
35
43
|
*/
|
|
@@ -52,6 +60,9 @@ describe("Model Format Detector", () => {
|
|
|
52
60
|
test("testGearStep()", () => {
|
|
53
61
|
expect(testGearStep()).toBe(ModelFormatType.AP214);
|
|
54
62
|
});
|
|
63
|
+
test("testConfigControlDesignStep()", () => {
|
|
64
|
+
expect(testConfigControlDesignStep()).toBe(ModelFormatType.AP203);
|
|
65
|
+
});
|
|
55
66
|
test("testNotAModel()", () => {
|
|
56
67
|
expect(testNotAModel()).toBe(void 0);
|
|
57
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conway_model_loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/conway_model_loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAcrC;;;;GAIG;AACH,qBAAa,iBAAiB;IAE5B;;;;;;;;OAQG;WACiB,kBAAkB,CAClC,IAAI,EAAE,UAAU,EAChB,aAAa,GAAE,OAAc,EAC7B,eAAe,GAAE,MAAW,EAC5B,OAAO,GAAE,MAAU,GAAI,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"conway_model_loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/conway_model_loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAcrC;;;;GAIG;AACH,qBAAa,iBAAiB;IAE5B;;;;;;;;OAQG;WACiB,kBAAkB,CAClC,IAAI,EAAE,UAAU,EAChB,aAAa,GAAE,OAAc,EAC7B,eAAe,GAAE,MAAW,EAC5B,OAAO,GAAE,MAAU,GAAI,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CA8XnD"}
|
|
@@ -30,10 +30,17 @@ export class ConwayModelLoader {
|
|
|
30
30
|
static async loadModelWithScene(data, limitCSGDepth = true, maximumCSGDepth = 20, modelID = 0) {
|
|
31
31
|
const allTimeStart = Date.now();
|
|
32
32
|
const modelFormat = ModelFormatDetector.detect(new ParsingBuffer(data));
|
|
33
|
+
let is203 = false;
|
|
33
34
|
switch (modelFormat) {
|
|
35
|
+
case ModelFormatType.AP203:
|
|
36
|
+
console.log("AP203 Step Detected, using AP214 loader");
|
|
37
|
+
is203 = true;
|
|
38
|
+
// falls through
|
|
34
39
|
case ModelFormatType.AP214:
|
|
35
|
-
|
|
40
|
+
if (!is203) {
|
|
36
41
|
console.log("AP214 Step Detected");
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
37
44
|
const conwayWasm = new ConwayGeometry();
|
|
38
45
|
if (!await conwayWasm.initialize()) {
|
|
39
46
|
throw Error("Couldn't initialise conway-geom");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const versionString = 'Conway Web-Ifc Shim
|
|
1
|
+
const versionString = 'Conway Web-Ifc Shim v1.22.969';
|
|
2
2
|
export { versionString };
|