Cache geometry?

Hi,

Is it possible to cache geometry in some way in a graph?
I am clashing piping and what not from linked models or sat files with walls, but getting the geometry from the linked/sat files is rather heavy when i dont use section boxes. Is it possible to somehow save the geometry so i can run the graphs faster for each wall view for example?

Would be nice if i can just load in the geometry once, and then keep using that same geometry in dynamo player

@Garbage_Collector

first idea is using direct shape… …but finaly it contaminates your project. You can work with the dynamo geometry view in revit, for tracing openings… personaly i would look for stable closed loop workflow including tracing… like convoid https://www.conclass.tech/convoid

you can check topic like these ones

You can cache certain types of data with the Data.Remember node, however, it’s primarily used for when application specific content is not available, so rerunning the graph in your context may just re-execute the node if you don’t set things up properly. If you’re looking to specifically save data once so that you don’t have to re-compute every time, then you’re better off just serializing the data to JSON. Then you can read the data from JSON directly on consecutive runs. You will have to “rebuild” the geometry itself every run, but that’s much less intensive than computing the necessary geometry in the first place.

Serializing to JSON would allow you to select an alternative geometry set. However that still will be somewhat slow overall.

A better method would be to use the Revit API to get the clashing elements directly, but this assumes that all content you are clashing is already in Revit…

@Draxl_Andreas @Nick_Boyts

Thanks all for your responses, i appreciate it!

Skip to the last two paragraphs if you’re not in the mood for reading.

For context, i manage a structural revit model, with concrete walls and floors. There’s a LOT of piping for water going through the walls and floors, which i can import as a Revit link (if i am lucky) that contains generic models. If I’m unlucky, i can only use 3D DWG or sat file. This depends on the size of the project and what software the piping company is using for their drawings.

Below is an example where ive received a Revit file, which consists of a generic model for each wall flanche (pipe that goes through a wall).


The blue pipe is what i can select in my host model after importing the link.

The regulars here probably recall me asking about clash detection with piping for years now, i’m thrilled to say i finally managed to do this properly. I can find the clashes in geometry, place a void family at the center of the pipe and adjust the diameter accordingly.
The opening have a temporary blue fill, so engineers can easily see a large opening has been placed without manual (visual) approval of a structural engineer. The engineer can switch the visibility parameter of this blue fill to NO when it’s approved. Pretty cool hehe, I came a long way for this…

Anyway, that looks something like this:

To keep things slightly more in control instead of just placing hundreds of wall openings unseen in a model,the graph the user can use a wall view or floor plan to only clash that wall/floor against the piping. This way we can open a view, run the graph, see it placed 10 new openings and move on to the next wall or floor. This is nice and all, but loading the geometry of the piping is very heavy.

To give some context to the scale of this geometry:

In the graph i simply use Select Model Element on the linked element and save the graph for this specific project. Then i gather all the linked elements in view (for now, it relies on a 3d section box to isolate only a part of the linked model). Doing this for every wall(or every few walls) or floors, takes up a lot of time to generate that linked geometry.

So, i wanted to add something to somehow save the output of element.geometry on the entire linked file once, so i don’t have to generate it each run. I was hoping to keep the element ordered with the geometry so i can find the linked element ids in my view and grab the geometry from the saved file, so i dont have to do geometry.intersect on an enormous part of floating geometry.

This is a little risky in my opinion, because the two geometry lists (linked and local) can change independently. You’ll obviously have to rerun the script any time the pipe geometry changes. But you’ll also have to rerun the script anytime your walls change in a way that affects the intersection, and you may not know that without running the script. I know it’s slower, but it’s safer to let the geometry update any time either set of elements changes.

Either way, you’re placing the voids at every collision, so I don’t understand why you need to save the geometry. Once the voids are placed, why would you need to reload the intersection geometries? A mapping of IDs seems quicker in my opinion. If you’re placing voids at pipe/wall intersections, just add a parameter for each and fill in the ElementId for each on void creation (e.g. Wall_Id: [ElementId] and Pipe_Id: [ElementId]). That way, if you need to check changes, you can just get all the voids in your model and check the collisions of the elements with the assigned ElementIds.

I’m on my phone at the moment so bear in mind… probably can’t respond to all points now

I want to save the geometry of the entire linked model, because I need this geometry for multiple runs ( each walk gets its own run). So I have to wait for dynamo to load the geometry of the linked model each time I run my graph, instead of waiting a long time once to load the entire geometry, and fetch it from a file every run after that.

I agree saving geometry is risky since Revit links can change, but this Revit link is just an inventory export. So the model isn’t actively worked on in Revit and gets replaced completely when a lot of changes have been made and an export has been shared. I wouldn’t try this method when the linked file is actually being worked on in Revit

Yeah my graph does this for actual Revit links, when it’s actually a Revit file thats being worked on. this works incredibly well for tracking placed openings and seeing if the size of position changed in the linked file :slight_smile:

