Mass from IFC

Ok so i’m going to try to take a different and maybe stupid and impossible appoach to this but we experiment i guess…

Basically,

  • Wrap The entire script into a Custom Node (That as a Save file at the end)
  • Create a Loop in Imperitive that runs until a specified number (Maximum number of elements)
  • Use that same Loop count to specify which of the elements to run on (from 0 > Element Maximum)
  • Run the script using the dynamo player to void Element binding.

The theory being, the script will continue to run until it fails, but on crash i will know where it is going wrong / it won’t continue to consume memory until failure.

The run time might be longer on this but at the very least it will be progressive in its approach.

I Guess the one part i am stuck on currently is the Imperitive loop, i haven’t dabled in this area at all in Dynamo and whilst it is getting no errors i don’t actually know if what i am doing is possible.

  • When in the player the script errors on the loop saying it can’t be found.
  • With Dynamo open it runs without error but only 1 element is generated (Obs this isn’t what i want to do cause element binding would then also be an issue)

So unless Jacob comes back with some magic with what he currently has, can anyone help with this disgusting attempt at a script loop.

1 Like

Ok… finally found the time to look at this and… it isn’t pretty. Anyone who models chain link or wire grids as an actual geometry deserves a special place in hell…

But I think what I’d try is individually composing each model direct shape as a direct shape in a new family, and save the family to a new location. The code here might be a good start: Revit DirectShape from Curve - #7 by jacob.small

Once you have the families in each document you can save out the library, and then load those into a single model. Names can be derived from each IFC import with the file name as a prefix to ensure that you don’t have any duplicates. And then… viola! you’re federated as a single model.

I still hate the workflow (everything in a single model with this level of detail will be of minimal functional use) but it should work.

I can confirm this works - you’ll want to name the family at some point so that it has a unique name, or you can rename it in the document after loading it in. If you really wanted you could even modify it to pull the directshape objects out of a link instance and into the current document to skip a middle man…

I explored this earlier on but found there to be an error with the collection of the geometry, which pushed me down the mesh road to begin with unless i am mis-interpreting what you are saying?

Yeah - for your use case you can expose the geometry as a Revit API entity, and add it to the nee family directly. No need to convert to a dynamo geometry - you’ll run faster and get more consistent results as there is no conversion.

I’m not sure i follow?

Don’t feed it Dynamo geometry - feed it the Revit element and extract the geometry from that via the Revit API, then move the geometry from memory into a new family document as a direct shape. :slight_smile:

Just an idea to get a more reliable geometric representation, how about using the TessellatedShapeBuilder for Geometry Conversion? Pretty fast as well.

This uses API elements as @jacob.small has indicated.

11 seconds = 503 directshape elements generated from the Revit.DB geometry elements from this placed DirectShape instance. Looks like it got all of the geometry, from a high-level check…

I have just used rudementary family naming based on the list enumerations for placed elements.

Revit_SqbaqrYkTY

TessellatedShapeBuilder Test for Complex DirectShape Conversion.dyn (22.1 KB)

3 Likes

Thanks Ewan,

Looks to be exactly the type of solution i was looking for and again, on smaller runs it worked for me.
But when i throw the whole model at it (and i’m not sure if expected or not) but it has been running for hours now… Not that i am giving up on it, i’ll let it chug all night and update on results.

You absolutely deserve a gold start though. Champion.

Edit… It crashed :frowning:

Just going back to this as a backup… and well i love to experiment.

i changed this for a Loopwhile node and its not quite getting the result i was expecting.
Does anyone know where i am going wrong?

The process is supposed to be

  • Read text file to get index of where to start (Works)
  • Convert 1 Mesh to a Directshape (Works)
  • Update the text file to +1 of the number (Works)
  • Update the Loopwhile Count (Apparently works?!)

I’m confused it looks like it is doing everything i want but the Loopwhile loop is running faster than the LoopBody?

I have found what looks like a solution but i cant read it well enough to decipher what is giving the iterative results / run pattern :frowning:

Haha ok so this is really hacky but its going to result in a win so, since the main problem here was memory consumption on my brick (with both methods shown), and the answer was to loop the script with individual elements.
I tried for a while using Python / Imperative / OOTB etc etc as shown above but then i realised…

Power Automate… Literally is designed for this.

  • Get the total number of elements and whack that in the loop for power automate.
  • Set the Run Count .txt to 0
  • Run the power Automate
  • On run the script reads the .txt file to see seq of where to start (Item at index)
  • End of each run it write the seqentially new number in the text file
  • Power Automate simply waits for the run complete icon in the UI and runs again…

This is not clever at all but this actually will do what i need and i had a lot of fun doing it.

Thanks @jacob.small and @Ewan_Opie for your super valuable input but after all that
i decided to go with my script with meshes simply because it was already complete and at the goal of
retaining object integrity (ie: each original element should still be a simple element instead of parts)

Although i feel as if when i go fully through Ewans code that i might find that i can arrange it that way and so in future it could be built in that manner more efficiently with less potential for error…Hence the Mark as solution.

2 Likes

Another option for next time: one custom node from everything except the selection nodes. Build it so it processes only one element at a time, and then you’re good to go. :slight_smile:

That is essentially what i tried earlier. With the loopwhile node, are you saying to put the whole thing in a python loopwhile?

I’m saying no need for a while loop - just one custom node. I’ll try and take a stab at something early next week since I have a base now. :slight_smile:

1 Like