Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | // import { OccHelper } from "../occ-helper"; // import { OpenCascadeInstance, TDF_Label, TDF_LabelSequence, TDataStd_Name, TopoDS_Shape, XCAFDoc_ShapeTool } from "../../bitbybit-dev-occt/bitbybit-dev-occt"; // import * as Inputs from "../api/inputs/inputs"; // type Assembly = { // name: string; // location?: any; // color?: any; // children: (Assembly | Part)[]; // }; // type Part = { // location?: any; // color?: any; // name: string; // }; // export class OCCTAssembly { // constructor( // private readonly occ: OpenCascadeInstance, // private readonly och: OccHelper // ) { // } // scan(inputs: Inputs.OCCT.ShapeDto<TopoDS_Shape>) { // const aDoc = new this.occ.Handle_TDocStd_Document_2(new this.occ.TDocStd_Document(new this.occ.TCollection_ExtendedString_1())); // const mainDoc = aDoc.get().Main(); // const shapeTool = this.occ.XCAFDoc_DocumentTool.ShapeTool(mainDoc).get(); // // const app = this.occ.XCAFApp_Application.GetApplication(); // if (mainDoc.IsNull()) { // throw new Error("Document is null"); // } // // const tool = new this.occ.Handle_XCAFDoc_ShapeTool_1().get(); // // // const doc = this.occ.TDocStd_Document.Get; // shapeTool.AddShape(inputs.shape, true, false); // const traversed = this.traverseAssembly(shapeTool); // // shapeTool.delete(); // return traversed; // } // traverseLabel(label: TDF_Label): (Assembly | Part) { // const att = new this.occ.Handle_TDF_Attribute_2(new this.occ.TDataStd_Name() as any); // label.FindAttribute_1(this.occ.TDataStd_Name.GetID(), att); // const name = this.occ.BitByBitDev.ConvertAsciiString(new this.occ.TCollection_AsciiString_13((att.get() as TDataStd_Name).Get(), 0)); // const components = new this.occ.TDF_LabelSequence_1(); // if (this.occ.XCAFDoc_ShapeTool.GetComponents(label, components, false)) { // const children: (Assembly | Part)[] = []; // for (let i = 1; i <= components.Length(); i++) { // children.push(this.traverseLabel(components.Value(i))); // } // return { // name, // children // }; // } else { // const referredShapeLabel = new this.occ.TDF_Label(); // const shape = this.occ.XCAFDoc_ShapeTool.GetReferredShape(label, referredShapeLabel); // const location = this.occ.XCAFDoc_ShapeTool.GetLocation(label); // if (shape) { // return this.traverseLabel(referredShapeLabel); // } else { // return { location, name }; // } // } // } // traverseAssembly(assembly: XCAFDoc_ShapeTool) { // const freeShapes = new this.occ.TDF_LabelSequence_1(); // assembly.GetFreeShapes(freeShapes as TDF_LabelSequence); // const children: (Assembly | Part)[] = []; // for (let i = 1; i <= freeShapes.Length(); i++) { // children.push(this.traverseLabel(freeShapes.Value(i))); // } // return children; // } // getShapeFromTDFLabel() { // const aDoc = new this.occ.Handle_TDocStd_Document_2(new this.occ.TDocStd_Document(new this.occ.TCollection_ExtendedString_1())); // const mainDoc = aDoc.get().Main(); // const shapeTool = this.occ.XCAFDoc_DocumentTool.ShapeTool(mainDoc).get(); // shapeTool.GetShapes() // } // } |