Modeler#

Usage:

Modeler Class API Wrapper

class Modeler[source]#

Bases: object

Wrapper for Modeler class of Moldflow Synergy.

activate_lcs(lcs, active, lcs_type)[source]#

Activates or deactivates a local coordinate system (LCS)

Parameters:
  • lcs (EntList) – The LCS to activate or deactivate.

  • active (bool) – Specify True to activate the LCS

  • it (False to deactivate)

  • lcs_type (LCSType | str) – The type of the LCS. Ignored if LCS is deactivated

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

break_curves(curve1, curve2)[source]#

Breaks two curves at their intersection points

Parameters:
  • curve1 (EntList) – The first curve.

  • curve2 (EntList) – The second curve.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

center_lines()[source]#

Extract center lines from visible CAD bodies with Channel (3D) property. Tapered bodies or flat bodies will not be processed. :rtype: bool

Returns:

bool: True if the operation was successful, False otherwise.

create_arc_by_angle(center, radius, start, end, prop_set, ends)[source]#

Creates an arc from a center and start and end angles

Parameters:
  • center (Vector) – The center of the arc.

  • radius (float) – The radius of the arc.

  • start (float) – The starting angle of the arc.

  • end (float) – The ending angle of the arc.

  • prop_set (Property) – The property set for the arc.

  • ends (bool) – Whether to include the endpoints.

Returns:

The list of created arcs.

Return type:

EntList

create_arc_by_points(pt1, pt2, pt3, circle, prop_set, ends)[source]#

Creates an arc from three points

Parameters:
  • pt1 (Vector) – The first point.

  • pt2 (Vector) – The second point.

  • pt3 (Vector) – The third point.

  • circle (bool) – Specify True to create a circle

  • points (False to create an arc between the first and third)

  • respectively

  • prop_set (Property) – The property set for the arc.

  • ends (bool) – Whether to include the endpoints.

Returns:

The list of created arcs.

Return type:

EntList

create_boundary_list()[source]#

Creates an empty BoundaryList object

Returns:

The created boundary list.

Return type:

BoundaryList

create_curve_by_connect(curve1, end1, curve2, end2, factor, prop_set)[source]#

Creates a curve by connecting two curves

Parameters:
  • curve1 (EntList) – The first curve.

  • end1 (float) – Specify

  • curve (0 to choose the beginning of the first)

  • end (1 to choose its)

  • curve2 (EntList) – The second curve.

  • end2 (float) – Specify

  • curve

  • end

  • factor (float) – The fillet factor

  • prop_set (Property) – The property set for the curve.

Returns:

The list of created curves.

Return type:

EntList

create_entity_list()[source]#

Creates an empty EntList object

Returns:

The created entity list.

Return type:

EntList

create_hole_by_boundary(region, curve)[source]#

Creates a hole in a region from an ordered sequence of boundary curves

Parameters:
  • region (EntList) – The region to create the hole in.

  • curve (EntList) – The boundary curve for the hole.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

create_hole_by_extrusion(region, curve, direction)[source]#

Creates a hole in a region by extruding a set of curves along a given direction vector

Parameters:
  • region (EntList) – The region to create the hole in.

  • curve (EntList) – The curve to extrude.

  • direction (Vector) – The direction vector for extrusion.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

create_hole_by_nodes(region, nodes)[source]#

Creates a hole in a region from an ordered sequence of boundary nodes

Parameters:
  • region (EntList) – The region to create the hole in.

  • nodes (EntList) – The nodes for the hole.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

create_hole_by_ruling(region, curve1, curve2)[source]#

Creates a hole in a region by a ruling operation

Parameters:
  • region (EntList) – The region to create the hole in.

  • curve1 (EntList) – The first curve.

  • curve2 (EntList) – The second curve.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

create_lcs_by_points(coord1, coord2=None, coord3=None)[source]#

Creates a local coordinate system (LCS) from three points

Parameters:
  • coord1 (Vector) – The first point.

  • coord2 (Vector) – The second point. Specify None if only 1 point

  • coord3 (Vector) – The third point. Specify None if only 2 points

Returns:

The created local coordinate system.

Return type:

