iLogic - turn on/off parts

iLogic - turn on/off parts

jmckone9Z5PD
Contributor Contributor
280 Views
8 Replies
Message 1 of 9

iLogic - turn on/off parts

jmckone9Z5PD
Contributor
Contributor

Recently, I have been experimenting with iLogic to (hopefully) simplify some window assemblies and the various options within.

 

I have a window type that has 3 exterior size options, 5/8", 2" and 3.5" cladding.   A user parameter called 'Exterior_Options" has been created with the three size options (multi-variable list).  The tutorial video that I am using as a guide uses the function:

Feature.IsActive("Part1:1", "featurename")

 This does not seem to be the correct function as I am not trying to turn on/off a feature within the part, but the actual part in the assembly.  My guess is the logic should look like:

(repeated for 2 and 3 1/2 and with something like Part.IsActive (or example)):

If Exterior_Option = "5/8" Then
	Feature.IsActive("1201-P Mainframe Head & Sill .625") = True
	Feature.IsActive("1201-P Mainframe jamb .625") = True
	Feature.IsActive("1201-P Mainframe Head & Sill 2") = False
	Feature.IsActive("1201-P Mainframe jamb 2") = False
	Feature.IsActive("1201-P Mainframe Head & Sill 3 1/2") = False
	Feature.IsActive("1201-P Mainframe jamb 3 1/2") = False

 

0 Likes
281 Views
8 Replies
Replies (8)
Message 2 of 9

kacper.suchomski
Mentor
Mentor

Hi

Parts and subassemblies are components, and their state is managed by the command

Component.IsActive("Part1:1")

Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Message 3 of 9

jmckone9Z5PD
Contributor
Contributor

I made the change from from Feature.IsActive to Component.IsActive which now works.  Is there any way to use the folder rather than the parts?

 

jmckone9Z5PD_2-1758395844072.png

 

 

0 Likes
Message 4 of 9

kacper.suchomski
Mentor
Mentor

@jmckone9Z5PD wrote:

I made the change from from Feature.IsActive to Component.IsActive which now works.  Is there any way to use the folder rather than the parts?

 

jmckone9Z5PD_2-1758395844072.png


No. Folders are a UI element; they aid the user in navigation. Folders are not a structural element of the project.


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 5 of 9

jmckone9Z5PD
Contributor
Contributor

I expected as much but wanted to be sure.  Now that I have some basic idea of how things work, I will look for a tutorial to get a better understanding of what the functions do.

 

Thanks for the help.

 

 

 

 

0 Likes
Message 6 of 9

Curtis_Waguespack
Consultant
Consultant

 


@jmckone9Z5PD wrote:

 Is there any way to use the folder rather than the parts?

 


@jmckone9Z5PD , here's are a couple of quick API examples you can use in an iLogic rule. 

Hope that helps, Curtis


Curtis_Waguespack_0-1758576827603.png


 toggle suppression of all components in the folder on/off.

Dim oPane1 As BrowserPane = ThisDoc.Document.BrowserPanes("Model")
Dim oFolder As BrowserFolder = oPane1.TopNode.BrowserFolders.Item("MyFolder")
Dim oFolderNodes = oFolder.BrowserNode.BrowserNodes
Dim oOcc As ComponentOccurrence

For Each oNode As BrowserNode In oFolderNodes
	oOcc = oNode.NativeObject
	'toggle on/off
	Component.IsActive(oOcc.name) = Not Component.IsActive(oOcc.name) 
Next


 suppress all in folder

Dim oPane1 As BrowserPane = ThisDoc.Document.BrowserPanes("Model")
Dim oFolder As BrowserFolder = oPane1.TopNode.BrowserFolders.Item("MyFolder")
Dim oFolderNodes = oFolder.BrowserNode.BrowserNodes
Dim oOcc As ComponentOccurrence

For Each oNode As BrowserNode In oFolderNodes
	oOcc = oNode.NativeObject
	'turn off
	Component.IsActive(oOcc.name) = False
Next

 

EESignature

Message 7 of 9

jmckone9Z5PD
Contributor
Contributor

This is interesting.  It would save a lot of work since most options are arranged by folder.

I will give this a try in a few days when I finish my current experiment with iLogic.

 

I appreciate that my original post was forwarded to the programming form, and an reply was promptly received.

Message 8 of 9

WCrihfield
Mentor
Mentor

Here is just another way to 'Toggle' the suppression status of all components in a browser folder in an assembly.  This also first gets the browser folder, but then, instead of iterating through each item within it, it just selects that folder, and runs a 'command' on it.  This way of doing things is more like 'simulating user interactions' than it is true iLogic or API, so not as controlled, but still useful sometimes.  Because when we manually select that folder, and right-click, we have that command in the context menu.  This will only work with the currently 'active' document though, not on referenced documents in the background.

Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
Dim oPane As BrowserPane = oDoc.BrowserPanes.Item("Model")
Dim oFolder As BrowserFolder = oPane.TopNode.BrowserFolders.Item("Group1")
oDoc.SelectSet.Clear()
oFolder.BrowserNode.DoSelect()
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyCompSuppressionCtxCmd").Execute()
oDoc.SelectSet.Clear()

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 9 of 9

jmckone9Z5PD
Contributor
Contributor

Within the assembly drawing there is the 'Default' view and a newly created 'iLogic' view that will be used to create drawing sections.  Is there some way to fix the 'Default' view so when section drawing are created the 'Default' view is not changed?

0 Likes