Model.align_entities#
- Model.align_entities(mode, source_list, target_list=s_defaultEntityList, target_locations=hwDoubleList(), ProjectionType=-1, SourceEntityType='', TargetEntityType='', along_vector_x=DBL_MAX, along_vector_y=DBL_MAX, along_vector_z=DBL_MAX, proj_dir=0, finite_targ_line=0, offset_val=0.0, Plane_Base_X=DBL_MAX, Plane_Base_Y=DBL_MAX, Plane_Base_Z=DBL_MAX, Plane_X=DBL_MAX, Plane_Y=DBL_MAX, Plane_Z=DBL_MAX)#
The function projects entities to a line, surface, or plane.
- Parameters:
mode (hwString) – The projection mode. Valid values are aligntoline and aligntoplane. User can directly supply a Python string.
source_list (EntityList) – The list of entity objects. Valid entity types for
mode="aligntoline"are nodes, points and elements. Valid entity types formode="aligntoplane"are nodes, points, elements and lines.target_list (EntityList) – A list containing the entity objects.
target_locations (hwDoubleList) – The list of x, y, z coordinates for selected locations. Valid only for
mode="aligntoplane".ProjectionType (int) –
The type of projection.
1 - Project by vector.
2 - Project normal to surfaces. Valid only for
TargetEntityTypeset to plane or surface.SourceEntityType (hwString) – The entity type to project. Valid values are elements, nodes, lines and points. This is a mandatory option if
TargetEntityType=Planeortarget_listcontains surface entities. User can directly supply a Python string.TargetEntityType (hwString) – The entity type to project onto. Valid value is surfaces. This is a mandatory option if
target_listcontains surface entities. User can directly supply a Python string.along_vector_x (double) – The x component of the vector. For
TargetEntityType="Plane"or surf valid only whenProjectionType=1.along_vector_y (double) – The y component of the vector. For
TargetEntityType="Plane"or surf valid only whenProjectionType=1.along_vector_z (double) – The z component of the vector. For
TargetEntityType="Plane"or surf valid only whenProjectionType=1.proj_dir (int) –
This input is used only when
mode="aligntoline". Valid values are:0 - Project normally
1 - Project along vector defined by
along_vector_x,along_vector_y, andalong_vector_z2 - Remap
finite_targ_line (int) –
This input is used only when
mode="aligntoline"andtarget_listcontains two nodes/locations.0 - project to infinite line
1 - project to finite line
offset_val (double) – This input is used only when
mode="aligntoline". Specifies the offset distance in backward direction from target line to source entity.Plane_Base_X (double) – The x-coordinate of plane’s base point.
Plane_Base_Y (double) – The y-coordinate of plane’s base point.
Plane_Base_Z (double) – The z-coordinate of plane’s base point.
Plane_X (double) – The x-component of plane’s normal.
Plane_Y (double) – The y-component of plane’s normal.
Plane_Z (double) – The z-component of plane’s normal.
Examples#
Project nodes with IDs 4157, 4141, and 4143 to an infinite line created from from nodes with IDs 4163 and 4128 along specified vector#import hm import hm.entities as ent model = hm.Model() source_node_ids = [4157, 4141, 4143] target_node_ids = [4163, 4128] model.align_entities( mode="aligntoline", proj_dir=1, source_list=[ent.Node(model,id) for id in source_node_ids], target_list=[ent.Node(model,id) for id in target_node_ids], along_vector_x=-0.983433, along_vector_y=0.018948, along_vector_z=-0.180277, )
Project nodes with IDs 3977, 3987, and 3993 to a finite line specified by two locations with using offset 10.0#import hm import hm.entities as ent model = hm.Model() source_node_ids = [3977, 3987, 3993] model.align_entities( mode="aligntoline", proj_dir=1, offset_val=10.0, source_list=[ent.Node(model,id) for id in source_node_ids], finite_targ_line=1, target_locations=[4701.068001, -614.007177, 1160.689055, 4815.746991, -615.284962, 1161.839578] )
Project elements with IDs 3100-3500 to a plane with along y-axis#import hm import hm.entities as ent model = hm.Model() source_elements_list = [ent.Element(model, elid) for elid in list(range(3100, 3501))] model.align_entities( mode="aligntoplane", source_list=source_elements_list, SourceEntityType="elems", TargetEntityType="plane", Plane_Base_X=4756.576660, Plane_Base_Y=-116.110229, Plane_Base_Z=885.111145, Plane_X=0.000000, Plane_Y=1.000000, Plane_Z=0.000000, )