Cannot change workPlaneProxy.Visible in iPartMember

Hubert_Los
Advocate
Advocate

Cannot change workPlaneProxy.Visible in iPartMember

Hubert_Los
Advocate
Advocate

Hello,

I have code that works with simple parts and ContentCenter parts, but cannot change the visibility in iPartMember. Does anyone know why?

Sub ShowWorkPlanes()
    
    Set oCC = ThisApplication.ActiveDocument.SelectSet.Item(1)
    Dim oWorkPlaneProxy As workPlaneProxy

    For Each oWorkPlane In oCC.Definition.WorkPlanes
        Call oCC.CreateGeometryProxy(oWorkPlane, oWorkPlaneProxy)
        oWorkPlaneProxy.Visible = True
    Next

End Sub
0 Likes
Reply
199 Views
3 Replies
Replies (3)

WCrihfield
Mentor
Mentor

Hi @Hubert_Los.  That code example appears to be in VBA, but since I do not use VBA anymore, I copied the internal code of that routine into a new iLogic rule, eliminated the 'Set' & 'Call' keywords, then tested it.  I got an error saying that there was a Type mismatch.  This is because it does not know what Type of object the variable 'oCC' is supposed to be representing.  After I edited the code to include the 'declaration' and Type of that variable, it started to work for me.  But I was not testing on an assembly component that represented an iPart member,  because I do not use iParts anymore.  However, after seeing that this code effects the referenced document, not just the component within the context of the assembly, I think I know why you may be experiencing those problems.  I believe that iParts, as well as Content Center parts, and any other referenced files that may be stored in 'Library' type locations, are seen as ReadOnly.  So, any code that attempts to change them will fail. 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

WCrihfield
Mentor
Mentor

Do you know if that iPart member contains any DVR's (DesignViewRepresentations / DesignViewRepresentation)?  If it did have one, and the visibility of those WorkPlanes was turned off while it is active, then you could simply set that assembly component (ComponentOccurrence) to that DVR (ComponentOccurrence.SetDesignViewRepresentation), and that would accomplish the same result.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Hubert_Los
Advocate
Advocate

Hello @WCrihfield 

1) " I believe that iParts, as well as Content Center parts, and any other referenced files that may be stored in 'Library' type locations, are seen as ReadOnly"

Yes, if I want to change only WorkPlane, I can't do it, so I create WorkPlaneProxy. Then it doesn't matter that the file is “Read only”

2) The code works for the Content Center part






0 Likes