How to identify SketchPlane for a ViewSections "Viewer" element

How to identify SketchPlane for a ViewSections "Viewer" element

Anonymous
Not applicable
969 Views
9 Replies
Message 1 of 10

How to identify SketchPlane for a ViewSections "Viewer" element

Anonymous
Not applicable

Hi,

 

I am trying to reliably identify the SketchPlane for a ViewSections "Viewer" element.

 

The only way I've found to do this so far is shown in Revit Lookup image below. In brief, I get the Dependent Sketch Plane elements of the Viewer and choose the one which has the lowest ID value. I am not happy with making this assumption because I'm not certain it will always be the case.

 

Is anyone familiar with a more precise/direct way of determining the associated SketchPlane? I'm doing this because I need to get the Origin point of the Plane.

 

jalbert7BW3D_0-1634227390533.png

 

 

 

 

Accepted solutions (1)
970 Views
9 Replies
Replies (9)
Message 2 of 10

RPTHOMAS108
Mentor
Mentor

Since they are dependant elements aren't they all valid sketch planes for the viewer and associated view?

 

I'm only getting one sketch plane per section but the model I have isn't that well developed, is your one a work shared model? You could go into the dependant View and and get dependant elements on that but I'm assuming you may get the same list.

 

When a specific work plane has been set for a view it's SketchPlane property will be set otherwise it is null. I don't know if the sketch plane objects hold much meaning otherwise. Perhaps you would also have an additional one for a shaped crop but all your sketch planes are named after the view (so indicates previous/other planes used for that view).

0 Likes
Message 3 of 10

Anonymous
Not applicable

@RPTHOMAS108 yes they are all valid sketch planes for the SectionView, but only 1 represents the "Viewers" SketPlane Origin. The other SketchPlanes in my example are the result of user adding a Filled Region in the SectionView.

 

That said, your comments got me diging deeper and I may need more than just the SketchPlane Origin for what I'm trying to accomplish. Looks like I am also (or instead of) need to know the start and end points of the Viewers extents. I may need to do some more research and re-post and revise my question.

 

In the meantime, see image below for the points I actually think I need to know. Basically need to know the start and end points of the "Viewer". Basically I am trying to create a tool for the user to save/store the Viewers "Home Location" so that if they move it elsewhere temporarily they can use my tool to move it back to it's original/home location with the touch of a button.

 

jalbert7BW3D_0-1634261343478.png

 

 

 

0 Likes
Message 4 of 10

Anonymous
Not applicable

Ok, after a little more digging I think my original question still stands. In it's simplest form my question is...

 

Using the Revit API, is there a full proof way to get the SketchPlane that represents a ViewSections "Viewer" element as seen in the images below.

 

Any help is much appreciated!

 

jalbert7BW3D_0-1634306563266.pngjalbert7BW3D_1-1634306573746.png

 

 

 

 

 

 

 

0 Likes
Message 5 of 10

RPTHOMAS108
Mentor
Mentor

Do you find the origin to be different in the other sketch planes, how so?

 

I think the multiple sketch planes are just for different elements sketched in the view. There is no such thing as home position of a section. There is only how it was in the template and where it is in it's current location.

 

If you want to move it back to an initial position the best option is to record such in extensible storage when the document is newly created or position is saved. 

 

In terms of creating temporary views: ctrl + drag works best (then just delete it). If I'm precious about the original location I'm not going to move it. It is just as easy to create a new view by drag copy and the cursor doesn't even have to leave the work area to press a button for this.

0 Likes
Message 6 of 10

Anonymous
Not applicable

Figured easier to elaborate and respond with a video. See link below...

 

https://youtu.be/xzEvXZ5A0Us

0 Likes
Message 7 of 10

RPTHOMAS108
Mentor
Mentor
Accepted solution

Thanks for the clarification.

 

For position you should instead find the ViewSection within the dependant elements and then use either:

View.CropBox.Transform.Origin

or

View.Origin

 

Dashed blue line is the crop box of the view this has a transform aligned with the view coordinate system of the section (so it's extents can also be found that way and converted back into model system coords if required).

 

211016a.png

 

 

0 Likes
Message 8 of 10

Anonymous
Not applicable

Bingo! View Origin is really all I need. I can t believe I over complicated it so much. LOL

0 Likes
Message 9 of 10

RPTHOMAS108
Mentor
Mentor

One thing you should consider (or at least your end users should) is that by moving the view you may lose dimensional and tag references to elements depicted in that position. These may not then be restored when the view is moved back later. That is part of why I suggested copying or duplicating views as being the safer option. I think tags generally stick around and may come back but dimensions usually get deleted.

0 Likes
Message 10 of 10

Anonymous
Not applicable

Yes, I think our users are aware of this as they have have been doing it this way for some time. I believe they only use Tags for most part. It's an unfortunate but seemingly necessary part of our workflow until we find a better solution.

 

Thanks again for your help, you saved me from overcomplicating a very simple task 🙂

0 Likes