Tool: Purge Line Pattern (available as package)

I’ve just uploaded a package that certainly needs to be improved. I managed to make it work, but it’s a bit rough. In fact I need to learn Python a bit more than that…:slight_smile:

I tried to set the filter in Python code, with no luck. I also think the transactions may need some change. Let me know what you think; and feel free to share tips to improve the code.

purge line pattern

Hi Julien, that’s a very handy tool!

Since you said, that you’re open to suggestions: I have a few. :wink:

First of all, I usually try to use as little Python as possible. You could substitute your filtered element collector with a type selector to get rid of your first Python node.

Secondly, I think the functionality of deleting items from the model merits a package of its own, so I would make that into a separate custom node. Actually, thinking about this - it’s hard to believe there’s no built-in node for this. This should most definitely be a built-in node.

Also, I would try to anticipate the case where you only want to delete one item. I actually try to do that with most of my custom nodes, so they stay flexible. To that end, I made the Turn Into List node, that will force any input into a flat list - very handy if you want to pass items to a Python node but you don’t know whether it’s just one object or several or a list of lists.

And finally, I’m not sure if this may ever happen, but I imagine it might: if the delete command fails it might be nice if your graph would still evaluate. That is, of course, a matter of taste. I often use try/except to catch those types of errors and get a list of objects that caused the node to fail - see the attached screenshot of the Python code for details.

And another thought: To me, your custom node is more like a universal workflow for deleting any type of object. I wonder if it wouldn’t make sense to rather publish a node called Delete Objects From List By Name (or something like that) with a string and a list as an input.

python

Excellent! I had the nose to close from the sheet. I had difficulties to grab line patterns, and I totally forgot the Element types node!! of course Python is not needed here. You are right. I agree about the Delete node. Please publish it as yours. Once done I will publish a new version of Purge Line Pattern based on Element types node and your Delete node.

I did some tests, it could be very handy to clean files, etc… We got something big here: an addin killer!

No, Julien - your idea, your code, your node - you publish it.

Addin killer has a nice ring to it… :wink:

Package published. see notes inside.