Model.hm_ce_getprojectiondata#

Model.hm_ce_getprojectiondata(collection1, collection2, numproj, tolerance, order, output, projFlag, projFlag2)#

The returned data is organized into a single main list. Each element of this main list is a sublist that contains the requested connector ID, point ID, or node ID, and a list of the successfully created projections (the proj_list) for the given ID.

The potentially large list this function may return, may not be the best-suited data format for most processing cases. Therefore, it is highly recommended that you use the ::CE::GetProjectionData wrapper function instead. This function accepts the same set of parameters that the hm_ce_getprojectiondata() function requires, but instead of returning a single large main list, it returns a randomly accessible array. The array is accessible through its use of the connector/point/node ID as the index, and at this index is the proj_list.

Parameters:
  • collection1 (Collection) – The collection containing the entities of connectors/points/nodes that define the locations of interest.

  • collection2 (Collection) – The collection containing the entities of components to be projected onto.

  • numproj (int) – Number of projections requested at the specified points (>0).

  • tolerance (double) – Tolerance value for filtering projections (will be used with numprojs).

  • order (int) –

    0 - Ordered by closest

    1 - Ordered through a line

  • output (int) – Parameter to obtain desired output (specific projection data).

  • projFlag (int) – Parameter used for projecting to COMPS (current value is zero).

  • projFlag2 (int) –

    Parameter used for non-normal projections

    0 - Normal

    2 - Non-normal

Returns:

Examples#

Get the projection data for displayed points on displayed components as a list of list#
import hm
import hm.entities as ent

model = hm.Model()

points = hm.CollectionByDisplayed(model, ent.Point)
components = hm.CollectionByDisplayed(model, ent.Component)

_, resultlist = model.hm_ce_getprojectiondata(
  collection1=points,
  collection2=components,
  numproj=2,
  tolerance=0.0,
  order=0,
  output=0,
  projFlag=0,
  projFlag2=0
)

for result in resultlist:
  print(result.keys)

Note

This function is optimized for the case where the projection data is required for a number of different connectors, points, or nodes, and the components that they need to be projected onto are unknown. It is especially useful for close quarter welding scenarios.

Note

The output option determines what is returned for a given projection:

0 = ALL (data shown above)

1 = comp_id and elem_id

2 = comp_id, elem_id, and x y z

3 = comp_id, elem_id, face and x y z

4 = comp_id, elem_id, face, x y z and u v

The face value will be a non-negative number when valid external face for solid element is found during projection. If a valid face cannot be determined or if projection finds a shell element then the face=-1. The number of projections can be found from using “llength” on the proj_list (which is especially easy to do when the ::CE::GetProjectionData function is used).

The order parameter returns the projection data in the requested ordering based on the closest distance to the projected connector/point/node (0) or ordered as a line (1).

The projFlag2 parameter (value of 1) is used for obtaining non-normal projections useful for MIG-Welds. By default, it has a value of 0, which will return normal projections.