PartOccurrence (hwx.inspire.core)

Base class for Part and Sketch Part.


active: Bool

autoCalculateCG: Bool

autoCalculateMass: Bool

autoCalculateMoment: Bool

cg: Location

color: Color

detectCollisions: Bool

ground: Bool

ip: Inertia

mass: Double

material: Attribute

modifiable: Bool

morphable: Bool

movable: Bool

name: Attribute

position: Attribute

transparency: Double

visible: Bool

volume: Double


Public Methods

classmethod getClass (cls, className)

destroy (self)

getAllChildren (self, type=None, **kwds)

getChild (self, name=None, recursive=False, **kwds)

getChildren (self, type=None, recursive=False, sorted=False, **kwds)

getDependents (self, recursive=False, **kwds)

getFeature (self, name=None)

getFeatures (self, type=None, rep=’BestRep’, **kwds)

getReferences (self, recursive=False, **kwds)

isa (self, type=None, filter=None, name=None, wildcard=None, **kwds)

meshInfo (self)

modelPositions (self)

save (self, file)

Attribute Details

active : Bool

Returns or sets the object activeness.

Setting this on or off sets all children. Setting to True sets all the parents active too.

autoCalculateCG : Bool

Determines whether the center of gravity is auto calculated.

autoCalculateMass : Bool

Determines whether the mass value is automatically calculated based upon volume and material density.

autoCalculateMoment : Bool

Determines whether the mass moment of inertia is automatically calculated.

cg : Location (units=”length”)

Returns the object’s global center of gravity as a point.

color : Color

Determines the color assigned to the object when it is displayed in the modeling window.

The default color for parts is gray, but a different color can be assigned.

detectCollisions : Bool

Determines whether to detect collision.

It prevents parts in the model from overlapping and has been enabled by default.

ground : Bool

Returns or sets the object to be ground or immovable.

ip : Inertia (units=”massMI”)

Specifies the inertial properties of this object.

Resistance to change in motion (ixx, iyy, izz, ixy, izy, ixz).

mass : Double (units=”m”)

The mass of the object.

material : Attribute

The material of the object.

Every part in the model has a material assigned to it. The default material is steel, but a different material can be assigned.

modifiable : Bool

Determines whether the selected object can be edited.

morphable : Bool

Determines whether the selected object shape can be changed.

movable : Bool

Determines whether the selected object can be translated in the modeling window or has been locked in place.

name : Attribute

Returns or sets the name of the object.

It can be any text string, including spaces, although it’s best to avoid using the following characters: ” ‘ * ? and $.

While these characters are allowed, they could create difficulties when you export the model to other applications.

position : Attribute

Specifies the global transform as a Matrix44.

transparency : Double

Specifies the transparency of the object.

Allows you to change the transparency, according to a percentage. By default, objects are 0% transparent(opaque).

visible : Bool

Determines whether the object is visible in the graphics window.

Setting this on or off sets all children. Setting to True sets all the parents visible too.

volume : Double (units=”volume”)

The volume of the object in the assembly.

Property Details

property currentRepresentation

str: The active representation

property features

Returns the list of features.

property representations

list[str]: Existing geometries of the part. ParasolidRep, StlRep, OpenVDBRep, PolymeshRep, …

Method Details

classmethod getClass(cls, className)

Returns the class of the object.

It can be simple or qualified (with namespace). If the name is simple, we prepend the cls.namespace.

param className

The class name.

type className

Union[Part, Occurrence, Named..]


The class for the specified className.


Union[Part, Occurrence, Named..]


Destroys occurrences from the model.

getAllChildren(self, type=None, **kwds)

Returns a list of all children that matches the specified type.

param type

Filter to use to get the children based on object type.

type type


param **kwds

Additional keyword arguments to match other attributes of the object.


The list of children that satisfy the supplied filters.


list[Union[Part, Motor, BoundaryCondition, …]]

getChild(self, name=None, recursive=False, **kwds)

Returns the child of the object which matches the specified unique name.

param name

The name of the child object.

type name


param recursive

Search all descendents.

type recursive


param **kwds

Additional keyword arguments to match attributes of the object.


The child object which satisfies the specified filters.



getChildren(self, type=None, recursive=False, sorted=False, **kwds)

Returns a list of children that is of the specified type.

param type

Filter objects by class.

type type


param recursive

True to get all descendent Parts and Assemblies.

type recursive


param sorted

Sort the children base on id.

type sorted




getDependents(self, recursive=False, **kwds)

Get objects that reference this object through a Reference attribute.

param recursive

type recursive


param **kwds

Filter objects using isa.



getFeature(self, name=None)

Returns the feature based on its name.

getFeatures(self, type=None, rep='BestRep', **kwds)

“Returns a list of features based on specified filters.

param type

Filters the features based on type.

type type

FeaturePoint, FeatureArea, FeatureCylindrical..etc)

param rep

Feature representation. See part.representations for options

type rep


param **kwds

Additional attributes to consider while filtering.

List of

features that satisfies all the filter criteria.


list [FeaturePoint, FeatureArea, FeatureCylindrical..etc)]

getReferences(self, recursive=False, **kwds)

Get objects this object references through a Reference attribute.

param recursive

type recursive


param **kwds

Filter objects using isa.



isa(self, type=None, filter=None, name=None, wildcard=None, **kwds)

Determines if the object matches the specified settings or not.

param type

The type of the object.

type type

Union[Part, Assembly, Contact..]

param filter

Return value of specified callback method.

type filter


param name

Name that matches exactly with object name.

type name


param wildcard

A pattern to match exactly with the object name.

type wildcard


param **kwds

Additional keyword arguments to match other attributes.


True, if a match is found, otherwise False.




Mesh infomation for an assembly or Part.


Forces all objects to return the original model positions instead of the current analysis positions.

Useful when defining draw methods on GeneralObjects where behaviour is different while animating.

save(self, file)

Save the Part in the specified file.

param file

File name and path, where the file needs to be saved. Valid file extensions are:

‘.x_b’, ‘.x_t’, ‘.xmt_bin’, ‘.xmt_txt’, ‘.sat’, ‘.sab’, ‘.iges’, ‘.igs’, ‘.stl’, ‘.step’, ‘.stp’, ‘.obj’, ‘.vrml’, ‘.vrl’.

type file