Help in batch orienting blocks script

Hi there,

In a recent project, I needed to use a large amount of blocks (strut members) to represent the truss of a space frame column.

The way I did it was just to make one block with struts in it, then scale that block.
However, when doing so, the struts become distorted.


This was the original block with the struts being round.


And this is the frame being distorted because it’s stretched in the X direction. Note the flattening of the small web struts.

It got me wondering; what if there was a way to take the strut block, and batch orient/copy it to the centerline curves of all the struts within the original frame block…

Basically, take all the distorted frame blocks which have centreline curves for the struts, then explode them, copy the curves, and orient the separate strut block to all of those curves in their positions.

This would allow the shape of the frame to distort, but for the blocks to remain the same diameter with only 1D distortion.

Another forum member was kind enough to make a script which almost achieves it perfectly. They posted it here: https://discourse.mcneel.com/uploads/short-url/qL7zLDtHcwrPBN2UdfEvfD0KkEj.gh

Here is the test file; which I cannot get past this stage:
Batch Orient test.3dm (4.0 MB)
ProportionalOrient3.gh (17.2 KB)

Any thoughts or help would be much appreciated

-Jeremy

I’m just wondering, wouldn’t be easier to just use those axis-curves to rebuild geometries from scratch, instead of orienting other geometries?

for instance, the red lines extrude a rectangle along, and the purple lines used as axis for pipes?

sample.gh (12.4 KB)
of course you could just rebuild one single of those for each type, and orient the others

1 Like

Hi Inno, thanks so much…

I really want to be able to do this with blocks… scale 1D or scale 3D.

This means that the strut block will be transformed as such, but I can still have control over the original block, and the file size will remain relatively small.

This will be useful for larger projects where i need thousands of the struts; and I don’t want to have thousands of original geometries; but just one strut block put in different locations with scale 1d or 3d :slight_smile:

Do you think that your script might work with blocks and scale1 or scale3d?

Cheers,
Jeremy

there’s something I’m not catching here… you start with a single block that contains both the correct solid geometries (pipes and thickened L-sections) and their central-axis-lines

you have populated a drawing with that single block, in such a way the block is either scaled in 3D or scaled in 1D

so of course you get a weird scaling on the 3D geometries that are scaled 1-D, but their central-axis-curves are still a good reference

at this point: I’m missing a step :slight_smile:

if I have understood correctly, you want to take each instance of that block, and re-scale its own 3D geometries in such a way they don’t “suffer” anymore the 1-D scaling… and then what do you do with those?
I ask because each block that was scaled its own way, still contains the 3D geometries of the original unscaled one
what I mean is, due to the fact that for each different scaling you will end up with different 3D geometries, in which container are you planning to put the correct geometries?
each scaling will produce a different variation of 3D geometries, wouldn’t it?

1 Like

Hi Inno,

Sorry about my communication, I will try to be more clear.

The idea is the following.

  1. Make a block which has only curves. Then you can copy and distort that block any way you want like; such as scale, shear etc.

  2. Temporarily explode the blocks into the curves. Copy the curves, undo the block explode, paste the curves, put these raw curves on their own layer. Turn off the layer with the blocks of curves.

  3. Now using these curves, I want to put a strut block which follows each of the curves; and scales either in 1D or 3D (option). In the image below, I manually oriented all the blocks to the curves with 1D scale for illustration

So the important point is this.
If I explode the blocks of curves; AND THEN Orient/copy the strut block to all the curves, they wont be distorted according to the transform on each of the curve blocks like in the first image.
The struts will remain ‘pure’ and simply adjusted by the original strut block.
The strut blocks are simply placed in space by the guiding curves; and scaled by the relative length of the guiding curves compared to the original strut centerline curve.

Not sure if this is clearer… haha

Cheers,
Jeremy

Hi inno,

Just wondering if the post I made makes sense about the idea?

Best,
Jeremy

yes, I got a clearer idea on what you want to do :slight_smile:

the main point is: you start with a single block that contains both curves and 3D geometries

this block is used many times in a drawing, and it is somehow deformed, scaled ecc etc, so you are interested in its curves as they define the central axis of your 3D geometries

you want to take those curves in order to be able to rebuild geometries around those

by analyzing your starting undeformed block, you are able to extract data like line L0 is the axis of a pipe of radius R0, then line L1 is the axis of pipe with radius R1 and so on… so you can easily get a complete map of the geometries that are built around each axis-curve

is there a particular reason for wanting to orient and scale those original geometries that were part of the original block into the new one?
isn’t it just easier to rebuild those geometries with correct sizes, given the thing that you have all those data?

apart from that, when your main block made of lines is scaled around the drawing, it will produce a (bigger or smaller) finite number of different variations: do you want for each variation to insert a new block containing the corresponding updated 3D geometries? or want to get those -updated- 3D geometries as Rhino geometries in some layers?

what output would you expect to bake in Rhino?

Hi Inno :slight_smile:

The usefulness of this idea is to treat the building curves and final solid arrangement as seperate entities which can be organised.

With the curve block, I might want to make a narrow and tall truss column. Or, I might make a short and wide one.

Separately, I know that the web of any of these trusses uses a particular metal angle. This metal angle can be longer or shorter, but it has to be a particular shape.

This is why I need to treat the curve block and the extrusions separately.

If I was to place these extrusions in the original curve block, they would be distorted.

But if I move and distort the curve block, explode it, then orient a separate angle strut to all those exploded curves, the angles will appear correct.

“is there a particular reason for wanting to orient and scale those original geometries that were part of the original block into the new one?”

There is no need for anything in the original curve block except the curves for distortion. One could include other stuff which can be distorted, so long as the curves for orienting can be extracted

“apart from that, when your main block made of lines is scaled around the drawing, it will produce a (bigger or smaller) finite number of different variations: do you want for each variation to insert a new block containing the corresponding updated 3D geometries? or want to get those -updated- 3D geometries as Rhino geometries in some layers?”

Ideally, the strut block can be oriented (copied) and have the option for scaling (1D or 3D).

It can then be oriented (copied/scaled) either within the distorted block; which means that it will distort according to the curve block…

Or, the distorted curve blocks can be exploded leaving just the curves. Then the strut block can be oriented (copied/scaled) to the curves around the drawing. This means that they will only have true 1D or 3D scaling… without the added distortion of the curve block (because it’s exploded).

“what output would you expect to bake in Rhino?”

I believe that it’s very similar to the Orient or Orient3D commands; just as a batch. The inputs would be

  1. geometry (could be true geometry or block, perhaps other rhino data like annotations?)
  2. reference curve
  3. target curves

The Reference curve and target curves are used to find the planes, orientation, and scaling of the geometry.

The baked output is the same as the input geometry. It could be baked to the input layers of the geometry, the current layer, or a target layer.

Reason for doing this.
I can think of 4 advantages of this

  • the file size is small
  • the original strut block can be modified; updating all the block definitions
  • if one wants to create randomness like in nature, each block can be slightly scaled randomly, or rotated randomly en masse. Good for landscapes.
  • Otherwise, the true strut is good for engineering representation where the

Batch Orient test.3dm (2.7 MB)
ProportionalOrient3.gh (19.2 KB)

Best,
Jeremy

this is what I understood

you have a reference geometry and a reference curve, in this case a pipe with its central axis:

and you want to “apply” this pipe to other straight curves in such a way its diameter is always the very same as in the reference geometry, but for some reason you don’t want to build new pipes but just scale-1D and orient the existing one

for instance, let’s apply that pipe to these block instances, which share the very same basic block definition which is scaled in 1D or 2D or 3D, so -basically- the 3 block instances have very same order of the curves they are composed of:

an easy way to do so is this:

you take the reference curve, measure its length, measure the length of the destination curves, scale the original pipe geometry along its axis until it becomes as long as the destination curves, then orient it on the destination planes

what if you have different sections to be applied to your deformed block instances? Like pipes but also L sections and generally any given brep?

well, in this case my best guess is that you could build geometries that define the final sections around the original Block curves, for instance like this, where geometries are “read” around the original block curves, and scaled+oriented on the respective destination curves

scale+orient_block_to_block_inno.gh (105.6 KB)

1 Like

Hi Inno, thanks so much for your help :slight_smile:

you don’t want to build new pipes but just scale-1D and orient the existing one

This is because often it’s not a pipe which I want to build. So I can’t use the pipe command or pipe component in GH.

For example; this project required struts which approximated strut members from a crane.


Can you see how the ends are tapered in? This was just a rough approximation of a space-frame strut leading into a ball joint (not shown). This, like most other instances, benefit from having a ‘parent’ block which can be oriented/scaled to all of those other target curves. Cause then the block can be any type of geometry/shape.

I will check out your GH script hopefully tomorrow… looks really nice… I really appreciate your effort and help.

Cheers,
Jeremy

I undestand the point, but also in your example with tapered ends, when you scale tapered extrusion 1-D in such a way it becomes five times longer, then that taper will look very much wrong and too much long

for this reason I still believe that the best solution would be, for each geometry that you have along each edge, not to scale 1-D and orient, but to take sections, and rebuild the geometry over the destination lines

you will know already if you have any kind of “modifiers” to be applied on some of those, for instance you might now that lines at index 5,6,7,14,21 of your block need a tapered end at 150mm from the line-ends… and that is something you can achieve correctly if you rebuild the geometry
but it’s something you won’t get with scale 1-D and orient

if you can post the above strut with its axis-curves I’d be happy to have a look

1 Like

You are right about the 1D distortion of the strut members. This becomes especially apparent when the scaling of the strut member gets further away from the scale of the original one.

So if accuracy is vital for the required drawing scale, then this method wont work; and the geometry would need to be built for each strut member using true dimensions and indexing as you mention :).

However, for drawings which are zoomed out; the accuracy of the strut proportions might not matter or be visible.
Let’s say, you had a 1:50 drawing, you might not be able to see the distortions of 0.5 to 2x original scale for the tapered ends. But on a 1:5 construction detail, the accuracy of the strut is much more important; and each strut would have to be done individually with true dimensions.

I would probably have a layer or even separate file for the accurate struts for the 1:5 construction detail; which could specify the exact dimensions of the connections and distance of the tapering etc.

But for the more zoomed out drawings, the Oriented/scaled block versions of the strut would be used, and would keep the file size much smaller.

Just imagine having thousands of these blocks arrayed over a 1:500 scale drawing. If each strut was modelled individually, the file size would be quite large, and any modification wouldn’t update to each strut. This is unless it can be paramaterised through GH!?

I’ve just played around with your script, and it’s working a treat for the blocks! Made some very slight modifications to the script.


Is there a way to make it so that GH recognises updates made to the input block? Currently, a modification to the block requires one to ‘re-set’ the original input block into GH.

I put the strut in this rhino file.
Batch Orient test.3dm (2.7 MB)
scale+orient_block_to_block_inno.gh (108.5 KB)

-Jeremy