Model.element2Dalign#
- Model.element2Dalign(collection_2d, collection_1d, propagate)#
Aligns the order of nodes in 2D elements based on the nodes of attached 1D elements. This is done in such a way that the starting edge the 2D element has the same nodes as the 1D element. This can also use aligned quad elements to align all “attached by edge” quads with the same node order.
- Parameters:
collection_2d (Collection) – The collection containing the quad element entities to align.
collection_1d (Collection) – The collection containing the 1D elment entities to use as reference. 2D elements can only be used when
propagateis set to 1 or 2.propagate (int) –
0 - Aligns only 2D elements directly attached by edge to 1D elements (1 layer).
1 - Propagate alignment to all attached by edge quad elements. Several assumptions apply to this option:
Mesh has a regular structure in terms of connectivity. “Regular” means that it is a drag-like structure.
Mesh structure may contain holes, and layers may be truncated.
For example, you can take a regular 16x9 grid of quads and delete any quads from the grid, keeping the rest connected by edges. Not more than one 1D element for alignment should contact any 2D element. To avoid conflicts, aligning 1D elements should not be in different alignment directions.
For regular quad meshes just one 1D or 2D element is enough to set alignment for the whole grid. If there are other (tria) 2D elements in the mesh, the function aligns only the tria elements directly attached to 1D elements.
For regular quad meshes just one 1D or 2D element is enough to set alignment for the whole grid. If there are other (tria) 2D elements in the mesh, the function aligns only the tria elements directly attached to 1D elements.
2 - Same as 1, but shift base nodes to make a “checkerboard”.
Examples#
Align all quad4 elements by plot elements use the function#import hm import hm.entities as ent model = hm.Model() elems1 = hm.Collection(model , FilterByAttribute(ent.Element, "config=104")) elems2 = hm.Collection(model , FilterByAttribute(ent.Element, "config=plot")) model.element2Dalign(collection_2d=elems1, collection_1d=elems2, propagate=0)
Align all displayed elements to element ID 100#import hm import hm.entities as ent model = hm.Model() elems1 = hm.Collection(model , ent.Element, populate=True) elems2 = hm.Collection(model , ent.Element, [100]) model.element2Dalign(collection_2d=elems1, collection_1d=elems2, propagate=0)