Difference between revisions of "Linking surfaces into point models"
(Created page with " Linking surfaces with point models is an useful way to get initial orientations of particles. The idea is to assign to each <tt>crop_point</tt> in the general model a <tt>cro...") |
|||
Line 8: | Line 8: | ||
Make certain that <tt>s</tt> contains already a depiction triangulation. This is created with the black triangle icon in the workflow for surfaces, or with the method <tt>createMesh</tt> from the command line. | Make certain that <tt>s</tt> contains already a depiction triangulation. This is created with the black triangle icon in the workflow for surfaces, or with the method <tt>createMesh</tt> from the command line. | ||
+ | |||
+ | Note that you can check visually the orientations of the particles in the model through the commands | ||
+ | <tt>p.plotTableSketch([],'hold_limits',false);</tt> | ||
+ | which will show by default orientations pointing upward. | ||
You can directly link the mesh inside surface <tt>s</tt> into points <tt>p</tt> by: | You can directly link the mesh inside surface <tt>s</tt> into points <tt>p</tt> by: | ||
− | <tt>p.linkedSurface = | + | <tt>p.linkedSurface = s.mesh</tt> |
After running this assignment the model <tt>p</tt> will be able to recompute its <tt>crop_angles</tt> with reference to its linked surface by: | After running this assignment the model <tt>p</tt> will be able to recompute its <tt>crop_angles</tt> with reference to its linked surface by: |
Latest revision as of 14:25, 14 July 2017
Linking surfaces with point models is an useful way to get initial orientations of particles. The idea is to assign to each crop_point in the general model a crop_angle that is defined with reference to the support surface. Mathematically, Dynamo locates the closest triangle in the triangulation of the supporting surface, reads the normal, and formats it to provide the three euler angles needed to crop a particle.
Command line
Let's assume you have to models in your workspace: p is a general point model, and s is a surface model (for instance of class membraneByLevels)
Make certain that s contains already a depiction triangulation. This is created with the black triangle icon in the workflow for surfaces, or with the method createMesh from the command line.
Note that you can check visually the orientations of the particles in the model through the commands
p.plotTableSketch([],'hold_limits',false);
which will show by default orientations pointing upward.
You can directly link the mesh inside surface s into points p by:
p.linkedSurface = s.mesh
After running this assignment the model p will be able to recompute its crop_angles with reference to its linked surface by:
p.cropAnglesFromLinkedSurface();
Linking filaments
This technique can also be used to set orientations defined as normals from a filament. In this case, for a filament model f, the linkage is performed through:
p.linkedBackbone = f.backbone