Parts Visibility on View

Parts Visibility on View

Anonymous
Not applicable
690 Views
8 Replies
Message 1 of 9

Parts Visibility on View

Anonymous
Not applicable

Does anyone have an idea on how to manage the visibity of parts on a particular view?

 

For example, in a view there 10 parts appeared. I would like to make only selected parts visible on the said view.

 

I have the manual steps on how to hide them but when I try to code it using the said step, the parts on the model file were hidden not in the view.

 

I use oView.ReferenceDocumentDescriptor.ReferenceDocument in traversing the parts but this refers to the model file.

 

Here is my code:

 

Set ViewDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument

 

For Each ViewOccurence In ViewDocument.ComponentDefinition.Occurrences
        If Not nozzleName = ViewOccurence.ReferencedDocumentDescriptor.DisplayName Then
            ViewOccurence.Visible = False
       End If
Next

 

Please help me on this problem. I'm using VBA on this one. I just need a sample code for this.

 

Thanks in advance.

0 Likes
691 Views
8 Replies
Replies (8)
Message 2 of 9

theo_bot
Advocate
Advocate
Isn't it possible to use viewreps? Thats makes it easier to control visibility of components in your views.
0 Likes
Message 3 of 9

Anonymous
Not applicable

Did you mean design view representation?

 

I have known view representation through the object browser but the only method i see on it regarding the visibility of the component are only HideAll and ShowAll method.

 

I want to have only selected components to be visible in the view.

 

Do you have a sample code for this?

 

 

0 Likes
Message 4 of 9

Anonymous
Not applicable

My Requirement is also almost same, but i am using VB.Net.

 

If anybody knows the solutions, it would be helpful.

Click Here to go to my posting

0 Likes
Message 5 of 9

skyngu
Collaborator
Collaborator

first, create design view representation as need in assembly model.

second, got assembly model in drawingdocument in vba or vb.net.

then, use this "ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("name of design view").Activate" to get design view.

 

try it, it should work.

Autodesk Inventor Professional 2019
0 Likes
Message 6 of 9

Anonymous
Not applicable

Some says that view representation is the solution for my problem so I'd tried to solve it using view reps but unfortunately I can't get the right code for view reps.

 

Do you have some code for this?Hope you can provide me.

0 Likes
Message 7 of 9

skyngu
Collaborator
Collaborator

it is on my reply.

Autodesk Inventor Professional 2019
0 Likes
Message 8 of 9

Anonymous
Not applicable

I mean in creating view reps. Sorry for the misunderstanding.

0 Likes
Message 9 of 9

theo_bot
Advocate
Advocate

I use this line in Ilogic, but it's coming from the APi help so it shout work in VB

 

ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Add("newviewname")

 

 

0 Likes