Model.hm_findprojected#
- Model.hm_findprojected(project_collection, target_collection, use_actual_thickness, thickness, tolerance, project_normal, project_x, project_y, project_z, mark_target, output_collectionset, plot_results=False, legend_red=0, legend_yellow=0, results_file='', output_file='')#
This API projects a collection of nodes (or the nodes of a collection of elements) along either a user defined vector or the normal of each target element, and determines whether each node is within the thickness of the target elements. The overlapping nodes, the overlapped elements, or both are placed on the result collection depending on the option used. The values of the closest distance between the overlapping nodes and the overlapped elements can be plotted in the graphics.
This API can be used for semi-diverse tasks such as finding which nodes of bar elements are touching a collection of shell elements, determining how close to the hood of a car the engine components are, and determining the closest distance between two meshes (although true element to element distances are not calculated, only node to element distances).
This API uses a highly efficient search tree algorithm and multi-threading which makes it suitable for large models.
- Parameters:
project_collection (Collection) – The collection containing the entities.
target_collection (Collection) – The collection containing the entities.
use_actual_thickness (int) –
0 - All elements will be given the thickness set using the thickness argument
1 - The solver thickness will be used for all elements. All elements which have a zero thickness (and all faces of solid elements) are given a nominal thickness of 1000.0 times less than the maximum thickness found on the collection.
thickness (double) –
If
use_actual_thicknessis set to 0, this value is given to all elements and solid faces.If
use_actual_thicknessis set to 0 and this value is set to 0.0, the thickness of all elements and solid faces is assumed to be infinite.If
use_actual_thicknessis set to 1 and this value is greater than 0.0, this value is used as a multiplier to the solver thickness such that element thickness = solver thickness * (this value) / 2.0tolerance (double) – This value is used as a fraction of the element size within which nodes are considered overlapping if they are near an element’s edges but not inside the element. A value of 0.01 allows nodes which are within 1% of element size of an element to be treated as overlapping. A good value for this option is 0.01.
project_normal (int) –
0 - Projects nodes along a vector defined by project_x, project_y, and project_z.
1 - Projects nodes along a vector defined by the normal of each target element.
2 - Projects nodes directly to the elements along the shortest path.
project_x (double) – Project vector x component. Used only if project_normal is 0.
project_y (double) – Project vector y component. Used only if project_normal is 0.
project_z (double) – Project vector z component. Used only if project_normal is 0.
mark_target (int) –
0 - Turns off any active plotting. No analysis will be performed.
1 - Collections overlapped elements to the result collection and plots the absolute distance on the overlapped elements.
2 - Collections overlapping nodes to the result collection and plots the absolute distance on the overlapping nodes.
3 - Collections overlapped elements and overlapping nodes to the result collection and plots the absolute distance on both the overlapped elements and the overlapping nodes.
4 - Same as 1 but distance plotted is +/- based on vector or normal direction.
5 - Same as 2 but distance plotted is +/- based on vector or normal direction.
6 - Same as 3 but distance plotted is +/- based on vector or normal direction.
output_collectionset (CollectionSet) – The set of collections containing possibly multiple type of entities.
plot_results (bool) –
False - No plotting.
True - Plot results to the screen.
Note that if this option is set to 1, the API will store the closest distance between overlapping nodes and elements. Since more nodes and elements must be checked, this option will run slower than simply marking all overlapping nodes and/or elements.
legend_red (int) – Setting this value to something other than zero will show all overlapping nodes or elements which are closer than this value to be shown in red. If
mark_targetis set to 4, 5, or 6, this value is best left set to 0.0. This option is only used ifplot_resultsis set to 1.legend_yellow (int) – Setting this value to something other than zero will show all overlapping nodes or elements which are closer than this value to be shown in yellow or orange. If
mark_targetis set to 4, 5, or 6, this value is best left set to 0.0. This option is only used ifplot_resultsis set to 1.results_file (hwString) – The full path and name of the results file to be generated in binary results format (.res).
output_file (hwString) – The full path and name of the results file to be generated in plain text format. This file will contain the overlapping nodes and/or elements as well as their closest distances if
plot_resultsis set to 1.
- Returns:
hwReturnStatus- Status object
Example#
Generate a plot of the closest distance between two components on the target elements . Note that the thickness is set to 0.0 ( infinite ) for all elements , the element normals are used for projection , and the results are set to be shown on the target elements with the direction as + or -#import hm import hm.entities as ent model = hm.Model() model.hm_findprojected( project_collection=hm.Collection(model, ent.Node, hm.Collection(model, ent.Component, [6])), target_collection=hm.Collection(model, ent.Element, hm.Collection(model, ent.Component, [1])), use_actual_thickness=0, thickness=0.0, tolerance=0.01, project_normal=1, project_x=0.0, project_y=0.0, project_z=0.0, mark_target=4, output_collectionset=hm.CollectionSet(model), plot_results=True,legend_red=0,legend_yellow=0,results_file="C:/Temp/closest.res",output_file="C:/Temp/closest.txt")