Reassigning subcategories

I have a large set of detail component families which need elements moved from one subcategory to another. I thought it would be a fairly simple script, since I can create geometry and assign it to a subcategory, but I’m getting odd results in the detail component editing environment.

At first i tried using Element.SetParameterByName and got a variety of errors, each indicating I was feeding the wrong type of data into the node.

I then did some searching, and found that clockwork used to have a set subcategory node:

So I played with that code and again got a variety of error messages all of which indicated I was doing something wrong on a basic level. Did some digging and found that it had been lost along the way, so my guess was that it hadn’t been moved along with a good reason.

So as a last resort I tried grouping the IDs of elements with the bad line styles and sending them to the clipboard so I could paste all of the element IDs for the bad subcategory into a select by ID box and I get an error that these elements can’t be selected. Any ideas?

Screenshots attached.

Bumping this thread, something of a similar problem I’m looking into.

I retired this node at some point - if I remember correctly it was because of some changes in the way that Dynamo was handling categories after the 0.7 update. I actually have an open task to overhaul all of Clockwork’s subcategory-related nodes and this node is the only one I hadn’t done yet:

I’ll try to find the time to look at it tonight.

Thanks for this and the entire clockwork package Andreas.

1 Like

Fixed the node - you can download it here:
This will be in the next release of Clockwork (probably June).
Also, there’s a node in Clockwork called Subcategory.ByName that you can use to create or retrieve the desired subcategory.