EntList

create_line(coord, vec, relative, prop_set, ends)[source]#

Creates a line from between two given points :rtype: EntList

Args:

coord (Vector): The starting point of the line. vec (Vector): The direction vector of the line. relative (bool): Specify False if Vec specifies the coordinates of the second point True if Vec specifies an offset will be added to the first point to obtain the second prop_set (Property): The property set for the line. ends (bool): Whether to include the endpoints.

Returns:

EntList: The list of created lines.

create_node_by_intersect(curve, curve2, pt)[source]#

Creates a node at an intersection of two curves

Parameters:
  • curve (EntList) – The first curve.

  • curve2 (EntList) – The second curve.

  • pt (Vector) – The point of intersection.

Returns:

The list of created nodes.

Return type:

EntList

create_node_by_xyz(coord)[source]#

Create a node by its coordinates.

Parameters:

coord (Vector) – The coordinates of the node.

Returns:

The ID of the created node.

Return type:

int

create_nodes_between(start, end, num_nodes)[source]#

Creates a set of nodes between two given points

Parameters:
  • start (Vector) – Specifies the coordinates of the first point

  • end (Vector) – Specifies the coordinates of the second point

  • num_nodes (int) – The number of nodes to create.

Returns:

The list of created nodes.

Return type:

EntList

create_nodes_by_divide(curve, num_nodes, ends)[source]#

Creates a set of nodes by dividing a curve (the curve itself is not modified)

Parameters:
  • curve (EntList) – The curve to divide.

  • num_nodes (int) – The number of nodes to create.

  • ends (bool) – Whether to include the endpoints.

Returns:

The list of created nodes.

Return type:

EntList

create_nodes_by_offset(coord, offset, num_nodes)[source]#

Creates a set of nodes by an offset operation

Parameters:
  • coord (Vector) – The starting point.

  • offset (Vector) – The offset vector.

  • num_nodes (int) – The number of nodes to create.

Returns:

The list of created nodes.

Return type:

EntList

create_region_by_boundary(curve, prop_set)[source]#

Creates a region from an ordered sequence of boundary curves

Parameters:
  • curve (EntList) – The boundary curve.

  • prop_set (Property) – The property set for the region.

Returns:

The list of created regions.

Return type:

EntList

create_region_by_extrusion(curve, direction, prop_set)[source]#

Creates one or more regions by extruding a set of curves along a given direction vector

Parameters:
  • curve (EntList) – The curve to extrude.

  • direction (Vector) – The direction vector for extrusion.

  • prop_set (Property) – The property set for the region.

Returns:

The list of created regions.

Return type:

EntList

create_region_by_nodes(nodes, prop_set)[source]#

Creates a region from an ordered sequence of boundary nodes

Parameters:
  • nodes (EntList) – The nodes for the region.

  • prop_set (Property) – The property set for the region.

Returns:

The list of created regions.

Return type:

EntList

create_region_by_ruling(curve1, curve2, prop_set)[source]#

Creates one or more regions between two sets of curves by a ruling operation

Parameters:
  • curve1 (EntList) – The first curve.

  • curve2 (EntList) – The second curve.

  • prop_set (Property) – The property set for the region.

Returns:

The list of created regions.

Return type:

EntList

create_spline(coord, prop_set, ends)[source]#

Creates a spline from a set of points

Parameters:
  • coord (VectorArray) – The coordinates of the spline.

  • prop_set (Property) – The property that will be assigned to the spline

  • ends (bool) – Whether to include the endpoints.

Returns:

The list of created splines.

Return type:

EntList

find_property(prop_type, prop_id)[source]#

Find a property by its type and ID

Parameters:
  • prop_type (int) – The type of the property.

  • prop_id (int) – The ID of the property.

Returns:

The found property.

Return type:

Property

get_new_edited_cad_study_name(job_id)[source]#

Gets the name of the new edited CAD study

Parameters:

job_id (int) – The task ID for CAD editing.

Returns:

The name of the new edited CAD study.

Return type:

str

is_inventor_fusion_cad_edit_aborted(job_id)[source]#

Checks if the Inventor Fusion CAD edit is aborted

