brep-io-kernel 1.0.0
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/LICENSE.md +32 -0
- package/README.md +144 -0
- package/dist-kernel/brep-kernel.js +74699 -0
- package/dist-kernel/help/CONTRIBUTING.html +248 -0
- package/dist-kernel/help/LICENSE.html +248 -0
- package/dist-kernel/help/MODELING.png +0 -0
- package/dist-kernel/help/PMI.png +0 -0
- package/dist-kernel/help/SKETCH.png +0 -0
- package/dist-kernel/help/assembly-constraints__Coincident_Constraint_dialog.png +0 -0
- package/dist-kernel/help/assembly-constraints___Angle_Constraint_dialog.png +0 -0
- package/dist-kernel/help/assembly-constraints___Distance_Constraint_dialog.png +0 -0
- package/dist-kernel/help/assembly-constraints___Fixed_Constraint_dialog.png +0 -0
- package/dist-kernel/help/assembly-constraints___Parallel_Constraint_dialog.png +0 -0
- package/dist-kernel/help/assembly-constraints___Touch_Align_Constraint_dialog.png +0 -0
- package/dist-kernel/help/assembly-constraints__angle-constraint.html +248 -0
- package/dist-kernel/help/assembly-constraints__coincident-constraint.html +248 -0
- package/dist-kernel/help/assembly-constraints__distance-constraint.html +248 -0
- package/dist-kernel/help/assembly-constraints__fixed-constraint.html +248 -0
- package/dist-kernel/help/assembly-constraints__parallel-constraint.html +248 -0
- package/dist-kernel/help/assembly-constraints__solver.html +248 -0
- package/dist-kernel/help/assembly-constraints__touch-align-constraint.html +248 -0
- package/dist-kernel/help/brep-api.html +263 -0
- package/dist-kernel/help/brep-kernel.html +258 -0
- package/dist-kernel/help/brep-model.html +248 -0
- package/dist-kernel/help/cylindrical-face-radius-embedding.html +290 -0
- package/dist-kernel/help/dialog-screenshots.html +248 -0
- package/dist-kernel/help/extruded-sketch-radius-embedding.html +336 -0
- package/dist-kernel/help/features__Assembly_Component_dialog.png +0 -0
- package/dist-kernel/help/features__Boolean_dialog.png +0 -0
- package/dist-kernel/help/features__Chamfer_dialog.png +0 -0
- package/dist-kernel/help/features__Datium_dialog.png +0 -0
- package/dist-kernel/help/features__Extrude_dialog.png +0 -0
- package/dist-kernel/help/features__Fillet_dialog.png +0 -0
- package/dist-kernel/help/features__Helix_dialog.png +0 -0
- package/dist-kernel/help/features__Hole_dialog.png +0 -0
- package/dist-kernel/help/features__Image_Heightmap_Solid_dialog.png +0 -0
- package/dist-kernel/help/features__Image_to_Face_dialog.png +0 -0
- package/dist-kernel/help/features__Import_3D_Model_dialog.png +0 -0
- package/dist-kernel/help/features__Loft_dialog.png +0 -0
- package/dist-kernel/help/features__Mirror_dialog.png +0 -0
- package/dist-kernel/help/features__Offset_Shell_dialog.png +0 -0
- package/dist-kernel/help/features__Overlap_Cleanup_dialog.png +0 -0
- package/dist-kernel/help/features__Pattern_Linear_dialog.png +0 -0
- package/dist-kernel/help/features__Pattern_Radial_dialog.png +0 -0
- package/dist-kernel/help/features__Pattern_dialog.png +0 -0
- package/dist-kernel/help/features__Plane_dialog.png +0 -0
- package/dist-kernel/help/features__Primitive_Cone_dialog.png +0 -0
- package/dist-kernel/help/features__Primitive_Cube_dialog.png +0 -0
- package/dist-kernel/help/features__Primitive_Cylinder_dialog.png +0 -0
- package/dist-kernel/help/features__Primitive_Pyramid_dialog.png +0 -0
- package/dist-kernel/help/features__Primitive_Sphere_dialog.png +0 -0
- package/dist-kernel/help/features__Primitive_Torus_dialog.png +0 -0
- package/dist-kernel/help/features__Remesh_dialog.png +0 -0
- package/dist-kernel/help/features__Revolve_dialog.png +0 -0
- package/dist-kernel/help/features__Sheet_Metal_Contour_Flange_dialog.png +0 -0
- package/dist-kernel/help/features__Sheet_Metal_Cutout_dialog.png +0 -0
- package/dist-kernel/help/features__Sheet_Metal_Flange_dialog.png +0 -0
- package/dist-kernel/help/features__Sheet_Metal_Tab_dialog.png +0 -0
- package/dist-kernel/help/features__Sketch_dialog.png +0 -0
- package/dist-kernel/help/features__Spline_dialog.png +0 -0
- package/dist-kernel/help/features__Sweep_dialog.png +0 -0
- package/dist-kernel/help/features__Transform_dialog.png +0 -0
- package/dist-kernel/help/features__Tube_dialog.png +0 -0
- package/dist-kernel/help/features__assembly-component.html +248 -0
- package/dist-kernel/help/features__boolean.html +248 -0
- package/dist-kernel/help/features__chamfer.html +248 -0
- package/dist-kernel/help/features__datium.html +248 -0
- package/dist-kernel/help/features__datum.html +248 -0
- package/dist-kernel/help/features__extrude.html +248 -0
- package/dist-kernel/help/features__fillet.html +248 -0
- package/dist-kernel/help/features__helix.html +248 -0
- package/dist-kernel/help/features__hole.html +248 -0
- package/dist-kernel/help/features__image-heightmap-solid.html +248 -0
- package/dist-kernel/help/features__image-to-face-2D_dialog.png +0 -0
- package/dist-kernel/help/features__image-to-face-3D_dialog.png +0 -0
- package/dist-kernel/help/features__image-to-face.html +248 -0
- package/dist-kernel/help/features__import-3d-model.html +248 -0
- package/dist-kernel/help/features__index.html +248 -0
- package/dist-kernel/help/features__loft.html +248 -0
- package/dist-kernel/help/features__mirror.html +248 -0
- package/dist-kernel/help/features__offset-shell.html +248 -0
- package/dist-kernel/help/features__pattern-linear.html +248 -0
- package/dist-kernel/help/features__pattern-radial.html +248 -0
- package/dist-kernel/help/features__pattern.html +248 -0
- package/dist-kernel/help/features__plane.html +248 -0
- package/dist-kernel/help/features__primitive-cone.html +248 -0
- package/dist-kernel/help/features__primitive-cube.html +248 -0
- package/dist-kernel/help/features__primitive-cylinder.html +248 -0
- package/dist-kernel/help/features__primitive-pyramid.html +248 -0
- package/dist-kernel/help/features__primitive-sphere.html +248 -0
- package/dist-kernel/help/features__primitive-torus.html +248 -0
- package/dist-kernel/help/features__remesh.html +248 -0
- package/dist-kernel/help/features__revolve.html +248 -0
- package/dist-kernel/help/features__sheet-metal-contour-flange.html +248 -0
- package/dist-kernel/help/features__sheet-metal-flange.html +248 -0
- package/dist-kernel/help/features__sheet-metal-tab.html +248 -0
- package/dist-kernel/help/features__sketch.html +248 -0
- package/dist-kernel/help/features__spline.html +248 -0
- package/dist-kernel/help/features__sweep.html +248 -0
- package/dist-kernel/help/features__transform.html +248 -0
- package/dist-kernel/help/features__tube.html +248 -0
- package/dist-kernel/help/file-formats.html +248 -0
- package/dist-kernel/help/getting-started.html +248 -0
- package/dist-kernel/help/highlights.html +248 -0
- package/dist-kernel/help/history-systems.html +248 -0
- package/dist-kernel/help/how-it-works.html +248 -0
- package/dist-kernel/help/index.html +862 -0
- package/dist-kernel/help/input-params-schema.html +363 -0
- package/dist-kernel/help/inspector-improvements.html +248 -0
- package/dist-kernel/help/inspector.html +248 -0
- package/dist-kernel/help/modes__modeling.html +248 -0
- package/dist-kernel/help/modes__pmi.html +248 -0
- package/dist-kernel/help/modes__sketch.html +248 -0
- package/dist-kernel/help/plugins.html +248 -0
- package/dist-kernel/help/pmi-annotations__Angle_Dimension_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__Explode_Body_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__Hole_Callout_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__Leader_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__Linear_Dimension_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__Note_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__Radial_Dimension_dialog.png +0 -0
- package/dist-kernel/help/pmi-annotations__angle-dimension.html +248 -0
- package/dist-kernel/help/pmi-annotations__explode-body.html +248 -0
- package/dist-kernel/help/pmi-annotations__hole-callout.html +248 -0
- package/dist-kernel/help/pmi-annotations__index.html +248 -0
- package/dist-kernel/help/pmi-annotations__leader.html +248 -0
- package/dist-kernel/help/pmi-annotations__linear-dimension.html +248 -0
- package/dist-kernel/help/pmi-annotations__note.html +248 -0
- package/dist-kernel/help/pmi-annotations__radial-dimension.html +248 -0
- package/dist-kernel/help/search-index.json +464 -0
- package/dist-kernel/help/simplified-radial-dimensions.html +298 -0
- package/dist-kernel/help/solid-methods.html +359 -0
- package/dist-kernel/help/table-of-contents.html +330 -0
- package/dist-kernel/help/ui-overview.html +248 -0
- package/dist-kernel/help/whats-new.html +248 -0
- package/package.json +54 -0
- package/src/BREP/AssemblyComponent.js +42 -0
- package/src/BREP/BREP.js +43 -0
- package/src/BREP/BetterSolid.js +805 -0
- package/src/BREP/Edge.js +103 -0
- package/src/BREP/Extrude.js +403 -0
- package/src/BREP/Face.js +187 -0
- package/src/BREP/MeshRepairer.js +634 -0
- package/src/BREP/OffsetShellSolid.js +614 -0
- package/src/BREP/PointCloudWrap.js +302 -0
- package/src/BREP/Revolve.js +345 -0
- package/src/BREP/SolidMethods/authoring.js +112 -0
- package/src/BREP/SolidMethods/booleanOps.js +230 -0
- package/src/BREP/SolidMethods/chamfer.js +122 -0
- package/src/BREP/SolidMethods/edgeResolution.js +25 -0
- package/src/BREP/SolidMethods/fillet.js +792 -0
- package/src/BREP/SolidMethods/index.js +72 -0
- package/src/BREP/SolidMethods/io.js +105 -0
- package/src/BREP/SolidMethods/lifecycle.js +103 -0
- package/src/BREP/SolidMethods/manifoldOps.js +375 -0
- package/src/BREP/SolidMethods/meshCleanup.js +2512 -0
- package/src/BREP/SolidMethods/meshQueries.js +264 -0
- package/src/BREP/SolidMethods/metadata.js +106 -0
- package/src/BREP/SolidMethods/metrics.js +51 -0
- package/src/BREP/SolidMethods/transforms.js +361 -0
- package/src/BREP/SolidMethods/visualize.js +508 -0
- package/src/BREP/SolidShared.js +26 -0
- package/src/BREP/Sweep.js +1596 -0
- package/src/BREP/Tube.js +857 -0
- package/src/BREP/Vertex.js +43 -0
- package/src/BREP/applyBooleanOperation.js +704 -0
- package/src/BREP/boundsUtils.js +48 -0
- package/src/BREP/chamfer.js +551 -0
- package/src/BREP/edgePolylineUtils.js +85 -0
- package/src/BREP/fillets/common.js +388 -0
- package/src/BREP/fillets/fillet.js +1422 -0
- package/src/BREP/fillets/filletGeometry.js +15 -0
- package/src/BREP/fillets/inset.js +389 -0
- package/src/BREP/fillets/offsetHelper.js +143 -0
- package/src/BREP/fillets/outset.js +88 -0
- package/src/BREP/helix.js +193 -0
- package/src/BREP/meshToBrep.js +234 -0
- package/src/BREP/primitives.js +279 -0
- package/src/BREP/setupManifold.js +71 -0
- package/src/BREP/threadGeometry.js +1120 -0
- package/src/BREP/triangleUtils.js +8 -0
- package/src/BREP/triangulate.js +608 -0
- package/src/FeatureRegistry.js +183 -0
- package/src/PartHistory.js +1132 -0
- package/src/UI/AccordionWidget.js +292 -0
- package/src/UI/CADmaterials.js +850 -0
- package/src/UI/EnvMonacoEditor.js +522 -0
- package/src/UI/FloatingWindow.js +396 -0
- package/src/UI/HistoryWidget.js +457 -0
- package/src/UI/MainToolbar.js +131 -0
- package/src/UI/ModelLibraryView.js +194 -0
- package/src/UI/OrthoCameraIdle.js +206 -0
- package/src/UI/PluginsWidget.js +280 -0
- package/src/UI/SceneListing.js +606 -0
- package/src/UI/SelectionFilter.js +629 -0
- package/src/UI/ViewCube.js +389 -0
- package/src/UI/assembly/AssemblyConstraintCollectionWidget.js +329 -0
- package/src/UI/assembly/AssemblyConstraintControlsWidget.js +282 -0
- package/src/UI/assembly/AssemblyConstraintsWidget.css +292 -0
- package/src/UI/assembly/AssemblyConstraintsWidget.js +1373 -0
- package/src/UI/assembly/constraintFaceUtils.js +115 -0
- package/src/UI/assembly/constraintHighlightUtils.js +70 -0
- package/src/UI/assembly/constraintLabelUtils.js +31 -0
- package/src/UI/assembly/constraintPointUtils.js +64 -0
- package/src/UI/assembly/constraintSelectionUtils.js +185 -0
- package/src/UI/assembly/constraintStatusUtils.js +142 -0
- package/src/UI/componentSelectorModal.js +240 -0
- package/src/UI/controls/CombinedTransformControls.js +386 -0
- package/src/UI/dialogs.js +351 -0
- package/src/UI/expressionsManager.js +100 -0
- package/src/UI/featureDialogWidgets/booleanField.js +25 -0
- package/src/UI/featureDialogWidgets/booleanOperationField.js +97 -0
- package/src/UI/featureDialogWidgets/buttonField.js +45 -0
- package/src/UI/featureDialogWidgets/componentSelectorField.js +102 -0
- package/src/UI/featureDialogWidgets/defaultField.js +23 -0
- package/src/UI/featureDialogWidgets/fileField.js +66 -0
- package/src/UI/featureDialogWidgets/index.js +34 -0
- package/src/UI/featureDialogWidgets/numberField.js +165 -0
- package/src/UI/featureDialogWidgets/optionsField.js +33 -0
- package/src/UI/featureDialogWidgets/referenceSelectionField.js +208 -0
- package/src/UI/featureDialogWidgets/stringField.js +24 -0
- package/src/UI/featureDialogWidgets/textareaField.js +28 -0
- package/src/UI/featureDialogWidgets/threadDesignationField.js +160 -0
- package/src/UI/featureDialogWidgets/transformField.js +252 -0
- package/src/UI/featureDialogWidgets/utils.js +43 -0
- package/src/UI/featureDialogWidgets/vec3Field.js +133 -0
- package/src/UI/featureDialogs.js +1414 -0
- package/src/UI/fileManagerWidget.js +615 -0
- package/src/UI/history/HistoryCollectionWidget.js +1294 -0
- package/src/UI/history/historyCollectionWidget.css.js +257 -0
- package/src/UI/history/historyDisplayInfo.js +133 -0
- package/src/UI/mobile.js +28 -0
- package/src/UI/objectDump.js +442 -0
- package/src/UI/pmi/AnnotationCollectionWidget.js +120 -0
- package/src/UI/pmi/AnnotationHistory.js +353 -0
- package/src/UI/pmi/AnnotationRegistry.js +90 -0
- package/src/UI/pmi/BaseAnnotation.js +269 -0
- package/src/UI/pmi/LabelOverlay.css +102 -0
- package/src/UI/pmi/LabelOverlay.js +191 -0
- package/src/UI/pmi/PMIMode.js +1550 -0
- package/src/UI/pmi/PMIViewsWidget.js +1098 -0
- package/src/UI/pmi/annUtils.js +729 -0
- package/src/UI/pmi/dimensions/AngleDimensionAnnotation.js +647 -0
- package/src/UI/pmi/dimensions/ExplodeBodyAnnotation.js +507 -0
- package/src/UI/pmi/dimensions/HoleCalloutAnnotation.js +462 -0
- package/src/UI/pmi/dimensions/LeaderAnnotation.js +403 -0
- package/src/UI/pmi/dimensions/LinearDimensionAnnotation.js +532 -0
- package/src/UI/pmi/dimensions/NoteAnnotation.js +110 -0
- package/src/UI/pmi/dimensions/RadialDimensionAnnotation.js +659 -0
- package/src/UI/pmi/pmiStyle.js +44 -0
- package/src/UI/sketcher/SketchMode3D.js +4095 -0
- package/src/UI/sketcher/dimensions.js +674 -0
- package/src/UI/sketcher/glyphs.js +236 -0
- package/src/UI/sketcher/highlights.js +60 -0
- package/src/UI/toolbarButtons/aboutButton.js +5 -0
- package/src/UI/toolbarButtons/exportButton.js +609 -0
- package/src/UI/toolbarButtons/flatPatternButton.js +307 -0
- package/src/UI/toolbarButtons/importButton.js +160 -0
- package/src/UI/toolbarButtons/inspectorToggleButton.js +12 -0
- package/src/UI/toolbarButtons/metadataButton.js +1063 -0
- package/src/UI/toolbarButtons/orientToFaceButton.js +114 -0
- package/src/UI/toolbarButtons/registerDefaultButtons.js +46 -0
- package/src/UI/toolbarButtons/saveButton.js +99 -0
- package/src/UI/toolbarButtons/scriptRunnerButton.js +302 -0
- package/src/UI/toolbarButtons/testsButton.js +26 -0
- package/src/UI/toolbarButtons/undoRedoButtons.js +25 -0
- package/src/UI/toolbarButtons/wireframeToggleButton.js +5 -0
- package/src/UI/toolbarButtons/zoomToFitButton.js +5 -0
- package/src/UI/triangleDebuggerWindow.js +945 -0
- package/src/UI/viewer.js +4228 -0
- package/src/assemblyConstraints/AssemblyConstraintHistory.js +1576 -0
- package/src/assemblyConstraints/AssemblyConstraintRegistry.js +120 -0
- package/src/assemblyConstraints/BaseAssemblyConstraint.js +66 -0
- package/src/assemblyConstraints/constraintExpressionUtils.js +35 -0
- package/src/assemblyConstraints/constraintUtils/parallelAlignment.js +676 -0
- package/src/assemblyConstraints/constraints/AngleConstraint.js +485 -0
- package/src/assemblyConstraints/constraints/CoincidentConstraint.js +194 -0
- package/src/assemblyConstraints/constraints/DistanceConstraint.js +616 -0
- package/src/assemblyConstraints/constraints/FixedConstraint.js +78 -0
- package/src/assemblyConstraints/constraints/ParallelConstraint.js +252 -0
- package/src/assemblyConstraints/constraints/TouchAlignConstraint.js +961 -0
- package/src/core/entities/HistoryCollectionBase.js +72 -0
- package/src/core/entities/ListEntityBase.js +109 -0
- package/src/core/entities/schemaProcesser.js +121 -0
- package/src/exporters/sheetMetalFlatPattern.js +659 -0
- package/src/exporters/sheetMetalUnfold.js +862 -0
- package/src/exporters/step.js +1135 -0
- package/src/exporters/threeMF.js +575 -0
- package/src/features/assemblyComponent/AssemblyComponentFeature.js +780 -0
- package/src/features/boolean/BooleanFeature.js +94 -0
- package/src/features/chamfer/ChamferFeature.js +116 -0
- package/src/features/datium/DatiumFeature.js +80 -0
- package/src/features/edgeFeatureUtils.js +41 -0
- package/src/features/extrude/ExtrudeFeature.js +143 -0
- package/src/features/fillet/FilletFeature.js +197 -0
- package/src/features/helix/HelixFeature.js +405 -0
- package/src/features/hole/HoleFeature.js +1050 -0
- package/src/features/hole/screwClearance.js +86 -0
- package/src/features/hole/threadDesignationCatalog.js +149 -0
- package/src/features/imageHeightSolid/ImageHeightmapSolidFeature.js +463 -0
- package/src/features/imageToFace/ImageToFaceFeature.js +727 -0
- package/src/features/imageToFace/imageEditor.js +1270 -0
- package/src/features/imageToFace/traceUtils.js +971 -0
- package/src/features/import3dModel/Import3dModelFeature.js +151 -0
- package/src/features/loft/LoftFeature.js +605 -0
- package/src/features/mirror/MirrorFeature.js +151 -0
- package/src/features/offsetFace/OffsetFaceFeature.js +370 -0
- package/src/features/offsetShell/OffsetShellFeature.js +89 -0
- package/src/features/overlapCleanup/OverlapCleanupFeature.js +85 -0
- package/src/features/pattern/PatternFeature.js +275 -0
- package/src/features/patternLinear/PatternLinearFeature.js +120 -0
- package/src/features/patternRadial/PatternRadialFeature.js +186 -0
- package/src/features/plane/PlaneFeature.js +154 -0
- package/src/features/primitiveCone/primitiveConeFeature.js +99 -0
- package/src/features/primitiveCube/primitiveCubeFeature.js +70 -0
- package/src/features/primitiveCylinder/primitiveCylinderFeature.js +91 -0
- package/src/features/primitivePyramid/primitivePyramidFeature.js +72 -0
- package/src/features/primitiveSphere/primitiveSphereFeature.js +62 -0
- package/src/features/primitiveTorus/primitiveTorusFeature.js +109 -0
- package/src/features/remesh/RemeshFeature.js +97 -0
- package/src/features/revolve/RevolveFeature.js +111 -0
- package/src/features/selectionUtils.js +118 -0
- package/src/features/sheetMetal/SheetMetalContourFlangeFeature.js +1656 -0
- package/src/features/sheetMetal/SheetMetalCutoutFeature.js +1056 -0
- package/src/features/sheetMetal/SheetMetalFlangeFeature.js +1568 -0
- package/src/features/sheetMetal/SheetMetalHemFeature.js +43 -0
- package/src/features/sheetMetal/SheetMetalObject.js +141 -0
- package/src/features/sheetMetal/SheetMetalTabFeature.js +176 -0
- package/src/features/sheetMetal/UNFOLD_NEUTRAL_REQUIREMENTS.md +153 -0
- package/src/features/sheetMetal/contour-flange-rebuild-spec.md +261 -0
- package/src/features/sheetMetal/profileUtils.js +25 -0
- package/src/features/sheetMetal/sheetMetalCleanup.js +9 -0
- package/src/features/sheetMetal/sheetMetalFaceTypes.js +146 -0
- package/src/features/sheetMetal/sheetMetalMetadata.js +165 -0
- package/src/features/sheetMetal/sheetMetalPipeline.js +169 -0
- package/src/features/sheetMetal/sheetMetalProfileUtils.js +216 -0
- package/src/features/sheetMetal/sheetMetalTabUtils.js +29 -0
- package/src/features/sheetMetal/sheetMetalTree.js +210 -0
- package/src/features/sketch/SketchFeature.js +955 -0
- package/src/features/sketch/sketchSolver2D/ConstraintEngine.js +800 -0
- package/src/features/sketch/sketchSolver2D/constraintDefinitions.js +704 -0
- package/src/features/sketch/sketchSolver2D/mathHelpersMod.js +307 -0
- package/src/features/spline/SplineEditorSession.js +988 -0
- package/src/features/spline/SplineFeature.js +1388 -0
- package/src/features/spline/splineUtils.js +218 -0
- package/src/features/sweep/SweepFeature.js +110 -0
- package/src/features/transform/TransformFeature.js +152 -0
- package/src/features/tube/TubeFeature.js +635 -0
- package/src/fs.proxy.js +625 -0
- package/src/idbStorage.js +254 -0
- package/src/index.js +12 -0
- package/src/main.js +15 -0
- package/src/metadataManager.js +64 -0
- package/src/path.proxy.js +277 -0
- package/src/plugins/ghLoader.worker.js +151 -0
- package/src/plugins/pluginManager.js +286 -0
- package/src/pmi/PMIViewsManager.js +134 -0
- package/src/services/componentLibrary.js +198 -0
- package/src/tests/ConsoleCapture.js +189 -0
- package/src/tests/S7-diagnostics-2025-12-23T18-37-23-570Z.json +630 -0
- package/src/tests/browserTests.js +597 -0
- package/src/tests/debugBoolean.js +225 -0
- package/src/tests/partFiles/badBoolean.json +957 -0
- package/src/tests/partFiles/extrudeTest.json +88 -0
- package/src/tests/partFiles/filletFail.json +58 -0
- package/src/tests/partFiles/import_TEst.part.part.json +646 -0
- package/src/tests/partFiles/sheetMetalHem.BREP.json +734 -0
- package/src/tests/test_boolean_subtract.js +27 -0
- package/src/tests/test_chamfer.js +17 -0
- package/src/tests/test_extrudeFace.js +24 -0
- package/src/tests/test_fillet.js +17 -0
- package/src/tests/test_fillet_nonClosed.js +45 -0
- package/src/tests/test_filletsMoreDifficult.js +46 -0
- package/src/tests/test_history_features_basic.js +149 -0
- package/src/tests/test_hole.js +282 -0
- package/src/tests/test_mirror.js +16 -0
- package/src/tests/test_offsetShellGrouping.js +85 -0
- package/src/tests/test_plane.js +4 -0
- package/src/tests/test_primitiveCone.js +11 -0
- package/src/tests/test_primitiveCube.js +7 -0
- package/src/tests/test_primitiveCylinder.js +8 -0
- package/src/tests/test_primitivePyramid.js +9 -0
- package/src/tests/test_primitiveSphere.js +17 -0
- package/src/tests/test_primitiveTorus.js +21 -0
- package/src/tests/test_pushFace.js +126 -0
- package/src/tests/test_sheetMetalContourFlange.js +125 -0
- package/src/tests/test_sheetMetal_features.js +80 -0
- package/src/tests/test_sketch_openLoop.js +45 -0
- package/src/tests/test_solidMetrics.js +58 -0
- package/src/tests/test_stlLoader.js +1889 -0
- package/src/tests/test_sweepFace.js +55 -0
- package/src/tests/test_tube.js +45 -0
- package/src/tests/test_tube_closedLoop.js +67 -0
- package/src/tests/tests.js +493 -0
- package/src/tools/assemblyConstraintDialogCapturePage.js +56 -0
- package/src/tools/dialogCapturePageFactory.js +227 -0
- package/src/tools/featureDialogCapturePage.js +47 -0
- package/src/tools/pmiAnnotationDialogCapturePage.js +60 -0
- package/src/utils/axisHelpers.js +99 -0
- package/src/utils/deepClone.js +69 -0
- package/src/utils/geometryTolerance.js +37 -0
- package/src/utils/normalizeTypeString.js +8 -0
- package/src/utils/xformMath.js +51 -0
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
// ES6, no frameworks. Dark-mode UI. Full class, ready to paste.
|
|
2
|
+
// Tree UI for Solid → Face/Edge/Loop with per-object (non-recursive) visibility + selection sync.
|
|
3
|
+
import { SelectionFilter } from './SelectionFilter.js';
|
|
4
|
+
|
|
5
|
+
export class SceneListing {
|
|
6
|
+
/**
|
|
7
|
+
* @param {THREE.Scene} scene
|
|
8
|
+
* @param {{autoStart?: boolean, onSelection?: (obj: any) => void}} [options]
|
|
9
|
+
*/
|
|
10
|
+
constructor(scene, { autoStart = true, onSelection = null } = {}) {
|
|
11
|
+
if (!scene) throw new Error("SceneListing requires a THREE.Scene.");
|
|
12
|
+
this.scene = scene;
|
|
13
|
+
this._onSelection = (typeof onSelection === 'function') ? onSelection : null;
|
|
14
|
+
|
|
15
|
+
// --- UI root ----------------------------------------------------------------
|
|
16
|
+
this.uiElement = document.createElement("div");
|
|
17
|
+
this.uiElement.className = "scene-tree";
|
|
18
|
+
this.uiElement.setAttribute("role", "region");
|
|
19
|
+
this.uiElement.setAttribute("aria-label", "Scene");
|
|
20
|
+
|
|
21
|
+
// Toolbar (minimal)
|
|
22
|
+
this.toolbar = document.createElement("div");
|
|
23
|
+
this.toolbar.className = "scene-tree__toolbar";
|
|
24
|
+
this.uiElement.appendChild(this.toolbar);
|
|
25
|
+
|
|
26
|
+
// Tree container
|
|
27
|
+
this.treeRoot = document.createElement("ul");
|
|
28
|
+
this.treeRoot.className = "scene-tree__list";
|
|
29
|
+
this.uiElement.appendChild(this.treeRoot);
|
|
30
|
+
|
|
31
|
+
this.#ensureStyles();
|
|
32
|
+
|
|
33
|
+
// --- State ------------------------------------------------------------------
|
|
34
|
+
this._showAllObjects = false;
|
|
35
|
+
/** @type {Map<string, {obj: any, li: HTMLLIElement, chk: HTMLInputElement, nameEl: HTMLButtonElement, caret: HTMLButtonElement, childrenUL?: HTMLUListElement, lastSelected?: boolean}>} */
|
|
36
|
+
this.nodes = new Map();
|
|
37
|
+
// Remember per-solid expand/collapse state across scene rebuilds (keyed by solid name)
|
|
38
|
+
this._expandedByName = new Map(); // name -> boolean
|
|
39
|
+
// Remember expand/collapse state for non-solid nodes when showing all objects
|
|
40
|
+
this._expandedByUuid = new Map(); // uuid -> boolean
|
|
41
|
+
this._running = false;
|
|
42
|
+
this._raf = 0;
|
|
43
|
+
|
|
44
|
+
this.#attachTypeVisibilityButtons();
|
|
45
|
+
this.#attachDisplayModeToggle();
|
|
46
|
+
|
|
47
|
+
// Wire toolbar
|
|
48
|
+
// this.toolbar.querySelector(".st-expand").addEventListener("click", () => this.#setAllOpen(true));
|
|
49
|
+
// this.toolbar.querySelector(".st-collapse").addEventListener("click", () => this.#setAllOpen(false));
|
|
50
|
+
|
|
51
|
+
// Initial build
|
|
52
|
+
this.refresh();
|
|
53
|
+
if (autoStart) this.start();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
setScene(scene) {
|
|
59
|
+
if (!scene) throw new Error("setScene(scene) requires a THREE.Scene.");
|
|
60
|
+
this.stop();
|
|
61
|
+
this.scene = scene;
|
|
62
|
+
this.clear();
|
|
63
|
+
this.refresh();
|
|
64
|
+
this.start();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
refresh() {
|
|
68
|
+
// Rebuild membership (solids and children)
|
|
69
|
+
this.#syncMembership();
|
|
70
|
+
// Then ensure attributes (visibility / selection) reflect scene
|
|
71
|
+
this.#syncAttributes();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
start() {
|
|
75
|
+
if (this._running) return;
|
|
76
|
+
this._running = true;
|
|
77
|
+
const tick = () => {
|
|
78
|
+
if (!this._running) return;
|
|
79
|
+
this.#syncMembership();
|
|
80
|
+
this.#syncAttributes();
|
|
81
|
+
this._raf = requestAnimationFrame(tick);
|
|
82
|
+
};
|
|
83
|
+
this._raf = requestAnimationFrame(tick);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
stop() {
|
|
87
|
+
this._running = false;
|
|
88
|
+
if (this._raf) cancelAnimationFrame(this._raf);
|
|
89
|
+
this._raf = 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Helpers ------------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
clear() {
|
|
95
|
+
this.nodes.clear();
|
|
96
|
+
this.treeRoot.innerHTML = "";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
dispose() {
|
|
100
|
+
this.stop();
|
|
101
|
+
this.clear();
|
|
102
|
+
this.uiElement.remove();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Internal -----------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
#isSolid(obj) {
|
|
108
|
+
// Treat SOLID, COMPONENT, SKETCH, DATUM, and HELIX groups as top-level items in the tree
|
|
109
|
+
return obj && obj.isObject3D && (obj.type === "SOLID" || obj.type === "COMPONENT" || obj.type === "SKETCH" || obj.type === "DATUM" || obj.type === "HELIX");
|
|
110
|
+
}
|
|
111
|
+
#isFace(obj) { return obj && obj.type === "FACE"; }
|
|
112
|
+
#isEdge(obj) { return obj && obj.type === "EDGE"; }
|
|
113
|
+
#isLoop(obj) { return obj && obj.type === "LOOP"; }
|
|
114
|
+
#isVertex(obj) { return obj && obj.type === "VERTEX"; }
|
|
115
|
+
#isPlane(obj) { return obj && obj.type === "PLANE"; }
|
|
116
|
+
#isDatum(obj) { return obj && obj.type === "DATUM"; }
|
|
117
|
+
#isSketch(obj) { return obj && obj.type === "SKETCH"; }
|
|
118
|
+
#canExpand(obj) {
|
|
119
|
+
if (!obj || !obj.isObject3D) return false;
|
|
120
|
+
if (this._showAllObjects) return !!(obj.children && obj.children.length);
|
|
121
|
+
return this.#isSolid(obj);
|
|
122
|
+
}
|
|
123
|
+
#isCenterlineEdge(obj) {
|
|
124
|
+
if (!obj || obj.type !== "EDGE") return false;
|
|
125
|
+
const ud = obj.userData || {};
|
|
126
|
+
if (ud.centerline) return true;
|
|
127
|
+
const name = obj.name || "";
|
|
128
|
+
return /centerline/i.test(name);
|
|
129
|
+
}
|
|
130
|
+
#isRegularEdge(obj) { return this.#isEdge(obj) && !this.#isCenterlineEdge(obj); }
|
|
131
|
+
|
|
132
|
+
#syncMembership() {
|
|
133
|
+
const present = new Set();
|
|
134
|
+
|
|
135
|
+
if (this._showAllObjects) {
|
|
136
|
+
// Show every Object3D in the scene (recursive)
|
|
137
|
+
const stack = [...this.scene.children];
|
|
138
|
+
while (stack.length) {
|
|
139
|
+
const o = stack.pop();
|
|
140
|
+
if (!o || !o.isObject3D) continue;
|
|
141
|
+
present.add(o.uuid);
|
|
142
|
+
const parentObj = (o.parent && o.parent.isObject3D && o.parent !== this.scene) ? o.parent : null;
|
|
143
|
+
this.#ensureNodeFor(o, parentObj);
|
|
144
|
+
if (o.children && o.children.length) stack.push(...o.children);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
// Find solids at any depth (simple stack)
|
|
148
|
+
const stack = [...this.scene.children];
|
|
149
|
+
while (stack.length) {
|
|
150
|
+
const o = stack.pop();
|
|
151
|
+
if (!o || !o.isObject3D) continue;
|
|
152
|
+
if (this.#isSolid(o)) {
|
|
153
|
+
const parentSolid = (o.parent && this.#isSolid(o.parent)) ? o.parent : null;
|
|
154
|
+
// Ensure node for Solid (or component) with awareness of parent containers
|
|
155
|
+
present.add(o.uuid);
|
|
156
|
+
this.#ensureNodeFor(o, parentSolid);
|
|
157
|
+
// Ensure children nodes for faces/edges/loops/vertices/planes (direct children of Solid/Sketch/Datum)
|
|
158
|
+
for (const child of o.children) {
|
|
159
|
+
if (!child || !child.isObject3D) continue;
|
|
160
|
+
if (this.#isFace(child) || this.#isEdge(child) || this.#isLoop(child) || this.#isVertex(child) || this.#isPlane(child)) {
|
|
161
|
+
present.add(child.uuid);
|
|
162
|
+
this.#ensureNodeFor(child, o);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// continue traversal
|
|
167
|
+
if (o.children && o.children.length) stack.push(...o.children);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Remove nodes whose objects are gone
|
|
172
|
+
for (const [uuid, info] of [...this.nodes]) {
|
|
173
|
+
if (!present.has(uuid)) this.#removeNode(uuid);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#ensureNodeFor(obj, parentSolid /* may be null for Solid itself */) {
|
|
178
|
+
if (this.nodes.has(obj.uuid)) return this.nodes.get(obj.uuid);
|
|
179
|
+
|
|
180
|
+
// Parent UL: solids go at root; others under their owning solid node
|
|
181
|
+
let parentUL = this.treeRoot;
|
|
182
|
+
if (parentSolid) {
|
|
183
|
+
const pInfo = this.nodes.get(parentSolid.uuid) || this.#ensureNodeFor(parentSolid, null);
|
|
184
|
+
if (!pInfo.childrenUL) {
|
|
185
|
+
pInfo.childrenUL = document.createElement("ul");
|
|
186
|
+
pInfo.childrenUL.className = "scene-tree__list scene-tree__list--child";
|
|
187
|
+
pInfo.li.appendChild(pInfo.childrenUL);
|
|
188
|
+
pInfo.li.classList.add("is-parent");
|
|
189
|
+
}
|
|
190
|
+
parentUL = pInfo.childrenUL;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const li = document.createElement("li");
|
|
194
|
+
li.className = "scene-tree__item";
|
|
195
|
+
li.dataset.uuid = obj.uuid;
|
|
196
|
+
|
|
197
|
+
// Row content: [▸][☑][name (button)]
|
|
198
|
+
const row = document.createElement("div");
|
|
199
|
+
row.className = "scene-tree__row";
|
|
200
|
+
|
|
201
|
+
const toggle = document.createElement("button");
|
|
202
|
+
toggle.type = "button";
|
|
203
|
+
toggle.className = "st-caret";
|
|
204
|
+
toggle.addEventListener("click", (e) => {
|
|
205
|
+
e.stopPropagation();
|
|
206
|
+
if (!this.#canExpand(obj)) return;
|
|
207
|
+
const open = !li.classList.contains("open");
|
|
208
|
+
this.#setOpen(li, open);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const chk = document.createElement("input");
|
|
212
|
+
chk.type = "checkbox";
|
|
213
|
+
chk.className = "st-chk";
|
|
214
|
+
chk.title = "Toggle visibility";
|
|
215
|
+
|
|
216
|
+
const nameBtn = document.createElement("button");
|
|
217
|
+
nameBtn.type = "button";
|
|
218
|
+
nameBtn.className = "st-name";
|
|
219
|
+
nameBtn.textContent = this.#labelFor(obj);
|
|
220
|
+
nameBtn.title = nameBtn.textContent;
|
|
221
|
+
|
|
222
|
+
// Visibility: checkbox -> set ONLY this object's visibility (no recursion)
|
|
223
|
+
chk.addEventListener("change", (e) => {
|
|
224
|
+
const on = chk.checked;
|
|
225
|
+
if (typeof obj.visible !== "undefined") obj.visible = on;
|
|
226
|
+
// Immediate reflect
|
|
227
|
+
this.#syncAttributes();
|
|
228
|
+
e.stopPropagation();
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// Selection: name click -> recursive toggle selection (unchanged)
|
|
232
|
+
nameBtn.addEventListener("click", (e) => {
|
|
233
|
+
// If any descendant (including self) is not selected, select all; otherwise deselect all.
|
|
234
|
+
const anyUnselected = this.#anyRecursive(obj, n => !!n.selected === false);
|
|
235
|
+
const target = anyUnselected ? true : false;
|
|
236
|
+
//this.#setSelectedRecursive(obj, target);
|
|
237
|
+
this.#syncAttributes();
|
|
238
|
+
|
|
239
|
+
try { obj.onClick(); } catch { }
|
|
240
|
+
this.#notifySelection(obj);
|
|
241
|
+
// Scroll highlight
|
|
242
|
+
//li.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
243
|
+
e.stopPropagation();
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
// Hover highlight respecting selection filter
|
|
247
|
+
nameBtn.addEventListener('mouseenter', () => {
|
|
248
|
+
try { SelectionFilter.setHoverByName(this.scene, obj.name); } catch (_) { }
|
|
249
|
+
});
|
|
250
|
+
nameBtn.addEventListener('mouseleave', () => {
|
|
251
|
+
try { SelectionFilter.clearHover(); } catch (_) { }
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// Row assembly
|
|
255
|
+
row.appendChild(toggle);
|
|
256
|
+
row.appendChild(chk);
|
|
257
|
+
row.appendChild(nameBtn);
|
|
258
|
+
li.appendChild(row);
|
|
259
|
+
parentUL.appendChild(li);
|
|
260
|
+
|
|
261
|
+
const info = {
|
|
262
|
+
obj,
|
|
263
|
+
li,
|
|
264
|
+
chk,
|
|
265
|
+
nameEl: nameBtn,
|
|
266
|
+
caret: toggle,
|
|
267
|
+
childrenUL: null,
|
|
268
|
+
lastSelected: undefined
|
|
269
|
+
};
|
|
270
|
+
this.nodes.set(obj.uuid, info);
|
|
271
|
+
|
|
272
|
+
// Initial state: solids collapsed by default; restore remembered open state by name
|
|
273
|
+
if (this.#canExpand(obj)) this.#setOpen(li, this.#wantOpen(obj));
|
|
274
|
+
this.#syncCaret(info);
|
|
275
|
+
this.#applyTypeClass(li, obj);
|
|
276
|
+
return info;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
#removeNode(uuid) {
|
|
280
|
+
const info = this.nodes.get(uuid);
|
|
281
|
+
if (!info) return;
|
|
282
|
+
info.li.remove();
|
|
283
|
+
this.nodes.delete(uuid);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#syncAttributes() {
|
|
287
|
+
// Reflect plain per-object visibility & selection back into UI
|
|
288
|
+
for (const info of this.nodes.values()) {
|
|
289
|
+
const obj = info.obj;
|
|
290
|
+
this.#syncCaret(info);
|
|
291
|
+
|
|
292
|
+
// Checkbox: reflect ONLY obj.visible
|
|
293
|
+
const desiredChecked = !!obj.visible;
|
|
294
|
+
if (info.chk.checked !== desiredChecked) info.chk.checked = desiredChecked;
|
|
295
|
+
if (info.chk.indeterminate) info.chk.indeterminate = false;
|
|
296
|
+
|
|
297
|
+
// Selection highlight
|
|
298
|
+
const sel = !!obj.selected;
|
|
299
|
+
if (sel !== info.lastSelected) {
|
|
300
|
+
info.lastSelected = sel;
|
|
301
|
+
info.li.classList.toggle("is-selected", sel);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Keep label fresh (names may change externally)
|
|
305
|
+
const wantLabel = this.#labelFor(obj);
|
|
306
|
+
if (info.nameEl.textContent !== wantLabel) {
|
|
307
|
+
info.nameEl.textContent = wantLabel;
|
|
308
|
+
info.nameEl.title = wantLabel;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ---- Actions --------------------------------------------------------------
|
|
314
|
+
|
|
315
|
+
#setSelectedRecursive(obj, sel) {
|
|
316
|
+
if ("selected" in obj) {
|
|
317
|
+
try { obj.selected = sel; } catch (_) { }
|
|
318
|
+
}
|
|
319
|
+
if (obj.children && obj.children.length) {
|
|
320
|
+
for (const c of obj.children) this.#setSelectedRecursive(c, sel);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
#anyRecursive(obj, predicate) {
|
|
325
|
+
if (predicate(obj)) return true;
|
|
326
|
+
if (obj.children) {
|
|
327
|
+
for (const c of obj.children) if (this.#anyRecursive(c, predicate)) return true;
|
|
328
|
+
}
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// ---- UI helpers -----------------------------------------------------------
|
|
333
|
+
|
|
334
|
+
#attachDisplayModeToggle() {
|
|
335
|
+
const wrap = document.createElement("label");
|
|
336
|
+
wrap.className = "st-toggle";
|
|
337
|
+
wrap.title = "Show all scene objects (recursive)";
|
|
338
|
+
|
|
339
|
+
const input = document.createElement("input");
|
|
340
|
+
input.type = "checkbox";
|
|
341
|
+
input.className = "st-toggle__input";
|
|
342
|
+
input.checked = !!this._showAllObjects;
|
|
343
|
+
|
|
344
|
+
const text = document.createElement("span");
|
|
345
|
+
text.className = "st-toggle__label";
|
|
346
|
+
text.textContent = "All Objects";
|
|
347
|
+
|
|
348
|
+
wrap.appendChild(input);
|
|
349
|
+
wrap.appendChild(text);
|
|
350
|
+
|
|
351
|
+
input.addEventListener("change", (e) => {
|
|
352
|
+
e.stopPropagation();
|
|
353
|
+
this._showAllObjects = input.checked;
|
|
354
|
+
this.refresh();
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
this.toolbar.appendChild(wrap);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
#attachTypeVisibilityButtons() {
|
|
361
|
+
const makeTypeButton = (label, title, predicate) => {
|
|
362
|
+
const btn = document.createElement("button");
|
|
363
|
+
btn.type = "button";
|
|
364
|
+
btn.className = "st-btn st-btn--type";
|
|
365
|
+
btn.textContent = label;
|
|
366
|
+
btn.title = title;
|
|
367
|
+
btn.addEventListener("click", (e) => {
|
|
368
|
+
e.stopPropagation();
|
|
369
|
+
this.#toggleVisibility(predicate);
|
|
370
|
+
});
|
|
371
|
+
return btn;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const isFace = (obj) => this.#isFace(obj);
|
|
375
|
+
const isEdge = (obj) => this.#isRegularEdge(obj);
|
|
376
|
+
const isVertex = (obj) => this.#isVertex(obj);
|
|
377
|
+
const isCenterline = (obj) => this.#isCenterlineEdge(obj);
|
|
378
|
+
const isDatumOrPlane = (obj) => this.#isDatum(obj) || this.#isPlane(obj);
|
|
379
|
+
const isSketchOrChild = (obj) => this.#isSketch(obj) || (obj && obj.parent && this.#isSketch(obj.parent));
|
|
380
|
+
|
|
381
|
+
this.toolbar.appendChild(makeTypeButton("Face", "Toggle visibility of all Faces", isFace));
|
|
382
|
+
this.toolbar.appendChild(makeTypeButton("Edge", "Toggle visibility of all Edges (excluding centerlines)", isEdge));
|
|
383
|
+
this.toolbar.appendChild(makeTypeButton("Centerline", "Toggle visibility of all Centerlines", isCenterline));
|
|
384
|
+
this.toolbar.appendChild(makeTypeButton("Point", "Toggle visibility of all Points", isVertex));
|
|
385
|
+
this.toolbar.appendChild(makeTypeButton("Datium", "Toggle visibility of all Datiums (including planes)", isDatumOrPlane));
|
|
386
|
+
this.toolbar.appendChild(makeTypeButton("Sketch", "Toggle visibility of all Sketches", isSketchOrChild));
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#toggleVisibility(predicate) {
|
|
390
|
+
// Decide target: if any matching obj is visible, hide all; otherwise show all.
|
|
391
|
+
let anyVisible = false;
|
|
392
|
+
for (const info of this.nodes.values()) {
|
|
393
|
+
const obj = info.obj;
|
|
394
|
+
if (predicate(obj) && obj && obj.visible !== false) {
|
|
395
|
+
anyVisible = true;
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
const target = !anyVisible;
|
|
400
|
+
for (const info of this.nodes.values()) {
|
|
401
|
+
const obj = info.obj;
|
|
402
|
+
if (predicate(obj) && obj) {
|
|
403
|
+
if (typeof obj.visible !== "undefined") obj.visible = target;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
this.#syncAttributes();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
#labelFor(obj) {
|
|
410
|
+
const base =
|
|
411
|
+
this.#isSolid(obj) ? (obj.name || "Solid") :
|
|
412
|
+
this.#isFace(obj) ? (obj.name || "Face") :
|
|
413
|
+
this.#isEdge(obj) ? (obj.name || "Edge") :
|
|
414
|
+
this.#isLoop(obj) ? (obj.name || "Loop") :
|
|
415
|
+
this.#isVertex(obj) ? (obj.name || "Vertex") :
|
|
416
|
+
(obj.name || obj.type || "Item");
|
|
417
|
+
return base;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
#notifySelection(obj) {
|
|
421
|
+
if (!this._onSelection) return;
|
|
422
|
+
try { this._onSelection(obj); } catch { }
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
#applyTypeClass(li, obj) {
|
|
426
|
+
if (this.#isSolid(obj)) li.classList.add("t-solid");
|
|
427
|
+
else if (this.#isFace(obj)) li.classList.add("t-face");
|
|
428
|
+
else if (this.#isEdge(obj)) li.classList.add("t-edge");
|
|
429
|
+
else if (this.#isLoop(obj)) li.classList.add("t-loop");
|
|
430
|
+
else if (this.#isVertex(obj)) li.classList.add("t-vertex");
|
|
431
|
+
else if (this.#isPlane(obj)) li.classList.add("t-plane");
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
#setOpen(li, open) {
|
|
435
|
+
if (!li) return;
|
|
436
|
+
const caret = li.querySelector(".st-caret");
|
|
437
|
+
if (open) {
|
|
438
|
+
li.classList.add("open");
|
|
439
|
+
if (caret) caret.textContent = "▾";
|
|
440
|
+
} else {
|
|
441
|
+
li.classList.remove("open");
|
|
442
|
+
if (caret) caret.textContent = "▸";
|
|
443
|
+
}
|
|
444
|
+
// Persist state for solids by name (and by uuid for other nodes when enabled)
|
|
445
|
+
try {
|
|
446
|
+
const uuid = li?.dataset?.uuid;
|
|
447
|
+
const info = uuid ? this.nodes.get(uuid) : null;
|
|
448
|
+
const obj = info ? info.obj : null;
|
|
449
|
+
if (obj) this.#rememberOpenState(obj, open);
|
|
450
|
+
} catch (_) { }
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
#setAllOpen(open) {
|
|
454
|
+
for (const info of this.nodes.values()) {
|
|
455
|
+
if (this.#isSolid(info.obj)) this.#setOpen(info.li, open);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
#rememberOpenState(obj, open) {
|
|
460
|
+
if (!obj) return;
|
|
461
|
+
const solidKey = this.#solidOpenKey(obj);
|
|
462
|
+
if (solidKey) {
|
|
463
|
+
this._expandedByName.set(solidKey, !!open);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (this._showAllObjects && obj.uuid) {
|
|
467
|
+
this._expandedByUuid.set(obj.uuid, !!open);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
#solidOpenKey(obj) {
|
|
472
|
+
if (!obj || !this.#isSolid(obj)) return null;
|
|
473
|
+
const key = (obj.name && String(obj.name).length) ? String(obj.name) : null;
|
|
474
|
+
return key;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
#syncCaret(info) {
|
|
478
|
+
if (!info || !info.caret) return;
|
|
479
|
+
const obj = info.obj;
|
|
480
|
+
const canExpand = this.#canExpand(obj);
|
|
481
|
+
if (canExpand) {
|
|
482
|
+
if (info.caret.classList.contains("is-leaf")) info.caret.classList.remove("is-leaf");
|
|
483
|
+
if (info.caret.disabled) info.caret.disabled = false;
|
|
484
|
+
if (info.caret.title !== "Expand/Collapse") info.caret.title = "Expand/Collapse";
|
|
485
|
+
const open = info.li.classList.contains("open");
|
|
486
|
+
const symbol = open ? "▾" : "▸";
|
|
487
|
+
if (info.caret.textContent !== symbol) info.caret.textContent = symbol;
|
|
488
|
+
} else {
|
|
489
|
+
if (!info.caret.classList.contains("is-leaf")) info.caret.classList.add("is-leaf");
|
|
490
|
+
if (!info.caret.disabled) info.caret.disabled = true;
|
|
491
|
+
if (info.caret.textContent !== "•") info.caret.textContent = "•";
|
|
492
|
+
if (info.caret.title) info.caret.title = "";
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// Remembered open state for solids (by name), default collapsed when unknown/unnamed
|
|
497
|
+
#wantOpen(obj) {
|
|
498
|
+
try {
|
|
499
|
+
const solidKey = this.#solidOpenKey(obj);
|
|
500
|
+
if (solidKey) return !!this._expandedByName.get(solidKey);
|
|
501
|
+
if (this._showAllObjects && obj && obj.uuid) return !!this._expandedByUuid.get(obj.uuid);
|
|
502
|
+
return false;
|
|
503
|
+
} catch (_) {
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
#ensureStyles() {
|
|
509
|
+
const ID = "scene-tree-styles";
|
|
510
|
+
if (document.getElementById(ID)) return;
|
|
511
|
+
const style = document.createElement("style");
|
|
512
|
+
style.id = ID;
|
|
513
|
+
style.textContent = `
|
|
514
|
+
/* Dark, minimalist tree for CAD scene - Expand/Collapse fix included */
|
|
515
|
+
.scene-tree{
|
|
516
|
+
color-scheme: dark;
|
|
517
|
+
--bg:#0a0f14;
|
|
518
|
+
--row:#0e141b;
|
|
519
|
+
--row2:#0b1016;
|
|
520
|
+
--hover:#111826;
|
|
521
|
+
--sel:#1e2a3a;
|
|
522
|
+
--muted:#8b98a9;
|
|
523
|
+
--fg:#e6edf3;
|
|
524
|
+
--accent:#4aa3ff;
|
|
525
|
+
--border:#17202b;
|
|
526
|
+
background:var(--bg);
|
|
527
|
+
color:var(--fg);
|
|
528
|
+
border:1px solid var(--border);
|
|
529
|
+
border-radius:12px;
|
|
530
|
+
padding:3px;
|
|
531
|
+
overflow:auto;
|
|
532
|
+
}
|
|
533
|
+
.scene-tree__toolbar{
|
|
534
|
+
display:flex; gap:6px; margin-bottom:6px; flex-wrap:wrap;
|
|
535
|
+
}
|
|
536
|
+
.st-toggle{
|
|
537
|
+
display:flex; align-items:center; gap:6px;
|
|
538
|
+
background:#0f1722; color:var(--fg); border:1px solid var(--border);
|
|
539
|
+
padding:2px 8px; border-radius:8px; font-size:11px; cursor:pointer;
|
|
540
|
+
}
|
|
541
|
+
.st-toggle__input{
|
|
542
|
+
margin:0; accent-color: var(--accent); cursor:pointer;
|
|
543
|
+
}
|
|
544
|
+
.st-toggle__label{
|
|
545
|
+
cursor:pointer;
|
|
546
|
+
}
|
|
547
|
+
.st-toggle:hover{ background:var(--hover); }
|
|
548
|
+
.st-btn{
|
|
549
|
+
background:#0f1722; color:var(--fg); border:1px solid var(--border);
|
|
550
|
+
padding:4px; border-radius:8px; cursor:pointer;
|
|
551
|
+
}
|
|
552
|
+
.st-btn--type{
|
|
553
|
+
font-size:11px;
|
|
554
|
+
padding:2px 8px;
|
|
555
|
+
}
|
|
556
|
+
.st-btn:hover{ background:var(--hover); }
|
|
557
|
+
.scene-tree__list{
|
|
558
|
+
list-style:none; margin:0; padding:0;
|
|
559
|
+
}
|
|
560
|
+
.scene-tree__item{
|
|
561
|
+
border-bottom:1px solid #0f1620;
|
|
562
|
+
}
|
|
563
|
+
.scene-tree__row{
|
|
564
|
+
display:flex; align-items:center; gap:2px; padding:2px 2px; background:var(--row);
|
|
565
|
+
}
|
|
566
|
+
.scene-tree__item:nth-child(even) > .scene-tree__row{ background:var(--row2); }
|
|
567
|
+
.scene-tree__item.is-selected > .scene-tree__row{
|
|
568
|
+
background: var(--sel);
|
|
569
|
+
box-shadow: inset 0 0 0 1px var(--accent);
|
|
570
|
+
}
|
|
571
|
+
.scene-tree__item.is-parent.open > .scene-tree__row{ border-bottom:1px solid #111a26; }
|
|
572
|
+
.st-caret{
|
|
573
|
+
width:20px; height:20px; border:0; background:transparent; color:var(--muted);
|
|
574
|
+
cursor:pointer; line-height:1; padding:0;
|
|
575
|
+
}
|
|
576
|
+
.st-caret.is-leaf{ opacity:.35; cursor:default; }
|
|
577
|
+
.st-chk{
|
|
578
|
+
width:14px; height:14px; accent-color: var(--accent);
|
|
579
|
+
cursor:pointer;
|
|
580
|
+
}
|
|
581
|
+
.st-name{
|
|
582
|
+
background:transparent; border:0; color:var(--fg); cursor:pointer; padding:0;
|
|
583
|
+
font:inherit; text-align:left;
|
|
584
|
+
width: 100%;
|
|
585
|
+
}
|
|
586
|
+
.st-name:hover{ text-decoration: underline; }
|
|
587
|
+
.scene-tree__list--child{
|
|
588
|
+
margin:0; padding-left:24px;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/* ▼▼ Expand/Collapse behavior (fix): hide child UL when parent isn't open */
|
|
592
|
+
.scene-tree__item.is-parent > .scene-tree__list--child { display: none; }
|
|
593
|
+
.scene-tree__item.is-parent.open > .scene-tree__list--child { display: block; }
|
|
594
|
+
/* ▲▲ */
|
|
595
|
+
|
|
596
|
+
/* Type tint (subtle) */
|
|
597
|
+
.t-face .st-name{ color:#c7e0ff; }
|
|
598
|
+
.t-edge .st-name{ color:#bfe4d0; }
|
|
599
|
+
.t-loop .st-name{ color:#e7ced6; }
|
|
600
|
+
.t-vertex .st-name{ color:#ffe6a6; }
|
|
601
|
+
.t-plane .st-name{ color:#c7ffcf; }
|
|
602
|
+
|
|
603
|
+
`;
|
|
604
|
+
document.head.appendChild(style);
|
|
605
|
+
}
|
|
606
|
+
}
|