How to control visibility of the component in DVR

How to control visibility of the component in DVR

Cris-Ideas
Advisor Advisor
420 Views
3 Replies
Message 1 of 4

How to control visibility of the component in DVR

Cris-Ideas
Advisor
Advisor

Hi,

I am looking for some example for quite some time now and did not find anything really useful.

 

My problem is how do I control visibility of the component in DesignViewRepresentation but not the one that is currently active?

 

Can someone advice?

 

Cris.

 

Cris,
https://simply.engineering
0 Likes
421 Views
3 Replies
Replies (3)
Message 2 of 4

clutsa
Collaborator
Collaborator

Can you record the current DVR, change to the DVR you want to edit, edit the visibility, and return to the original DVR? 

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 3 of 4

Cris-Ideas
Advisor
Advisor

Yes,

but I would prefer to do that behind scenes. and not activate given DVR.

 

Is that possible? Does API provide access to list of components for a given DVR?

 

Cris.

Cris,
https://simply.engineering
0 Likes
Message 4 of 4

clutsa
Collaborator
Collaborator
Dim app As Application
Dim Doc As Document
'Dim docM As Document

Set app = ThisApplication
Set Doc = app.ActiveDocument
Dim DVR As DesignViewRepresentation
Set DVR = Doc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Welds Hidden")
Dim objColl As ObjectCollection
Set objColl = app.TransientObjects.CreateObjectCollection
objColl.Add (Doc.ComponentDefinition.Occurrences.ItemByName("01nnx-xxWn-nnnnn_C360:1"))
Call DVR.SetVisibilityOfOccurrences(objColl, False)

This is as close as I could get but if my Active DVR isn't "Welds Hidden" then I get run-time error '-2147467259 (80004005)' Method 'SetVisibilityOfOccurrences" of object 'DesignViewRepresentation' failed. 

 

DVI = DVR.DesignViewInfo
Debug.Print (DVI)

prints an XML formatted string that has the occurrences and visibility settings for the view but is read only so that's not much help. If you re-post your question with the above insights maybe someone else can get you closer.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes