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.
Placing blocks at the bottom point. And I want to size it depending on the distance between upper and lower point.
I’m able to place the standard block, but unable to change its size.
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.
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.
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).