API - Get the "Design View Representation" name from a drawing view

API - Get the "Design View Representation" name from a drawing view

lian_xie
Contributor Contributor
1,135 Views
3 Replies
Message 1 of 4

API - Get the "Design View Representation" name from a drawing view

lian_xie
Contributor
Contributor

When the drawing view was created from a Design View Representation in an Assembly and the checkbox of "Associative" was unchecked, the value for "ActiveDesignViewRepresentation" is an empty string "" (as shown in the attached word file).

 

How can I get the name of the "Design View Representation" from the drawing view where the "Associative" checkbox was unchecked?

 

Thanks, Lian

 

 

1,136 Views
3 Replies
Replies (3)
Message 2 of 4

Jon.Balgley
Alumni
Alumni

Hi Lian --

 

You are correct: if the DrawingView is not associative with the DesignViewRepresentation (DVR), then subsequently calling DrawingView.ActiveDesignViewRepresentation will return the empty string.

 

I can give a halfway-good justification for that:  Once you do myDrawingView.SetDesignViewRepresentation("myDVR", False), then it is using a "snapshot" of the state of the DVR; it's not really using the DVR after that point.  After all, you can turn components on/off in the drawing, independently of their visibility in the DVR in the assembly.  So subsequently asking for the "active" DVR of the drawing-view is no longer accurate.  I think you're asking for "what was the last DVR assigned to this drawing view?" ... not the "active" one.  That would be a new API property.  Is that what you want?  If so, you could enter that in the "Inventor Ideas" forum (or reply here and I can do it).

 

If you are in control of the whole process here, you could save the name of the DVR when it is first assigned to the drawing (e.g., in an attribute), and then retrieve it later.  That doesn't address this issue for existing drawings, nor for drawing views created directly from the UI.


Jon Balgley
0 Likes
Message 3 of 4

lian_xie
Contributor
Contributor

Hi Jon,

Thank you very much for the explanation.  I agree with you 100 per cent.

Is there a API function to turn on the "Associative" checkbox on the drawing view if it was nchecked?

Best regards,

Lian

0 Likes
Message 4 of 4

Jon.Balgley
Alumni
Alumni

The only way to turn on/off the "Associative" box is to use DrawingView.SetActiveDesignViewRepresentation("myDVR", True)

 

(i.e., it takes an optional second argument that controls the associativity)

 

This resets the state of the drawing view to the current state of the DVR.  If the second argument is True, then the drawing view stays in sync with the DVR.  If the second argument is false (or not supplied), then it resets to the current state of the DVR, but does not stay in sync after that (with respect to component visibility, anyways ... it does stay in sync with changes to the geometry of the visible components).

 

But in any case, you need to know the name of the DVR ... you can't get the "last DVR I used" from the drawing view.  


Jon Balgley