Inventor General

Reply
Active Member
rjones0215
Posts: 9
Registered: ‎10-01-2011
Message 1 of 26 (1,280 Views)
Accepted Solution

ilogic and work plane visibility

1280 Views, 25 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
Distinguished Mentor
swordmaster
Posts: 535
Registered: ‎12-15-2008
Message 2 of 26 (1,275 Views)

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
*Expert Elite*
Curtis_Waguespack
Posts: 2,566
Registered: ‎03-08-2006
Message 3 of 26 (1,260 Views)

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.





Distinguished Mentor
swordmaster
Posts: 535
Registered: ‎12-15-2008
Message 4 of 26 (1,255 Views)

Re: ilogic and work plane visibility

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

Nice rule Curtis

Inventor 2010 Certified Professional
Active Member
rjones0215
Posts: 9
Registered: ‎10-01-2011
Message 5 of 26 (1,236 Views)

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
Active Member
Posts: 10
Registered: ‎08-22-2012
Message 6 of 26 (1,129 Views)

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
*Expert Elite*
Curtis_Waguespack
Posts: 2,566
Registered: ‎03-08-2006
Message 7 of 26 (1,117 Views)

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.





Active Member
Posts: 10
Registered: ‎08-22-2012
Message 8 of 26 (1,103 Views)

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
*Expert Elite*
Curtis_Waguespack
Posts: 2,566
Registered: ‎03-08-2006
Message 9 of 26 (1,096 Views)

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.





Active Member
Posts: 10
Registered: ‎08-22-2012
Message 10 of 26 (1,087 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube