Use iLogic to delete folder and its content from model tree

Use iLogic to delete folder and its content from model tree

janosch.bernzottGMG7B
Community Visitor Community Visitor
582 Views
1 Reply
Message 1 of 2

Use iLogic to delete folder and its content from model tree

janosch.bernzottGMG7B
Community Visitor
Community Visitor

Hello forum,
is it possible to delete entire folders including the parts and assemblies in a large assembly with iLogic? The background is as follows:
I have a "master module" in which assemblies and parts are already structured in folders in the model tree. With iLogic I now want to create a small start configuration in which the first groups can be automatically deleted without clicking through the folders. As an example, there are two folders for the "left" and "right" direction, which are selected via an input mask to start and then the corresponding unwanted folder is to be deleted.
Thanks for your help and best regards
Janosch Bernzott

 

Hallo Forum,
ist es möglich ganze Ordner, inklusive der Teile und Baugruppen darin, in einer großen Baugruppe mit iLogic zu löschen? Der Hintergrund ist folgender:
Ich habe ein "Mastermodul" in dem Baugruppen und Teile schon in Ordnern im Modellbaum strukturiert sind. Mit iLogic will ich jetzt eine kleine Startkonfiguration erstellen, in der die ersten Gruppen automatisch gelöscht werden können, ohne sich durch die Ordner zu klicken. Als Beispiel gibt es zwei Ordner für die Laufrichtung "links" und "rechts", die zum Starten über eine Eingabemaske ausgewählt werden und dann der entsprechend unerwünschte Ordner gelöscht werden soll.
Danke für eure Hilfe und viele Grüße
Janosch Bernzott

0 Likes
583 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

If you can do what you are trying to do manually, then you can most likely do it by code also.  Navigating the model tree by code is usually not a fun, or simple task though, depending on the situation.  Sometimes when you delete a sub-folder which contained some things, those things which were within, just get dumped back into the parent folder of that sub-folder.

It's usually best to use a separate 'recursive' sub routine to check the 'Count' property of the BrowserNode.BrowserFolders and/or the BrowserNode.BrowserNodes, to see if there are any 'child' items, then if there are, attempt to deal with them, while also checking them too for 'child' objects, then invoke itself (the same routine) to deal with it.  Stepping down through as many layers as is needed to get to the bottom of the ladder.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)