Parameters:

job_id (int) – The task ID for CAD editing.

Returns:

True if the operation was aborted, False otherwise.

Return type:

bool

is_inventor_fusion_cad_edit_done(job_id)[source]#

Checks if the Inventor Fusion CAD edit is done

Parameters:

job_id (int) – The task ID for CAD editing.

Returns:

True if the operation is completed, False otherwise.

Return type:

bool

modified_with_inventor_fusion(ents)[source]#

Modifies a set of entities with Inventor Fusion

Parameters:

ents (EntList) – The entities to modify.

Returns:

Task ID for CAD editing

Return type:

int

reflect(ent, reference, plane, copy, merge)[source]#

Reflects a set of entities about a plane defined by a reference point and a normal vector :type ent: EntList | None :param ent: The entities to reflect. :type ent: EntList :type reference: Vector | None :param reference: The reference point for the reflection. :type reference: Vector :type plane: Vector | None :param plane: The normal vector of the reflection plane. :type plane: Vector :type copy: bool :param copy: Specify True to create a copy of the reflected entities :type copy: bool :param False to move the original entities: :type merge: bool :param merge: Specify True to merge the reflected entities after reflection :type merge: bool

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

rotate(ent, center, axis, angle, copy, num_copies, merge)[source]#

Rotates entities about an axis passing through a reference point

Parameters:
  • ent (EntList) – The entities to rotate.

  • center (Vector) – The center point for the rotation.

  • axis (Vector) – The direction vector of the rotation axis.

  • angle (float) – The rotation angle in degrees.

  • copy (bool) – Specify True to create a copy of the rotated entities

  • entities (False to move the original)

  • num_copies (int) – The number of copies to create.

  • merge (bool) – Specify True to merge the rotated entities after rotation

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

rotate_3_pts(ents, pt1, pt2, pt3, copy, merge)[source]#

Rotates entities about a plane defined by three points

Parameters:
  • ents (EntList) – The entities to rotate.

  • pt1 (Vector) – The first point defining the plane.

  • pt2 (Vector) – The second point defining the plane.

  • pt3 (Vector) – The third point defining the plane.

  • copy (bool) – Specify True to create a copy of the rotated entities. False to move the original entities

  • merge (bool) – Specify True to merge the rotated entities after rotation.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

scale(ent, reference, scale, copy, merge)[source]#

Scales a set of entities about a reference point

Parameters:
  • ent (EntList) – The entities to scale.

  • reference (Vector) – The reference point for the scaling.

  • scale (Vector) – The scaling factor.

  • copy (bool) – Specify True to create a copy of the scaled entities

  • entities (False to move the original)

  • merge (bool) – Specify True to merge the scaled entities after scaling

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

scale_mesh_density(ents, boundaries, scale)[source]#

Scales the mesh density of a set of entities

Parameters:
  • ents (EntList) – The entities to scale.

  • boundaries (BoundaryList) – The boundaries for the scaling.

  • scale (float) – The scaling factor.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

set_mesh_size(global_size, ents, boundaries, size, cad_bodies, num_layer)[source]#

Sets the mesh size for a set of entities.

Parameters:
  • global_size (float) – The global mesh size.

  • ents (EntList) – The entities to set the mesh size for.

  • boundaries (BoundaryList) – The boundaries to set the mesh size for.

  • size (float) – The mesh size.

  • cad_bodies (EntList) – The CAD bodies to set the mesh size for.

  • num_layer (int) – The number of layers.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

set_property(ents, prop_set)[source]#

Sets the property of a set of entities

Parameters:
  • ents (EntList) – The entities to set the property for.

  • prop_set (Property) – The property set.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

translate(ent, translation, copy, num_copies, merge)[source]#

Translates a set of entities by a given vector

Parameters:
  • ent (EntList) – The entities to translate.

  • translation (Vector) – The translation vector.

  • copy (bool) – Specify True to create a copy of the translated entities

  • entities (False to move the original)

  • num_copies (int) – The number of copies to create.

  • merge (bool) – Specify True to merge the translated entities after translation

Returns:

True if the operation was successful, False otherwise.

Return type:

bool