Export NWC files - One file per Element

Hello everyone!
First time actually creating a post so I hope I can explain my issue correctly to help other users too, and thanks for all the help you have provided to Newbies at Dynamo like me :slight_smile:

So I have been trying to export NWC files using the Genius-Loci Package which has been recommended so much in these forums. The export has to be per element with a specific Name Tag to the file (containing one element). The issue is that the Node “Export NWC in Document” will take views instead of elements, so to fix that I made a Bounding Box surrounding the element and created a 3D view from the Bounding Box for the export. It was working fine for Revit Elements which had cubic shape and were facing North…

I believe in the ExportScope is where that information is added as the options are the same as in the manual Export settings “Model”, “View”, “Selected Elements”. Unfortunately when I pick “Selected elements” it will still export the whole View in the NWC file :frowning:

Also the Bounding Box method is doomed to fail for steel structures as they are rarely cubic shaped. So what I have though so far is to find another method to create the View from the element but I have ran out of ideas in the “how”, or maybe make a code which moves the element far away makes the view from isolated element and returns it to place but I feel like there should be an easier way.

Here’s some pictures that might be helpful:
Did this to show on the top what happens with the Graph and on the bottom the manual export, hope it helps because I had to improvise a little…

That’s why I believe there should be a way in Dynamo to do this as Manually is fairly easy but time consuming.

I have read probably all the Topics that speak about NWC export and haven´t found the right one that is specific to my goal.

Thank you in advanced atleast for giving my post a thought :slight_smile:
And I hope I am not getting out of line in the structure of the Topic…

Hi @emiliano.fuenzalida,

To use the SelectedElements scope, the code needs to be modified to include the SetSelectedElementIds method.

Thanks for the quick response, I will try that! Hope I manage to get it right !

Good Evening @Alban_de_Chasteigner ,

I have been trying to connect the method you sent within the code that you edited and I’m lacking knowledge to do that, I am guessing the SetSelectedElementsIds method goes somewhere within IN[4] but everytime I’ve tried to edit your code it goes to Error…
I am trying to learn more difficult coding so will keep trying to figure it out by myself, but if u can give some direction in what to look for in the code or what knowledge should be helpful to figure it out, I’d appreciate it a ton…

Hi,

I don’t have free time now nor applicable use case for this addition.
You can probably use the SetSelectedElementsIds method in conjunction with the uidoc.Selection.GetElementIds() method.

2 Likes