Hi,
Is there a way to make a number of closed curve geometries into blocks in one batch rather than having to block command each one which is very tedious with multiple parts?
Thanks in advance
Hi,
Is there a way to make a number of closed curve geometries into blocks in one batch rather than having to block command each one which is very tedious with multiple parts?
Thanks in advance
Hi Andrew - youāll need a script, I guess. How do you want to specify names and insertion points - if these are not somehow handled by the script automatically, I am not sure how much of an advantage it would be over just doing it one by one as you are now.
-Pascal
Hi Pascal,
Thanks for the speedy reply.
I guess just a consecutive number for the names?
If there was a way to be able to include any other objects encompassed within the closed curve, that would be ideal!
Basically, I am creating 2D patches for cutting on a CNC machine using the DXF AAMA format. The cutting machine requires that all parts must be defined as a block using a closed cut line that is on a layer named ā1ā,
So, it could be that the script uses the layer 1 as the block definition rather than simply the closed curve, but either way, it would be great if you could help me out with something like that?
Many thanks.
PS, slightly off topic, but I tried to find a way to do this in Grasshopper, but am I right in thinking there is no way to define a block in Grasshopper?
Cheers, Andrew
Hi Andrew - Iām happy to take a poke at scripting this, but it would be good if you can post or send me me a simple ābefore and afterā example so I have a better idea what Iām doing. Each curve in its own block, all blocks on layer ā1ā, or all curves contained by a curve in one blockā¦ ?
-Pascal
Hi Pascal,
Fantastic, thank you very much.
Attached is a VERY basic example. demo.3dm (64.0 KB)
There are two panels - both defined by the closed line on layer 1 in red.
On each panel are some plot lines (on layer 8) and some text (on layer 19)
Everything inside of the closed red curve on layer 1 needs to be in an individual āblockā, and all of the resulting blocks need to be on a new common layer (The default layer is fine, as long as it is not the same as the layers used to define cut, text or plot items)
Many many thanks, Andrew
Youāll need a plugin to work with blocks in Grasshopper. Havenāt used it myself, but check out Human.
Andrew, will the curves always be polylines?
-Pascal
Hi Pascal -
Mostly, although arcs can be used too.
Thanks for the tip gregb!
OK, well hereās a start- letās see if it does what you want. Use RunPythonScript and browse to where ever you save the py file. Weāll make it friendlier when it works the way you like it.
This one should work on all types of curves and contained text.
AutoBlocker.py (1.3 KB)
-Pascal
Hi Pascal,
Thatās awesome thank you!
If itās possible to give each block a consecutive object ānameā that would be perfect!
Thanks very much again for taking the time to do this!
regards, Andrew
I just tried the script on another file, but had this warning?
Thanks, Andrew
Hi Andrew - the thing is looking for curves and text only, so far - if you have the text as blocks, Iāll need to allow for thatā¦
-Pascal
Hi,
Very strange, I ran the test on the same file again and it worked just fine?
I did āpurge allā first, so maybe that flushed some things out?
Many thanks again!
Andrew
@solosails Andrew, hereās an updated, friendier (numbers the blocks, lets you set a base name) version, plus a compiled plug-in so you can just load it up once and have this command in Rhino
BatchBlock
AutoBlocker.py (2.1 KB)
BatchBlock.rhp (9.5 KB)
-Pascal
Pascal, I am indebted to you!
Thank you so much for developing that tool, it is incredibly time saving for me, and I hope others too.
Very best regards, Andrew
Ooh, one last requestā¦ (sorry!)
Is it possible to make it work with selected components only?
So that if you have an initial design model with various stages of unrolling and seam allowance adding etc, then you can just batch the developed components required, rather than it trying to search the entire file?
Thanks again!
Hi Andrew- It should be easy enough to make it work on selected objects but I need a better idea what you intend there - I made the thing look at Layer 1 and use that as the driver - anything on this layer is a candidate for an enclosing curve. How do you want to select - only selected inner objects and enclosing curves participate, or only selected enclosing curves are candidates and find anything inside themā¦ or? Do we still need to only consider Layer 1 objects as possible enclosing curves? etc.
thanks,
-Pascal
You are welcome - itās a teeny bit specialized for general use I think - I donāt know if there is a way to make it more useful āat largeā. Perhaps just making the user select outer curves only and ignore the special layer name that you use, and allow more objects to be the interior objects.
-Pascal