But in this topics case I’m looking to generate the linked geometry once, for multiple runs, to clash detect each wall separately, or just parts of the model, since its simply too large to run over the entire model at once

So, I need to clash my elements (a small sample size) against the linked geometry with geometry.intersects.

This can take like 50 runs over the entire project to do all walls and floors properly, and these fifty runs use the same linked geometry each run, which seems like an immense waste of time to keep waiting on generating the same enormous linked geometry…

You don’t really need the full geometry. You just need a centerline curve for the pipe intersection (or a point in the center of the wall) and the corresponding diameter of the pipe. That’s information you can easily save to JSON and reload. You’d still have to check the collision points with your current list of wall elements in the case that your walls have been moved/modified if you want to ensure everything is up to date. If you’re sure that your model won’t change enough for that to be an issue, then you can also save the intersecting wall’s ElementId to the point in your JSON. That way you know the pipe information as well as the particular wall.

The generic models consist of s bunch of solids, I don’t think I can reliably find the centerline of the pipes if I’m honest. I find the centers of the pipes (and square openings and round openings) by getting the result of geometry.intersrct and then do a solid.centroid on that.

But I still think we’re not completely on the same page as to what I’m trying to do :slight_smile:
Unfortunately I’m on my phone so I can’t share screenshots but I think you’re thinking of me trying to save the intersecting geometry. But all I am trying to save is the linked model geometry, so I can clash multiple geometry against this same linked model geometry.

So imagine the node geometry.intersects
In[o] = main model geometry, like select model element (some walls)
In[1] is entire geometry of the linked model, which I get by selecting model element (the linked model instance) and then doing element.geometry on it, and this step takes a LOT of time, so I would like to save this geometry somehow, so that I can change my main model selected elements for multiple runs, me walking through all my wall views for example, while the linked geometry just gets pulled from memory instead of needing to be generated each run

The multiple runs are for getting through the model’s immense size, while still having a general idea of where openings are placed. It’s not rerunning to find changes in the linked model. It’s simply to make sure that whatever opening is placed, is in the view of the engineer. This way it can immediately be approved or denied. I’m just.circumventing the step of having to manually find the center point and diameter of the pipe. It’s always a hassle since you can’t snap to these pipes sometimes, and you always have to draw lines to find the center before you can place the opening

Imagine the engineer just simply opens a wall view, runs the graph, goes to the next wall view, reruns the graph for this wall, and so forth for all walls. The only thing that changes is the main model geometry (the wall that is currently in his view) the linked geometry, for each run remains the same enormous geometry of the entire linked file

I feel like Jacob is about to hit us with a banger haha

1 Like

Hearing this, and knowing you might not get an element based model, I think you’d be better served to go another way with it.

  1. Take the scope of the entire project and build a reasonably sized bounding boxes, using six digits for each ‘sector’.
  2. Get all geometry from the pipe model, and get the set of bounding boxes which it intersects.
  3. Union each geometry (representing solids which touch each bounding box) into a single solid.
  4. Intersect the solid with a cuboid sized per the six digits of the bounding box. This resulting geometry is the geometry which you need to track.
  5. Save each solid to a JSON, using the six digits of the bounding box as the file name.

The prep work is now done. Repeat these steps any time the model updates.

Now we can more effectively build the clashes. To do so:

  1. Select the element you want to clash and pull it’s geometry.
  2. Get the sectors which the geometry intersects.
  3. Load the JSON for each intersecting sector.
  4. Intersect the resulting solid with the element geometry - the resulting shape is the intersection to clash.

You can then validate the clash detection by pulling updated elements from your model (look into the DocumentDifference class) and test the updated geometry against the

Now all of this is likely easier with ACC or Navisworks, but it should make things a bit more manageable if you want to go this route.

1 Like

Hope I delivered. :slight_smile:

always-severus-snape

Thanks for your response, it’s getting late here so I’ll respond tomorrow accompanied with some screenshots.

You’re right about the link not being an element based model, it’s been one of my biggest frustrations for years working in this industry. This particular piping supplier fortunately works with inventor, so in he’s able to make these large Revit exports of the piping. It’s just mass but it’s something. I’ve also worked with other companies that design these pipes in SolidWorks and all they can give me is a 3D dwg export that loses 1/10th of the openings randomly because it contains geometry Revit can’t deal with…

With these pipes I’m not even trying to track changes, I just wanted a way to not have to place the opening manually because it takes so much time to place hundreds of ope ings manually when you have to draw a line across the pipe to find the center every time. Especially when it’s a 3d dwg and you just can’t snap to the pipe at all…

Best part about this, you can serialize all the geometry to JSON using Dynamo for Civil 3D; the resulting solids might even maintain the geometric content better as long as it stays in a Dynamo context.

This sounds really promising!
Im installing civil3D as we speak. Will report back :slight_smile:

1 Like