Placing and transforming blocks in Grasshopper

Hey guys,

Im a newbie at grasshopper, so bear with me. I have a point cloud which I want to use for placing blocks, and constraining them between an upper and lower point. Right now I’m able to place the blocks, but been trying for some time to find a way to transform the blocks to the right constrain.

image
Placing blocks at the bottom point. And I want to size it depending on the distance between upper and lower point.

image
I’m able to place the standard block, but unable to change its size.

Appreciate some help!

The Scale NU component doesn’t support Blocks as far as I am aware. There are ways to transform blocks using I think the Human Plugin or the Legopod Plugin (used to be called Instance Manager). You will still use the Scale NU, but don’t; plug any Geometry and use the transform output. There should be something like Transform Block in Human or Legopod.

Be aware that Blocks are not officially supported in Grasshopper, therefore dealing with them is always a bit of a mess, but still possible. I am not on my PC right now, so I can’t show you. But if you look at those 2 plugins you will find what you need.

Roughly you need to: Evaluate the Block to get the bounding box of them > Get the height of the block > Get the distance between the 2 points > calculate the scaling factor > Use the Scale NU to create a matrix transform > transform the block. Of course, you do this for all lines individually.

Hope that helps a bit.

1 Like

See attached:

A rather simple entry level take on that matter (no nesting for instance) plus some demo instances to play around.

Instances_place_GPUCPUtests_35_V1.gh (157.3 KB)
Instaces_for_tests.3dm (5.0 MB)

Good news: places, scales (various options - see 3nd C#) and rotates Instance Definitions using either points or planes or a BrepFace. Like:


Bad news: is pure C# (life sucks).

NOTE: 2nd C# gets the available Instances per document and picks one for placing. 3rd C# does the Instance placing (almost real-time) BUT if there’s lots of them AND you have a crap GPU … prepare to cry. For instace placing 1000 Instances takes 50 ms (Using the trad ancient I5: slowest of my systems on duty for obvious reasons) … but the rendering part is another animal.

NOTE: If your pick some input option (i.e. points, planes, face) and the collection (or the face) is null then the 3nd C# aborts.

NOTE: variable Instances has meaning if you use a boundary (a BrepFace).

TIP: ALWAYS define your instances in Plane.WorldXY

Wow that seems very complicated. Ive been able to do the exact same procedure before, with scaling the blocks according to my line length/distance beteween dots. With similar approach that I screendumped.

My newbie grasshopper skills got a bit overwhelmed from your file. But thanks for help!

Far from it (relatively speaking). The 1st C# does some test data (so if you have your own you don’t need it). The 2nd finds Instance Definitions in the active document and the 3rd does the placement. What could be the difference if these were compiled things from some add-on? (None in fact, apart from the fact that any compiled thing is “sealed”).

BTW: The 2nd C# comes in various “versions”: here’s one with a preview (a Bitmap is created on-the-fly for the selected Instance Definition (user picks the size desired) and then “auto” loaded to the Image Sampler - if there’s any present in the canvas).

BTW: R is not suitable at all for any kind of Assemply/Component design schema … meaning dealing with nested Instances, display(s) on per hierarchy node(s), on-the-fly changing attributes (and store locations), relation scenarios, etc etc (so is 100% out of question for any contemporary pro level AEC/BIM approach).