Create Block References

Hello everyone! I’m trying to transform a table into blocks. To do this, I exploded the table and successfully selected the elements in model space. Now I need to create blocks from these selections, but I’m struggling with that. I’ve only found nodes that require a source block to create a Block Reference, but I don’t have a source block — I’m trying to create a new one. Is it possible?

As I sayd, I selected the model elements with a @jacob.small script (Thanks a lot, by the way), but my second script, which is supposed to transform these elements into blocks, is not working.

Drawing2.dwg (1.1 MB)

Block Creation.dyn (96.5 KB)

In newer builds (not sure which version of Civil 3D you’re in) you should be able to do “Block.ByName” or something along those lines to either get an existing block or create a new one. Look in the “Block” section of the library and there should be a constructor (green plus sign) or method (red lightening bolt) for it. Once you have the block you’ll be able to create objects in it as if it were new.

What you’re actually after here isn’t clear though - it seems only partially thought out; not to say you haven’t done work or aren’t thinking here, but that you only put half of the actions into play.

Are you making new objects in the new block, making a new block reference thereto, and then removing the previous objects? In which case you might have properties and such to deal with after moving things (good luck with any dynamic block references and such).

Or are you trying to move the objects you exploded into a new block, leaving the resulting objects in place? If so, remember that your origin is likely many many many many many many many units away from the objects, and therefore you’ll have oddball extents on the new instances.

I used ‘Block.ByName’ and created the blocks. The problem is that I can’t create objects inside them. Your second option is exactly what I want: just move the objects into the created block. I found a topic where you used a node that transforms geometry into blocks, and it seems to be exactly what I need, but it looks like this node is no longer available.

You likely don’t want this; as an example, the text notes in your table don’t return geometry (or they return something like a point instead of the text which you’re seeing).

I am not aware of a node to move objects into a block, so you might have a long road ahead of yourself to build such. First thing I’d recommend is getting the usual packages for AutoCAD automation in your version, and then looking closely at each node in the Objects section of the library.

Hello, Jacob! You’re right, this node wouldn’t help me with this. Since I wasn’t able to use native nodes to create blocks, I managed to do it using ‘Document.SendCommand’ from Camber, simulating a ‘COPYBASE–PASTEBLOCK’ process, exactly the same way I used to do manually. Thanks a lot for your help!

1 Like