I have a couple of plates & beams that I want to make them into block individually, but then also grouping them altogether into one big block so that they can be scaled together in AutoCAD.
I could not figure out a way to do this, could somebody please help? Attached is the Grasshopper script that I used.
p/s: if possible, could you please show me how to colour each line differently as well? Currently it comes into AutoCAD as all black no matter how I try. Cheers!
SPECKLE.gh (16.2 KB)
Hi @Hung , two points:
-
in your current script, try creating an
Instance
from your first (nested) definition, and passing that instance into thegeometry
: https://latest.speckle.systems/projects/3f895e614f/models/647254f4e4@e5f1e77098
-
Coloring right now (afaik) is not supported in our legacy grasshopper connector out of the box: you can use a c# component to create a
displayStyle
object that contains the color and attach it to your definition geometry instead.
On this note, the Next-Gen Grasshopper connector (alpha) lets you assign colors easily, but currently does not have block support
We’ll be adding block support soon in our Beta release, I’ll let you know when that is ready!
Thank you Clare, it works!
Put the coloring aside, can we set the layer instead? So within a block definition, can different geometry be set onto different layer so that they will be placed onto that layer in AutoCAD?
There isn’t an easy way to set the layer in the legacy connector.
You’d have to place objects within a Collection
class programmatically, where the name of the collection corresponds to the name of the layer. For blocks this is even more complicated: you would need to include a dynamic layer
property on the geometry inside your block definition to get it on the correct layer.
You could try this with the extend speckle object
node in the legacy connector, before you pass your geometry to the block definition, and see if it works - this may get your definition objects on the right layer, but not the instances.
We currently don’t have block support in the Next-Gen alpha release of GH, but will be adding it for the beta. After beta is released, you should be able to easily add block geometry to specific layers with the Create Collection
node.
See this thread for reference on both: https://speckle.community/t/creating-collections-in-c-speckle-sharp-rhino-gh/18049/6