Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Dynamo Mesh Toolkit
The Dynamo Mesh Toolkit is available through the Dynamo package manager. To install, select "Search for a Package" from the Packages menu, and search for MeshToolkit. Click the down arrow in a circle icon on the left hand side of the window to install. After installation, you will have a MeshToolkit node group in the Library pane on the left side of Dynamo.
The Dynamo Mesh Toolkit provides tools to import meshes from external file formats, create a mesh from Dynamo geometry objects, and manually build meshes by their vertices and indices. The library also provides tools to modify meshes, repair meshes, or extract horizontal slices for use in fabrication. Keep in mind that the Mesh Toolkit generally consumes and produces elements that are different from the standard Geometry elements that come "out of the box" with Dynamo. There are conversion nodes, and we will continue to make a more seamless connection between these elements, but just be aware that there is a difference between Geometry and Mesh.
The Dynamo Mesh Toolkit is part of Autodesk's ongoing mesh research, and as such will continue to grow over the coming releases. Expect new methods to appear on the toolkit frequently, and feel free to reach out to the Dynamo team with comments, bugs, and suggestions for new features.
ByGeometry take as input Dynamo geometry objects, such as Surfaces or Solids. Points and Curves have no mesh representations so are not valid inputs. The number of triangles produced in the conversion is controlled by the two inputs. Tolerance sets an upper bound over the precision of the mesh, meaning the mesh will be at least as close to the base Surface or Solid as specified (sometimes closer). Set this to -1 to let Dynamo choose a sensible tolerance. maxGridLines sets the maximum number of triangles in the U or V direction. This can help you set a loose upper bound on the number of triangles produced.
By Vertices And Indices
ByVerticesIndices takes a list of Points, representing the corners of the mesh triangles, and a list of indices, representing how the mesh is stitched together, and create a new mesh. The vertices input should be a flat list of sets of three points. The indices input should be a flat list of integers. Each set of three integer designates a triangle in the mesh. The integers specify the index of the point in the point list. The indexes should be 0-indexed, ie the first point of list has index 0, the second point has index 1, etc.
This collection of nodes provides users with the ability to create mesh planes, cuboids, spheres, and cones while controlling the number of subdivisions. If the number of subdivisions is not explicitly specified the mesh will attempt to divide precisely into a whole number of layers in each direction. Otherwise, an additional layer will be added to even out the layers as required.
The extrude polycurve node extrudes the provided polycurve a specific distance in the specified vector direction. If the initial polycurve is planar the resulting mesh has the option of being capped to form a solid mesh.
There are three boolean operations available in this new update. Each operation takes a target mesh and a tool mesh. The first is boolean union which unites the two supplied meshes removing any overlap between the entities. The second is boolean difference which removes any overlapping of the tool mesh over the target mesh. The final operation is boolean intersection which returns only the overlapping portions of the two meshes.
We have received a few questions in regard to performing boolean operations using a list of tool meshes as the node currently only takes a single target mesh and single tool mesh. While this is definitely on the roadmap for implementation the image above shows a quick work around to do just this. Using just a couple lines of Python we can loop the operation making it easy to boolean multiple objects.
The CloseCracks method removes internal boundaries on a mesh object. You normally shouldn't have to use this method, unless you have an imported mesh with imported boundaries you would like removed.
Vertices, Edges, Triangles
The Vertices, Edges, and Triangles methods return the underlying Points (vertices), Curves (edges), and Surfaces (triangles) of the mesh. The geometry returned from this method is native Dynamo geometry, with all geometry operations supported, such as extrude, trim, thicken, etc.
The mesh explode node takes a single mesh and returns a list of each mesh face as independent meshes. The example above exhibits a simple mesh sphere that was exploded followed by an offset of each face in the direction of the face normal. This is achieved using the mesh triangle normals node also included in this latest update.
Exports the mesh into a file format. The type of mesh to export is determined by the file name extension; for instance a file name ending in ".stl" will be exported in the STL format. The following formats are supported:
- .mix - Meshmixer
- .obj - Wavefront OBJ
- .stl - STL format
- .dae - COLLADA
- .ply - Polygon File Format
This image shows the conversion of an OBJ mesh into an STL:
The generate support node automatically calculates overhangs and returns a new mesh with support structure. The output is a single mesh object, however this consists of two solid meshes to assist in cleaner support removal. By default all input nodes are provided with standard recommended settings. The input parameters operate in the following way:
- Base Height - Height of the base where the support posts meet the ground.
- Base Diameter - Diameter of the base where the support posts meet the ground.
- Post Diameter - Diameter of the support posts.
- Tip Height - Height of the tip where the support posts touch the mesh.
- Tip Diameter - Diameter of the tip where the support posts touch the mesh.
ImportFile takes the name of a file as input. The file can be of the following types:
- .obj - Wavefront OBJ file
- .mix - Meshmixer file
This method intersects the mesh with an input Plane, returning a PolyCurve. This is useful for slicing the mesh for fabrication, for instance on a laser cutter, waterjet cutter, or CNC mill.
The make hollow node can be used to hollow out a mesh object in preparation for 3D printing and is particularly useful in powder based printing methods. Hollowing a mesh model significantly reduces the amount of print material required and reduces overall printing time and cost. Escape holes are generated in the hollowed mesh to allow excess material to be removed during the printing process. The input parameters operate in the following way...
- Hole Count - Number of escape holes to be generated.
- Hole Radius - Radius of escape holes.
- Wall Thickness - Interior offset distance from original mesh.
- Solid Resolution - Resolution for making the solid that represents the interior surface of the hollowed mesh (8 - 4096).
- Mesh Resolution - Resolution for mesh generation on the interior surface of the hollowed mesh (8 - 4096)
The MakeWatertight takes a different a different approach than repair or close cracks, which is to generate a new watertight mesh by sampling the original mesh object. This is more suited to mesh objects that have numerous defects or difficult issues such as self-intersections.
This image shows a non-watertight vase, and its watertight equivalent
The plane cut node creates a precise geometric planar cut which removes portions of the mesh that lie on the side of the plane in the opposite direction of the plane normal. The make solid boolean input provides the option to create a minimal fill using the fewest number of triangles.
The reduce node returns a new Mesh with a reduced number of triangles. Users provide a goal triangle count for the reduction in which the new mesh targets. If the operation is unable to meet to the goal it will provide the greatest reduction it can achieve.
The remesh node returns a new mesh distributing triangles more evenly over the whole of the selection regardless of any change in triangle normals.
The repair method attempts to rectify mesh defects such as holes and non-manifold regions. The goal of the method is to preserve as much of the original mesh as possible but achieve a watertight result.
Note how the repaired mesh below differs from the MakeWatertight mesh above. The MakeWatertight method uses a filling operation, while repair uses a simple capping operation.
The smooth node returns a new smooth mesh using a cotangent smoothing algorithm. Cotangent smoothing refrains from spreading the vertices from their original position. The scaling input sets the "spatial scale" of the smoothing meaning smaller values yield more local smoothing, and typically result in a less "smooth" looking result (0.1 - 64.0).
We have noticed a few instances of strange behavior with the structural analysis node and are currently in the process of looking into it. This node has the ability to examine a mesh for inherent structural weaknesses. It can be used to provide an indication as to which parts of the model are most likely to break if fabricated as a physical object. The analysis assumes that the physical object is to be made of solid material and works great for 3D prints.
The triangle centroids node returns the center point of each face on a mesh.
Triangle Normals & Vertex Normals
These nodes return the normal direction of the mesh triangle faces and vertices respectively.
Vertex Indices by Triangle
This one is a little confusing at first but can do some powerful things so I decided to include it. In fact a series of existing nodes use this function on the backend! Let's walk through the example shown above to better understand how this node works. We are trying to get the vertices from every triangle that makes up the given sphere, however when we use the mesh vertices node we only get the list of unique vertices which can be hard to match to the correct corresponding triangles. We can then get the index value of every vertex for every triangle using the vertex indices by triangle node. Finally, by using the get item at index node we can match the correct unique vertex with the corresponding index for each triangle vertex. We can verify we did the operation correctly by multiplying the number of triangles by 3 [3 vertices per triangle] and making sure the result matches the number of vertex values.
The area node simply returns the area of a mesh plane or the surface area of a solid mesh.
The volume node simply returns the volume of a solid non-intersecting mesh. This calculation can also be helpful in determining if a mesh is indeed solid and non-intersecting.
By Mesh Color
The by mesh color node has some intelligence built in. MeshToolkit uses full vertex shading which presents a great opportunity to experiment with some high quality graphics. One example shown below uses a technique known as smooth shading where we can use the new vertex normals node to determine the color distribution. The node is capable of a series of color combinations listed below:
- # of colors = 1 → [entire mesh single color]
- # of colors = # of triangles → [each triangle is colored the specified color]
- # of colors = # of unique vertices → [each triangle will interpolate between the color values at each vertex]
- # of colors = # of non-unique vertices → [each triangle will also interpolate between the color values across a face but may not blend between faces]