DirectShape Question

When I use the DirectShape node in Dynamo the result is a tessellated mesh object in Revit, not a smooth solid. The API documentation states that solids are also able to be made into DirectShapes. Is there an option I’m missing?

I don’t think you can achieve this with the OOTB nodes in Dynamo since they are using the Tessellated Shape Builder to construct the Direct Shape. There is a package called Spring Nodes that will allow you to create a Direct Shape from geometry using a different method but of course it has a different set of limitations associated with that method. Feel free to explore. Dimitar Venkov was kind enough to create this package for you.

Konrad

Thanks for the very helpful reply. I had found Dimitar’s DirectShape node. My question was more of why DirectShape would have an option to create meshes from smooth BREPs in the first place. When we look at geometry, either in drawings or the model proper I can’t think of a single instance when I would want a mesh representation of a curved object. It is just not acceptable graphically. Especially since we don’t have a way to smooth the display of edges in Revit. Now if I want to use a mesh for certain operations in order to save on memory or processing time, I am all for it. But I would not make that the default.

I hope we get the option to create the BREP based DirectShapes in Dynamo soon. What kind of limitations are inherent to that method?

Thanks again.

The API documentation is correct - you can create a DS from a solid, however it has to be a solid generated through one of Revit’s built-in methods (extrusion/blend/revolve/sweep). My approach is based on a hack that is not officially supported and works by exporting and importing a SAT file. (and thus has its own limitations)

The problem stems from the fact that currently there is no direct way to convert a Dynamo solid into a Revit solid. A basic Dynamo solid does not store any information regarding it’s creation, so we can’t easily and effectively guess it’s creation method and re-create it through the API. A more complicated solid that was the result of multiple Boolean unions and subtractions would complicate the task even further and make the conversion even more impossible. The only effective approach at this stage is to explode the solid, triangulate each resulting face ( and loose some accuracy in the process) and then re-create the triangles through the tessellated shape builder inside the API.

1 Like

Dimitar

Thank you for the explanation. I am curious about what you stated. Is the graph not the history of the solid’s creation in Dynamo? One would just need a way to somehow convert that history to a Revit compatible history, no? There has to be a way to crack this…

Rafael,

It would indeed be great if we could read and interpret the graph in such a way. I am not sure i this is currently doable. Tho I can see two problems even if we could do it:

  1. Revit does not have an equivalent method for every unique solid operation that Dynamo can perform.

  2. Revit methods that do have an equivalent function to a Dynamo one, do not necessarily produce identical results.

 

Rafael,

If I can jump back in for one more comment, before we get too far with wishing that Revit was able to do things, i would only add that Revit’s geometry library is extremely limited. One does not “simply” model anything in Revit. Modeling anything more complicated than a box in Revit is like reaching the peak of Kilimanjaro. It takes a bit of work. Revit’s API is not an exception to this rule. In this case they are using the Tessellated Shape Builder because that’s the easiest hack to get an arbitrary set of geometries into Revit. Dimitar has made a tool that allows you to import gemetry in using exploded SAT imports. That kind of works but again is very limited as to what kind of geometry can actually be serialized into a SAT format. So again, it’s a little better but not exactly what we want. Huge props to Dimitar but even he cannot do what is simply not doable in revit. :frowning:

2 Likes
 Autodesk.DesignScript.Geometry.PolyCurve bounds =  PolyLine.Create(pts).ToProtoType();

                   var solid = bounds.ExtrudeAsSolid(Autodesk.DesignScript.Geometry.Vector.ZAxis(), height);

                    
                    Autodesk.Revit.DB.DirectShape ds = Autodesk.Revit.DB.DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));

                    ds.SetShape(solid.ToRevitType());