Product Structure Management
Parsing scene tree
- scene.getRoot()
- scene.getChildren(occurrence)
- scene.getParent(occurrence)
- scene.hasComponent(occurrence, scene.ComponentType.Part)
- scene.getComponent(occurrence, scene.ComponentType.Part)
Parsing scene tree example
def traverseTree(occurrence):
print("Occurrence " + str(occurrence))
if scene.hasComponent(occurrence, scene.ComponentType.Part):
print("-> has part")
for child in scene.getChildren(occurrence):
traverseTree(child)
traverseTree(scene.getRoot())
Node creation
- scene.createOccurrence()
- scene.addComponent(occurrence, componentType)
- scene.prototypeSubTree(occurrence)
- scene.setParent(occurrence, parent)
- scene.setLocalMatrix(occurrence, matrix)
Node creation example
- part = scene.createOccurrence("Part1")
- scene.addComponent(part, scene.ComponentType.Part)
- instance1 = scene.prototypeSubTree(part)
- instance2 = scene. prototypeSubTree(part)
- assembly = scene. createOccurrence("Assembly")
- scene.setParent(instance1, assembly)
- scene.setParent(instance2, assembly)
- scene.setParent(assembly, scene.getRoot())
Accessing part geometry
- scene.getPartActiveShape(part)
- For TessellatedShape type :
- tessellation = scene.getTessellatedShapeMesh(shape)
- polygonal.getMeshDefinitions(tessellation)
- polygonal. createMeshFromDefinition(meshDefinition)
- For BRepShape type
- scene.getBRepShapeModel(shape)
Simple CAD geometry example
torus = cad.createTorusSurface(100, 10)
face = cad.createFace(torus)
model = cad.createModel()
cad.addToModel(face, model)
occurrence = scene.createOccurrence("Torus")
part = scene.addComponent(occurrence, scene.ComponentType.Part)
scene.setPartModel(part, model)
scene.setParent(occurrence, scene.getRoot())
Custom properties
Not all entity types support custom properties
- core.supportCustomProperties(entity)
- core.addCustomProperty(node, « propertyName », « propertyValue »)
- core.getProperty(node, « property ») like any other built-in property
Find nodes by properties
- scene.findByActiveMaterial()
- scene.findByProperty(« propertyName », « regex »)
- scene.findMaterialByProperty(« propertyName », « regex »)
- ECMAScript type regex