Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot change workPlaneProxy.Visible in iPartMember

3 REPLIES 3
Reply
Message 1 of 4
Hubert_Los
196 Views, 3 Replies

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

Cannot change workPlaneProxy.Visible in iPartMember

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
Tags (3)
3 REPLIES 3
Message 2 of 4
WCrihfield
in reply to: Hubert_Los

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

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)

Message 3 of 4
WCrihfield
in reply to: Hubert_Los

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

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)

Message 4 of 4
Hubert_Los
in reply to: WCrihfield

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

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






Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report