Retrieve view reps used in idw view

Retrieve view reps used in idw view

PJKeeffe
Contributor Contributor
840 Views
6 Replies
Message 1 of 7

Retrieve view reps used in idw view

PJKeeffe
Contributor
Contributor

Is it possible to retrieve the View representations( View,Position & LOD) used as a parameter/text and print  on idw?

0 Likes
Accepted solutions (1)
841 Views
6 Replies
Replies (6)
Message 2 of 7

CattabianiI
Collaborator
Collaborator

To retrieve that data use the properties from the DrawingView class: 
ActivePositionalRepresentation
ActivePresentationView
ActiveLevelOfDetailRepresentation / ActiveModelState

If you want to add them in the drawing you can create general notes after reading that values, check this post and look at the sample: https://forums.autodesk.com/t5/inventor-forum/create-text-box-in-drawing-using-ilogic/m-p/5094780#M5...

0 Likes
Message 3 of 7

PJKeeffe
Contributor
Contributor

Thanks-making progress- can retrieve View name, View Position & View LOD but not the View Representation?

Any reason why?

Code to date

Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select View")
If oView Is Nothing Then Exit Sub
bView = oView.Name	
Dim oModelDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oViewRep As String
oViewRep = oView.ActivePresentationView
Dim oViewPos As String
oviewPos = oView.ActivePositionalRepresentation
Dim oViewLOD As String
oViewLOD = oView.ActiveLevelOfDetailRepresentation

MessageBox.Show(bView, "View Name")

MessageBox.Show(oViewRep, "View Details")

MessageBox.Show(oViewPos, "View Position")

MessageBox.Show(oViewLOD, "View LOD")

Thanks in advance

PJ

0 Likes
Message 4 of 7

A.Acheson
Mentor
Mentor

You had the incorrect property active this line should be as below.

 

oViewRep = oView.ActiveDesignViewRepresentation

For some reason this is missing in the online documentation DrawingView @CattabianiI  had kindly posted. You can find this in the drop down in the editor or in the built in API help.

 

 AAcheson_0-1632078311155.png

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 7

PJKeeffe
Contributor
Contributor

Thanks- added the line of code via copy/paste (Can't get the dropdown menu to appear) but still no result in message box. Also trying to find a snippet or command that returns the co-ordinates of the selected view to enable printing of the view data in relation to the view position- can you help thanks

0 Likes
Message 6 of 7

JelteDeJong
Mentor
Mentor

Check this forum topic "DrawingView->ActivePresentationView never returns value". It seems to be a bug.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 7 of 7

A.Acheson
Mentor
Mentor
Accepted solution

Is the view set to associative in the drawing? If not the view is a snapshot of the model design view and not linked. I would place in an error catch statement to say not associative if returned blank as this is an important part of updating the views. 

Here is a quick one to get the position and here is how to move a label in relation to the view. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan