• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Active Member
    rjones0215
    Posts: 9
    Registered: ‎10-01-2011
    Accepted Solution

    ilogic and work plane visibility

    722 Views, 19 Replies
    03-23-2012 10:59 AM

    Is there a way to turn off visibility on work planes using ilogic?   Also, is there a way to change an extrusion type from an assymetrical extrusion to a one direction extrusion using ilogic?

    Inventor 2013 Certified Professional
    Please use plain text.
    Valued Mentor
    swordmaster
    Posts: 449
    Registered: ‎12-15-2008

    Re: ilogic and work plane visibility

    03-23-2012 11:44 AM in reply to: rjones0215

    This will turn the visibility of Work Plane1 off

     

    Dim

    oDoc As PartDocument

    oDoc

    = ThisDoc.Document

     

    For Each

    oWorkPlane In oDoc.ComponentDefinition.WorkPlanes

     

    If oWorkPlane.Name = "Work Plane1" Then

    '

    oWorkPlane.Visible = False

    '

    End If

    Next

     

     

     

    Inventor 2010 Certified Professional
    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,964
    Registered: ‎03-08-2006

    Re: ilogic and work plane visibility

    03-23-2012 01:23 PM in reply to: rjones0215

    Hi rjones0215, 

     

    Here's another rule that toggles all of the workplanes on/off.

     

    I hope this helps.
    Best of luck to you in all of your Inventor pursuits,
    Curtis
    http://inventortrenches.blogspot.com

     

    'define document
    Dim oDoc As PartDocument
    oDoc = ThisDoc.Document
    'look at the workplane collection
    For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
    'toggle all work planes
    If oWorkPlane.Visible = True Then
    oWorkPlane.Visible = False
    ElseIf oWorkPlane.Visible = False Then
    oWorkPlane.Visible = True
    End If
    Next
    
    

     



      solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.

    Please use plain text.
    Valued Mentor
    swordmaster
    Posts: 449
    Registered: ‎12-15-2008

    Re: ilogic and work plane visibility

    03-23-2012 01:51 PM in reply to: Curtis_Waguespack

    Nice rule Curtis

    Inventor 2010 Certified Professional
    Please use plain text.
    Active Member
    rjones0215
    Posts: 9
    Registered: ‎10-01-2011

    Re: ilogic and work plane visibility

    03-26-2012 05:17 AM in reply to: rjones0215

    thank you.  These definitely help.

    Inventor 2013 Certified Professional
    Please use plain text.
    Active Member
    Posts: 9
    Registered: ‎08-22-2012

    Re: ilogic and work plane visibility

    09-24-2012 09:43 AM in reply to: Curtis_Waguespack

    How can I make this work so that from an assembly plane visibility is changed to false in all sub assemblies and and parts.

     

    Thanks

    Inventor 2013
    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,964
    Registered: ‎03-08-2006

    Re: ilogic and work plane visibility

    09-24-2012 10:35 AM in reply to: david.campbell

    Hi Diswill,

     

    Here are 2 quick rules that should give you an idea of how to do this. I didn't take a lot of time to test this, so be warned that you might bump into issues with locked design view reps, etc. But this should get you pointed in the right direction I think.

     

    I hope this helps.
    Best of luck to you in all of your Inventor pursuits,
    Curtis
    http://inventortrenches.blogspot.com

     

    sample rule #1

    'get user input
    oInput = InputRadioBox("Select workplane visibility:", _
     "Turn ON workplanes for all components", "Turn OFF workplanes for all components", "True", "iLogic")
    
    'Define the open document
    Dim openDoc As Document
    openDoc = ThisDoc.Document
    
    'Look at all of the files referenced in the open document
    Dim docFile As Document
    For Each docFile In openDoc.AllReferencedDocuments                
    'format  file name                   
    Dim FNamePos As Long
    FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
    Dim docFName As String 
    docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
    For Each oWorkPlane In docFile.ComponentDefinition.WorkPlanes
    'toggle all work planes
    If oInput = True Then
    oWorkPlane.Visible = True
    ElseIf oInput = False Then
    oWorkPlane.Visible = False
    End If
    Next
    Next
    
    iLogicVb.UpdateWhenDone = True
    
    

     

     

     

    sample rule #2

    'toggle work planes on, if off & off if on
    'Define the open document
    Dim openDoc As Document
    openDoc = ThisDoc.Document
    
    'Look at all of the files referenced in the open document
    Dim docFile As Document
    For Each docFile In openDoc.AllReferencedDocuments                
    'format  file name                   
    Dim FNamePos As Long
    FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
    Dim docFName As String 
    docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
    For Each oWorkPlane In docFile.ComponentDefinition.WorkPlanes
    'toggle all work planes
    If oWorkPlane.Visible = True Then
    oWorkPlane.Visible = False
    ElseIf oWorkPlane.Visible = False Then
    oWorkPlane.Visible = True
    End If
    Next
    Next
    
    iLogicVb.UpdateWhenDone = True

     

     



      solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.

    Please use plain text.
    Active Member
    Posts: 9
    Registered: ‎08-22-2012

    Re: ilogic and work plane visibility

    09-24-2012 11:01 AM in reply to: Curtis_Waguespack

    working with your sample 1

     

    user defined planes are not switching.

     

    if I make a offset plane from orgin plane xy when I run sample 1 the plane I created is unaffected by this rule.

     

     

     

    Inventor 2013
    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,964
    Registered: ‎03-08-2006

    Re: ilogic and work plane visibility

    09-24-2012 11:25 AM in reply to: david.campbell

    Hi Diswill,

    Sample#1 should have worked for your original request  "plane visibility is changed to false in all sub assemblies and and parts.", but if you have user workplanes at the top level assembly as well, then you might need to add a few lines to look at the workplane collection in the top level assembly,  as in example #3 below.

     

    Again the issue could be with locked design view representations as well. It's difficult to guess without more details, but hopefully this example will help you work it out.

     

    I hope this helps.
    Best of luck to you in all of your Inventor pursuits,
    Curtis
    http://inventortrenches.blogspot.com

     

     sample rule #3

    'get user input
    oInput = InputRadioBox("Select workplane visibility:", _
     "Turn ON workplanes for all components", "Turn OFF workplanes for all components", "True", "iLogic")
    
    'Define the open document
    Dim openDoc As Document
    openDoc = ThisDoc.Document
    
    'toggle work planes in the open document (top level assembly)
    For Each oWorkPlane In openDoc.ComponentDefinition.WorkPlanes
    'toggle all work planes
    If oInput = True Then
    oWorkPlane.Visible = True
    ElseIf oInput = False Then
    oWorkPlane.Visible = False
    End If
    Next
    
    'Look at all of the files referenced in the open document
    Dim docFile As Document
    For Each docFile In openDoc.AllReferencedDocuments                
    'format  file name                   
    Dim FNamePos As Long
    FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
    Dim docFName As String 
    docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
    For Each oWorkPlane In docFile.ComponentDefinition.WorkPlanes
    'toggle all work planes
    If oInput = True Then
    oWorkPlane.Visible = True
    ElseIf oInput = False Then
    oWorkPlane.Visible = False
    End If
    Next
    Next
    
    iLogicVb.UpdateWhenDone = True
    
    

     



      solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.

    Please use plain text.
    Active Member
    Posts: 9
    Registered: ‎08-22-2012

    Re: ilogic and work plane visibility

    09-24-2012 12:04 PM in reply to: Curtis_Waguespack

    Please let me claifiry

     the current code I have is

     

     

    'get user input
    oInput=InputRadioBox("Select workplane visibility:", _
    "Turn ON workplanes for all components", "Turn OFF workplanes for all components", "True", "iLogic")
    'catches planes in current assembly
    IfoInput=FalseThen
    'define document
    DimoDocAsAssemblyDocumentoDoc=ThisDoc.Document
    'look at the workplane collection
    For EachoWorkPlaneInoDoc.ComponentDefinition.WorkPlanes
    'toggle all work planes off
    IfoWorkPlane.Visible=TrueThenoWorkPlane.Visible=False
    End If
    Next
    ElseIfoinput=TrueThen
    'define document
    DimoDocAsAssemblyDocumentoDoc=ThisDoc.Document
    'look at the workplane collection
    For EachoWorkPlaneInoDoc.ComponentDefinition.WorkPlanes
    'toggle all work planes on
    IfoWorkPlane.Visible=FalseThenoWorkPlane.Visible=True
    End If
    Next
    End If
    'catches some planes in subassemblies
    'Define the open document
    DimopenDocAsAssemblyDocumentopenDoc=ThisDoc.Document
    'Look at all of the files referenced in the open document
    DimdocFileAsDocumentForEachdocFileInopenDoc.AllReferencedDocuments
    'format file name
    DimFNamePosAsLong
    FNamePos=InStrRev(docFile.FullFileName, "\", -1)
    DimdocFNameAsString
    docFName=Right(docFile.FullFileName, Len(docFile.FullFileName)-FNamePos)For EachoWorkPlaneIndocFile.ComponentDefinition.WorkPlanes
    'toggle all work planes
    IfoInput=TrueThenoWorkPlane.Visible=True
    ElseIfoInput=FalseThen
    oWorkPlane.Visible=False
    End If
    Next
    Next
    iLogicVb.UpdateWhenDone=True

    browser.png

     

    However when I open Assembly 2 the plane appears to be toggling correctly. It just appears not to reflect correctly up to assembly1.

     

    How do I fix?

     

    Thanks in Advance

    Inventor 2013
    Please use plain text.