Get Viewports from Linked Sheets

Hello all,

I am trying to grab the Viewports located on a linked Sheet. I have tried View.GetViewport (SteamNodes) and Sheet.GetViewportsAndViews (Rhythm). They both grab the Viewports of two sheets and then return null for the rest. View.GetViewport returns null for each viewport placed on the sheet and I have confirmed the sheets are not blank. Does anyone have any ideas?

Sheet.GetViewportsAndViews warning:
Warning: Sheet.GetViewportsAndViews operation failed.
The call is ambiguous between the following methods or properties: ‘Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.CurtainSystem, bool)’ and ‘Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.FamilyInstance, bool)’

Thanks,

Steven

Speaking for my node, it was not made to work with linked documents. That would require an additional input unfortunately. For it to be working with two sheets is odd to me, (if they are in the link).

The error you are receiving on the node is a random one that happens when nulls occur. In the case of selecting viewports I am trying to do that in the current document on my node and this is most likely the cause. For now, I imagine you could dissect steamnodes’ node and add an additional input for document. I can try to add this functionality to my node in a future update as well.

Here is what the node would look like in Rhythm if I add the option. (It would be an optional input for Document)

2 Likes

Hey John,

Thanks for the reply. I did not think the nodes would work when I plunged them in but I like trying. The results are strange since they do work on two of the sheets. I have confirmed that the two sheets are from a linked file. This is how I am grabbing the sheets (No other sheets are being collected in this graph).

Could it be that the linked sheets shares the same GUID as a sheet in the current file? Both files were created from the same template. (Its an old temple so I would have to dig up the archive to check).

I have already built a workaround by collect all linked views, get the sheet they are placed on and finally match the two lists.

I bet that is it. That they share the same ElementId actually.

1 Like

Wow that was fast did you just code that in two minutes?

:wink: Let me push it to the package manager now for you to test out!

1 Like

Thanks John,

You did not need to do that. It will help clean up my graph though.

Better nodes for people to use! :metal:

3 Likes

Now live on the package manager.
image

1 Like

I will go test it out and report back.

Thank John,

1 Like

Hey @john_pierson,

The node is working great. Thank you for making the change so quickly, it really helped clean up my graph. I have not noticed any problems with it yet.

Thanks,
Steven

2 Likes

@john_pierson, I’m not seeing that the Sheet.GetViewportsandViews has the functionality discussed here (optional input for Document). Any suggestions?

I’m using the following package version:

image

Hmm. The newer versions of Rhythm should have had the doc input, (2019.6.1 is pretty out of date).

However, I did not like the option of having a doc input, so I just updated the node for it to find what document the sheet came from.

Note: Working with linked files this way is pretty darn unstable. So run manually, and be patient. lol

Get this version and give it a try,
image

Thank you @john_pierson! I wanted to share with you the node error I was getting, along with the package upgrade warning, to see what problems I could possibly find myself dealing with by upgrading the Rhythm package.

The upgrade warning can be ignored. It’s because I published from Revit 2020 and dynamo 2.3.0. Since they are both 2.x versions it is ignorable.

The other warning is because the node couldn’t return some of the elements. Like I said, expanding linked elements into memory is quite messy.

To elaborate a bit more on that:

Dynamo was/is made to work on the current Document primarily. This is why things like setting parameters, getting active views, etc. only ever works on your current file. Even though this is a restriction of Dynamo, we have limited access to Revit’s background workflows for Documents. This means we can do some things like collect elements and whatnot. But, we sometimes run into problems when Dynamo tries to return the elements as an output. That is what that error means. It got confused and does not know what to do.

As you can see, @Steven ran into the same thing previously.

I greatly appreciate the dialog here! I will for sure update the package and let you know what the results are.

Might using the Document.Open and Document.Close nodes lessen this confusion at all when trying to perform tasks such as this? As I’ve not used these two nodes before, I guess I’m just more curious as to what their purpose is when information from linked documents can still be queried without actually “opening” them in the background.

Of course! :slight_smile:

Those nodes are for files that are not links. I have primarily seen them used for when people want to bring in something wall types from a resource library.

Works like a charm now! Thanks a bunch @john_pierson!

1 Like

is there a node for dynamo 1.3 that gets views on sheets from linked files? :hot_face: or viewports if you can extract viewport name and detail number