Set default 3d View as active

I am trying to use the Element.Create 3d Cropped view from Steam Nodes…Only problem is it requires you to be in a 3d view or it doesn’t work. I want to set the view to be the default 3d at the start of the script but no matter what I do the transaction doesn’t seem to happen till the script wraps up. I have tried wait nodes and I have tried stepping the process with 2 ui nodes. thoughts?

Look at the Python code. I’m guessing the code sets the view to be the active view towards the beginning. You could just force it to use the default 3D view instead.

It’s probably not the answer you want but there is no issue of that kind with View3D.SetSectionBox from Rhythm (newest version). You just need to duplicate a 3D view first and select an appropriate number of elements. I don’t know if the result would be exactly the same than with Steam Nodes though…

2 Likes

It does say activeview=doc.ActiveView

I did find that there is not a way to set an active view through dynamo…couple of the guys (archi-labs??) were talking about having to stop the transaction (over my head) within python but it is asynchronous??

needless to say I will look at other methods.

I don’t think this has to run on the active view. The Steam node just chooses to run on the active view. You can set activeview (that’s only the variable’s name) to be any 3D view.

1 Like

You can get default 3d view with a postable command. I bet you can pull the code out of my python script and incorporate with steam nodes.

1 Like

john - That node works but can’t be used to set the default 3dview…and then perform a command. the view isnt set till the script completes. I looked at it because the node above requires the user to be in a 3D view to start or it wont run. i was hoping to have the script change the view.

@Nick_Boyts gave you a solid answer actually. If we create an input for the 3d view it just works.

And here is the modified .DYF file for your use. I also fixed a list issue for the input.Element.Create 3D Cropped view.dyf (14.2 KB)

3 Likes

You can modify the code to use whatever (3D) view you like.
I pulled the element Id of my default 3D view (163350) and hardcoded it into python.

activeview = doc.GetElement(ElementId(163350))

great minds…i was just trying to do that…thanks for posting that file!

1 Like

john if i feed it a list it freezes

Not too sure @AdamHamilton. I can try to take a look but those are not my nodes. Those are @Julien_Benoit1’s.

Using Rhythm nodes you can achieve this in a different way. There was some discussion on this here
https://www.revitforum.org/dynamo-bim/35978-creating-3d-view-each-level-corresponding-section-box.html

I will also upload a graph tomorrow morning using my nodes to get this done.

i tried that direction and had some limited success but the method used in this node does exactly what i am looking for. I appreciate your help and hope Julien sees this thread as what we are working on would make his node that much more awesome.
@Nick_Boyts thank you too, the single change you propose does work as well but can make it limited.

I am getting pretty solid at the base dynamo…now i gotta get some skill built in the python writting.

I mainly did it as a proof of concept. I think you’d be able to search for the default 3D view, {3D}, in your project then use its Id number instead of manually putting the number in and hoping the template doesn’t change. But I haven’t tried that yet.

As for using lists, it should be possible if you use lacing. Just be sure you have an input for each sublist to keep things from getting complicated.

Edit: Or do you mean cropping a single view based on multiple elements?

a list of rooms to create multiple cropped 3d views. - Room data sheets. the default view though can change or be missing if you never made one.

i have tried the lacing but what happens is the python gets in a loop i think…it makes the first one but then stalls after that. I see that it is using a Min value to try to cycle to the next instance in the list but nothing happens.

Strange. I was able to create multiple views from multiple elements with no problems. Make sure your rooms are OK. You could have some unplaced rooms.

1 Like

i had already filtered them…i ran into that already. what lacing are you using?

I was able to do it with no lacing (shortest) but that was with other elements. It crashed on me when I tried rooms.

it is working for me now with some wait nodes! still need to filter for unplaced rooms. big thanks guys!

1 Like