How do i hide work features on a subassembley

davidt162003
Advocate

How do i hide work features on a subassembley

davidt162003
Advocate
Advocate

So On my model ive have a number of work planes which end up crowding the space and generally make it visually busy. the majority of these were implemented at the part or sub assembly level and have been their visibility switched off at that level. however when i place them into the main assembly they still show up.

davidt162003_0-1708505105460.png

and the model tree looks like this 

davidt162003_1-1708506733905.png

this is the code ive attempted to implement but it didn't work 

 

    Private Sub HideAllWorkFeatures(AssembleyDoc As AssemblyDocument)
        Dim AssyDef = AssembleyDoc.ComponentDefinition
        Dim Occurences = AssyDef.IncludingSubOccurences
        For Each pOcc As ComponentOccurrence In Occurences
            If pOcc.Definition.Type = ObjectTypeEnum.kVirtualComponentDefinitionObject Then  'definitely better way to do this 
            Else
                For Each pWPoint As WorkPoint In pOcc.Definition.workpoints
                    Dim pWpProx As WorkPointProxy
                    pOcc.CreateGeometryProxy(pWPoint, pWpProx)
                    pWpProx.Visible = False
                Next
                For Each pWPlane As WorkPlane In pOcc.Definition.WorkPlanes
#If DEBUG Then
                    If pWPlane.Name.Contains("Hole") Then Stop
#End If
                    Dim pWpProx As WorkPlaneProxy
                    pOcc.CreateGeometryProxy(pWPlane, pWpProx)
                    pWpProx.Visible = False
                Next
            End If
        Next
    End Sub

 

 

HII
0 Likes
Reply
Accepted solutions (1)
353 Views
3 Replies
Replies (3)

FINET_Laurent
Advisor
Advisor
Accepted solution

@davidt162003 

 

Can you please check the representation view of the placed component to see what it is ? I think by defaul the representation view is set to be on "Main", which is the view with everything visible.

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes

davidt162003
Advocate
Advocate

That dose seem to have done it. It already was on master representation but i just had to reiterate  that it was 

HII

davidt162003
Advocate
Advocate

Perhaps you meant "Master"? although that dosent seem to set everything to visible. it gives me the same view as the part

 

And something quite strange seems to happen. When Requesting through the api you get this: 

?pOcc.ActiveDesignViewRepresentation
""

how ever when requesting through the UI it seems to automatically refine itself to the "Master" view, Which gives me the same representation as the part/subassembly.

 

So i was able to fix my problem by using:

  pOcc.SetDesignViewRepresentation("Master")

 

HII