iLogic and Folders (again)

iLogic and Folders (again)

jmckone9Z5PD
Contributor Contributor
349 Views
2 Replies
Message 1 of 3

iLogic and Folders (again)

jmckone9Z5PD
Contributor
Contributor

A few new issues.  I tried the code from previous post and changed the user parameters as required (obviously missed something).  I get this error and all folders containing parts are suppressed (patterns not affected):

 

[While I am at it - what happens if there is a folder inside a folder.  In this case each of the glazing folders (GlzDG8125, GlzTG1125, Glz1625) should have the Setting Blocks - DG/TG added to the appropriate folder. (in the case I could just delete the folders but like to keep things 'neat']

jmckone9Z5PD_0-1759929392912.png

 

Code:

jmckone9Z5PD_1-1759929538219.png

  Browser (Glazing Folders)

 

jmckone9Z5PD_2-1759929671085.png

 

0 Likes
Accepted solutions (1)
350 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant

@jmckone9Z5PD , try this update to add a try/catch to handle nodes that are not occurrence components

For Each oFolder In oPane1.TopNode.BrowserFolders
	'get the nodes in that folder
	Dim oFolderNodes = oFolder.BrowserNode.BrowserNodes
	'evaluate if folder matches parameter name and hold that value as true or false
	Dim FolderIsCranktype As Boolean = (oFolder.Name = oCrankName)
	For Each oNode As BrowserNode In oFolderNodes
		Try
			oOcc = oNode.NativeObject
		Catch
			Logger.Info("Could not get occurrence from node")
			Continue For
		End Try
		'set active status of occurrence to match the value of (folder name matches parameter value)
		Component.IsActive(oOcc.Name) = FolderIsCranktype
	Next
Next

 

0 Likes
Message 3 of 3

jmckone9Z5PD
Contributor
Contributor
Accepted solution

This fixed the folders that are named in the user parameters, however all other folders are suppressed.  While the folders are an improvement over the iLogic needed to turn parts on/off, it seems it will require more work than can be justified for the benefits.  Representations with model state/view accomplish the same thing and are easier to modify, just not as neat.

0 Likes