Python API Change Log
PiXYZ STUDIO 2018.3.2.8 to 2019.1.0.9
(Released April 23, 2019)
IMPORTANT INFORMATION
PiXYZ STUDIO 2019.1 introduces a new concept for Product Structure management. This considerably affects the way to create script with PiXZY STUDIO Python API.
Also, many API functions were either removed, added, renamed or modified, between PiXYZ STUDIO 2018.3.2.8 and 2019.1.0.9.
Check all functions modifications in detail below, and the following topics:
About 2019.1 New Product Structure: Read how PiXYZ STUDIO benefits from this new Product Structure and what it implies
About the Product Structure (Tree): Read about the Product Structure concept in PiXYZ STUDIO
API Documentation: Refer to the API documentation to find functions description, parameters and types
Scripting With the Python API: Get started with scripting in PiXYZ STUDIO by reading this topic
Sample Scripts Directory: Use built-in sample scripts as a guideline
MAIN CONCEPT CHANGES
- The Scene Path concept used until PiXYZ STUDIO 2018.3 was removed, and replaced by a new Product Structure concept based on a Scene Tree made of a single node type called Occurrence. A collection of Scene Paths is replaced by an Occurrence List.
- A Component used to designate a Product Structure node type (Part, Light, Assembly or Camera) until PiXYZ STUDIO 2018.3.
Now a Component is a piece of data added on top of an occurrence to modulate its functional behavior (like in Unity3D). - Instance nodes that were used to instantiate Parts or Assemblies until PiXYZ STUDIO 2018.3 no longer exist. Now instantiation is managed through a new concept called Prototype. A Prototype is an occurrence that can be referenced by other occurrences, allowing to create instantiation behavior.
NOTE Quickly access all PiXYZ STUDIO API functions using the Function List, accessible from the F12 shortcut, and from the Main Toolbar.
REMOVED FUNCTIONS
Module: algo
- algo.createPatchesFromLOI (Lines Of Interest concept was already deprecated, removed)
- algo.createVisibilityPatchesFromLOI (Lines Of Interest concept was already deprecated, removed)
- algo.deleteLinesOfInterest (Lines Of Interest concept was already deprecated, removed)
- algo.identifyLinesOfInterest (Lines Of Interest concept was already deprecated, removed)
- algo.generateAmbientOcclusionMap (experimental, was added to the bakeMaps() function)
- algo.generateNormalMap (was added to algo.bakeMaps)
Module: scene
- scene.updateModifiers (Modifiers concept removed)
- scene.destroyHistory (Modifiers concept removed)
- scene.activateShape (Modifiers concept removed)
- scene.singularizePaths (Scene Paths concept removed, replaced by Occurrence List)
- scene.setOccurrenceProperty (use now core.setProperty on an occurrence)
- scene.hasOccurrenceProperty (use now core.hasProperty on an occurrence)
- scene.setInstanceRef (Scene Paths concept removed, replaced by Occurrence List) use setProtottype
- scene.replaceMaterialsOnSelection (missing function, will be added soon in 2019.1 Update 1)
- scene.removeGroupFromGroup (Group concept removed)
- scene.removeScenePathsFromGroup (Group concept removed)
- scene.listGroups (Group concept removed)
- scene.getSubGroups (Group concept removed)
- scene.createGroup (Group concept removed)
- scene.addGroupsToGroup (Group concept removed)
- scene.addScenePathsToGroup (Group concept removed)
- scene.getSceneNodeOfOccurrence (Scene Node replaced by Occurrence)
- scene.getSceneNodeType (Scene Node replaced by Occurrence)
- scene.getScenePathFromOccurrence (Scene Path concept removed, replaced by Occurrence)
- scene.getScenePathsInGroup (Group concept removed)
- scene.getSceneRootOccurrence (use now scene.getRoot)
- scene.getPartPaths (use now scene.getPartOccurrences)
- scene.getOccurrenceChildren (use now scene.getChildren)
- scene.getOccurrenceFromScenePath (Scene Path concept removed, replaced by Occurrence)
- scene.getOccurrenceParent (use now scene.getParent)
- scene.getOccurrenceProperties (use now core.listProperties)
- scene.getOccurrenceProperty (use now core.getProperty)
- scene.getOccurrencesOnSceneNode (Scene Node replaced by Occurrence)
- scene.getOccurrencesVisibility (use now scene.getGlobalVisibility)
- scene.getComponentType (Component concept changed)
- scene.findByAllProperty (use now scene.findByProperty)
- scene.findByName (use now scene.findByProperty)
- scene.findByOccurrenceProperty (use now scene.findByProperty)
- scene.createBRepShape (use now scene.setPartModel)
- scene.createTessellatedShape (use now scene.setPartMesh)
- scene.deleteEmptyAssemblies (use now scene.deleteEmptyOccurrences)
- scene.deleteEmptyParts (use now scene.deleteEmptyOccurrences)
- scene.createPart (use now scene.addComponent)
- scene.createAssembly (use now scene.createOccurrence or scene.createOccurence(s))
- scene.clear (use now core.resetSession)
Module: sceneGraph
The Scene Graph concept was removed in PiXYZ STUDIO 2019.1. Interaction are now controlled through Visual Behavior and Interaction Behavior components.
- scenegraph.addScenePathsToMotionGroup
- scenegraph.createGraphNode
- scenegraph.createMotionGroup
- scenegraph.createMotionGroupAtPosition
- scenegraph.getRoot
- scenegraph.replaceMaterial
- scenegraph.setParent
ADDED FUNCTIONS
Module: core
- core.addSessionLogFileVerbose
- core.removeSessionLogFileVerbose
- core.executeCommand
- core.getFunction
- core.getFunctions
- core.getGroup
- core.getGroups
- core.getModules
- core.getModulesName
Module: geom
- geom.applyTransform
Module: algo
- algo.backToBRep
- algo.createVisibilityInformationFromViewPoints
- algo.deleteBRepShapes
- algo.listFeatures
- algo.mapUvOnBox
- algo.mapUvOnCylinder
- algo.mapUvOnMBB
- algo.mapUvOnPlane
- algo.mapUvOnSphere
- algo.marchingCubes
- algo.replaceBy
- algo.replaceByPrimitive
- algo.smartOrient
Module: CAD
Access now PiXYZ CAD modeler through Python functions.
- cad.addSurfaceDefinition
- cad.createBody
- cad.createClosedShell
- cad.createCurveExtrusionSurface
- cad.createEdgeFromCurve
- cad.createEllipticConeSurface
- cad.createHelixCurve
- cad.createHermiteCurve
- cad.createHyperbolaCurve
- cad.createLineCurve
- cad.createModel
- cad.createOffsetSurface
- cad.createOpenShell
- cad.createParabolaCurve
- cad.createTabulatedCylinderSurface
- cad.createTransformedCurve
- cad.createVertex
- cad.evalCurvatureOnCurve
- cad.evalCurvatureOnSurface
- cad.evalOnCurve
- cad.evalOnSurface
- cad.getBodyClosedShells
- cad.getBoundedCurveDefinition
- cad.getCircleCurveDefinition
- cad.getClosedShellOrientedDomains
- cad.getCompositeCurveDefinition
- cad.getConeSurfaceDefinition
- cad.getCurveExtrusionSurfaceDefinition
- cad.getCurveLimits
- cad.getCylinderSurfaceDefinition
- cad.getEdgeDefinition
- cad.getEllipseCurveDefinition
- cad.getEllipticConeSurfaceDefinition
- cad.getFaceDefinition
- cad.getFaceMaterial
- cad.getHelixCurveDefinition
- cad.getHermiteCurveDefinition
- cad.getHyperbolaCurveDefinition
- cad.getIntersectionCurveDefinition
- cad.getLineCurveDefinition
- cad.getLoopOrientedEdges
- cad.getNURBSCurveDefinition
- cad.getNURBSSurfaceDefinition
- cad.getOffsetCurveDefinition
- cad.getOffsetSurfaceDefinition
- cad.getOpenShellOrientedDomains
- cad.getParabolaCurveDefinition
- cad.getPlaneSurfaceDefinition
- cad.getPolylineCurveDefinition
- cad.getRevolutionSurfaceDefinition
- cad.getRuledSurfaceDefinition
- cad.getSegmentCurveDefinition
- cad.getSphereSurfaceDefinition
- cad.getSurfaceLimits
- cad.getSurfacicCurveDefinition
- cad.getTabulatedCylinderSurfaceDefinition
- cad.getTorusSurfaceDefinition
- cad.getTransformedCurveDefinition
- cad.invertCurve
- cad.isCurveClosed
- cad.isCurvePeriodic
- cad.isSurfaceClosed
- cad.isSurfacePeriodic
- cad.projectOnCurve
- cad.projectOnSurface
- cad.setFaceMaterial
Module: material
- material.clearAllMaterials
- material.makeMaterialNamesUnique
Module: scene
- scene.addComponent
- scene.addFilterToLibrary
- scene.addLightComponent
- scene.clearSelection
- scene.computeSubTreeChecksum
- scene.convertToOldSchoolVisibility
- scene.createAndSelectOccurrenceFromSelection
- scene.createAndSelectOccurrences
- scene.createOccurrence
- scene.createOccurrenceFromSelection
- scene.createOccurrences
- scene.createVariant
- scene.deleteComponentByType
- scene.deleteComponentsByType
- scene.deleteEmptyOccurrences
- scene.deleteSelection
- scene.evaluateExpressionOnOccurrences
- scene.evaluateExpressionOnSubTree
- scene.explodeSelection
- scene.exportFilterLibrary
- scene.findFilterByName
- scene.getComponent
- scene.getComponentOccurrence
- scene.getFilterFromLibrary
- scene.getFilteredOccurrences
- scene.getGlobalVisibility
- scene.getParent
- scene.getPartOccurrences
- scene.getPrototype
- scene.getReferencers
- scene.getVariantRoot
- scene.hasComponent
- scene.hide
- scene.importFilterLibrary
- scene.invertOrientationSelection
- scene.listFilterLibrary
- scene.listVariants
- scene.movePivotPointToOccurrenceCenter
- scene.movePivotPointToOrigin
- scene.movePivotPointToSelectionCenter
- scene.prototypeSubTree
- scene.removeFilterFromLibrary
- scene.resetPartTransform
- scene.selectDuplicated
- scene.selectInstances
- scene.setComponentOccurrence
- scene.setPartMesh
- scene.setPartModel
- scene.setPivotOnly
- scene.setPrototype
- scene.show
- scene.showOnly
Module: view
- view.disableColorOverriding
- view.enableColorOverriding
- view.getCurrentCamera
- view.getProjectionMatrix
- view.getViewMatrix
- view.setOverridingColors
RENAMED FUNCTIONS
Module: algo
- algo.defeature => algo.removeHoles
- algo.explodeConnectedTessellations => algo.explodeConnectedMeshes
Module: scene
- scenegraph.replaceMaterial = > scene.replaceMaterial
- scene.getSelectionedOccurrences => scene.getSelectedOccurrences
- scene.transferCADMaterialsOnParts => scene.transferCADMaterialsOnPartOccurrences
- scene.singularizeSubTree => scene.makeInstanceUnique
- scene.selectSmallParts => scene.selectByMaximumSize
- scene.selectDuplicatedParts => scene.selectDuplicated
- scene.renameLongPartName => scene.renameLongOccurrenceName
- scene.moveOccurrence => scene.moveOccurrences
- scene.mergeAssembliesByTreeLevel => scene.mergeByTreeLevel
- scene.mergeFinalAssemblies => scene.mergeFinalLevel
- scene.identifyMultipleOccurrences => scene.identifyInstances
- scene.getTessellatedShapeTessellation => scene.getTessellatedShapeMesh
Module: material
- material.importSubstanceMaterials => material.createMaterialsFromMaps
Module: view
- view.createMotionGroupOnCameraTarget => view.createOccurrenceOnCameraTarget
Module: generateProxy
- generateProxy.generateProxyMesh => generateProxy.proxyMeshWithTextures
MODIFIED FUNCTIONS
Module: algo
automaticUVMapping
automaticUVMapping(occurrences[, channel, maxAngleDistorsion, maxAreaDistorsion, sharpToSeam, forbidOverlapping, scaleToOne])
Experimental :Generates the texture coordinates and automatically cut
Parameters
----------
occurrences : OccurrenceList
Occurrences of part to process
channel : Int , optional
(default: 0)
The UV channel which will contains the texture coordinates
maxAngleDistorsion : Double , optional
(default: 0.5)
Maximum angle distorsion |2PI-SumVtxAng|/2PI
maxAreaDistorsion : Double , optional
(default: -1)
Maximum area distorsion before scale to 1. |2DArea-3DArea|/3DArea
sharpToSeam : Bool , optional
(default: true)
If enabled, sharp edges are automatically considered as UV seams
forbidOverlapping : Bool , optional
(default: true)
If enabled, UV cannot overlap
combineMeshesByVisibleMaterials
combineMeshesByVisibleMaterials(occurrences[, mergeNoMaterials, mergeHiddenPartsMode])
Explode and (re)merge a set of mesh parts by visible materials
Parameters
----------
occurrences : OccurrenceList
Occurrences of the parts to merge
mergeNoMaterials : Boolean , optional
(default: true)
If true, merge all parts with no active material together, else do not merge them
mergeHiddenPartsMode : MergeHiddenPartsMode , optional
(default: 0)
Hidden parts handling mode, Destroy them, make visible or merge separately
Returns:
-------
mergedOccurrences : OccurrenceList
Resulting occurrences of the merged parts
hiddenRemoval
hiddenRemoval(occurrences, level, resolution, sphereCount[, fovX, considerTransparentOpaque])
Delete parts, patches or polygons not viewed from a sphere around the scene
Parameters
----------
occurrences : OccurrenceList
Occurrences of components to process
level : SelectionLevel
Level of parts to remove : Parts, Patches or Polygons
resolution : Int
Resolution of the visibility viewer
sphereCount : Int
Segmentation of the sphere sphereCount x sphereCount
fovX : Double , optional
(default: 90)
Horizontal field of view (in degree)
considerTransparentOpaque : Boolean , optional
(default: false)
If True, Parts, Patches or Polygons with a transparent appearance are considered as opaque
proxyMesh
proxyMesh(occurrences, voxelSize, marchingCubes, projectPoints)
Replace the tessellations of the selected parts by a proxy mesh based on a voxelization
Parameters
----------
occurrences : OccurrenceList
Occurrences of part to process
voxelSize : Distance
Size of voxels
Returns:
-------
proxyMeshPart : Occurrence
Resulting part occurrence
removeHoles (old defeature)
removeHoles(occurrences[, throughHoles, blindHoles, surfacicHoles, maxDiameter, fillWithMaterial])
Remove some features from tessellations
Parameters
----------
occurrences : OccurrenceList
Occurrences of components to process
throughHoles : Boolean , optional
(default: true)
Remove through holes
blindHoles : Boolean , optional
(default: false)
Remove blind holes
surfacicHoles : Boolean , optional
(default: false)
Remove surfacic holes
maxDiameter : Distance , optional
(default: -1)
Maximum diameter of the holes to be removed (-1=no max diameter)
fillWithMaterial : Material , optional
(default: 0)
If set, the given material will be used to fill the holes
smartHiddenRemoval
smartHiddenRemoval(occurrences, level, voxelSize, minimumCavityVolume, resolution[, mode, considerTransparentOpaque])
Delete parts, patches or polygons not viewed from a set of camera automatically generated
Parameters
----------
occurrences : OccurrenceList
Occurrences of components to process
level : SelectionLevel
Level of parts to remove : Parts, Patches or Polygons
voxelSize : Distance
Size of the voxels in mm (smaller it is, more viewpoints there are)
minimumCavityVolume : Volume
Minimum volume of a cavity in cubic meter (smaller it is, more viewpoints there are)
resolution : Int
Resolution of the visibility viewer
mode : SmartHiddenType , optional
(default: 0)
Select where to place camera (all cavities, only outer or only inner cavities)
considerTransparentOpaque : Boolean , optional
(default: false)
If True, Parts, Patches or Polygons with a transparent appearance are considered as opaque
smartHiddenSelection
smartHiddenSelection(occurrences, voxelSize, minimumCavityVolume, resolution[, mode, considerTransparentOpaque])
Select parts not viewed from a set of camera automatically generated
Parameters
----------
occurrences : OccurrenceList
Occurrences of components to process
voxelSize : Distance
Size of the voxels in mm (smaller it is, more viewpoints there are)
minimumCavityVolume : Volume
Minimum volume of a cavity in cubic meter (smaller it is, more viewpoints there are)
resolution : Int
Resolution of the visibility viewer
mode : SmartHiddenType , optional
(default: 0)
Select where to place camera (all cavities, only outer or only inner cavities)
considerTransparentOpaque : Boolean , optional
(default: false)
If True, Parts, Patches or Polygons with a transparent appearance are considered as opaque
tessellate
tessellate(occurrences, maxSag, maxLength, maxAngle[, createNormals, uvMode, uvChannel, uvPadding, createTangents, createFreeEdges, keepBRepShape, overrideExistingTessellation])
Create a tessellated representation from a CAD representation for each given part
Parameters
----------
occurrences : OccurrenceList
Occurrences of components to tessellate
maxSag : Distance
Maximum distance between the geometry and the tessellation
maxLength : Distance
Maximum length of elements
maxAngle : Angle
Maximum angle between normals of two adjacent elements
createNormals : Boolean , optional
(default: true)
If true, normals will be generated
uvMode : UVGenerationMode , optional
(default: )
Select the texture coordinates generation mode
uvChannel : Int , optional
(default: 1)
The UV channel of the generated texture coordinates (if any)
uvPadding : Double , optional
(default: 0.0)
The UV padding between UV island in UV coordinate space (between 0-1). This parameter is handled as an heuristic so it might not be respected
createTangents : Boolean , optional
(default: false)
If true, tangents will be generated
createFreeEdges : Boolean , optional
(default: false)
If true, free edges will be created for each patch borders
keepBRepShape : Boolean , optional
(default: true)
If true, BRep shapes will be kept for Back to Brep or Retessellate
overrideExistingTessellation : Boolean , optional
(default: false)
If true, already tessellated parts will be re-tessellated
Module: scene
mergeByTreeLevel (old mergeAssembliesByTreeLevel)
mergeByTreeLevel(maxLevel[, mergeHiddenPartsMode])
Merge all parts over maxLevel level
Parameters
----------
maxLevel : Int
Maximum tree level
mergeHiddenPartsMode : MergeHiddenPartsMode , optional
(default: 0)
Hidden parts handling mode, Destroy them, make visible or merge separately
mergeFinalLevel (old mergeFinalAssemblies)
mergeFinalLevel([roots, mergeHiddenPartsMode, CollapseToParent])
Merge final level (occurrences with only occurrence with part component as children)
Parameters
----------
roots : OccurrenceList , optional
(default: 0)
Roots occurrences for the process (will not be removed)
mergeHiddenPartsMode : MergeHiddenPartsMode , optional
(default: 0)
Hidden parts handling mode, Destroy them, make visible or merge separately
CollapseToParent : Boolean , optional
(default: false)
If true, final level unique merged part will replace its parent
mergeParts
mergeParts(partOccurrences[, mergeHiddenPartsMode])
Merge a set of parts
Parameters
----------
partOccurrences : OccurrenceList
Occurrence of the parts to merge
mergeHiddenPartsMode : MergeHiddenPartsMode , optional
(default: 0)
Hidden parts handling mode, Destroy them, make visible or merge separately
Returns:
-------
mergedOccurrences : OccurrenceList
Resulting merged occurrences
mergePartsByAssemblies
mergePartsByAssemblies([roots, mergeHiddenPartsMode, CollapseToParent])
Merge all parts under each assembly together
Parameters
----------
roots : OccurrenceList , optional
(default: 0)
Roots occurrences for the process (will not be removed)
mergeHiddenPartsMode : MergeHiddenPartsMode , optional
(default: 0)
Hidden parts handling mode, Destroy them, make visible or merge separately
CollapseToParent : Boolean , optional
(default: false)
If true, final level unique merged part will replace its parent
mergePartsByMaterials
mergePartsByMaterials(partOccurrences[, mergeNoMaterials, mergeHiddenPartsMode])
Merge a set of parts by materials
Parameters
----------
partOccurrences : OccurrenceList
Occurrence of the parts to merge
mergeNoMaterials : Boolean , optional
(default: true)
If true, merge all parts with no active material together, else do not merge them
mergeHiddenPartsMode : MergeHiddenPartsMode , optional
(default: 0)
Hidden parts handling mode, Destroy them, make visible or merge separately
Returns:
-------
mergedOccurrences : OccurrenceList
Resulting merged occurrences
selectByMaximumSize (old selectSmallParts)
selectByMaximumSize(maxDiagLength[, maxSize])
Select small parts
Parameters
----------
maxDiagLength : Distance
If the diagonal axis of the bouding box is less than maxDiagLength, part will be selected. -1 to ignore
maxSize : Distance , optional
(default: -1)
If the longer axis of the box is less than maxLength, part will be selected. -1 to ignore