algorithmic modeling for Rhino

Hi all,

Having issues copying a brep from one plane to (two)plane(s).

I have a brep I want to copy from the TrunkPlane to  the BranchPlanes:

I am obviusly doing something wrong(Acces the planes in the loop).

Maybe somebody think its worth a look.

Ah, and also the planes are in the wrong place:


Views: 820


Reply to This

Replies to This Discussion

Can you clarify what you are hoping to get out of the script?

Is it something like this?

If not, then maybe perform the operation in Rhino and post a screenshot..

Also, can you indicate what sort of data structure you'd like at the end? Are you looking for something like this:

{0} -One geometry (purple)

{0;0} - One geometry (dark blue)

{0;1} - One geometry (dark blue)

{1;0} - One geometry (light blue)

{1;1} - One geometry (light blue)

{1;2} - One geometry (light blue)

{1;3} - One geometry (light blue)

{2;0} - One geometry (green)

{2;1} - One geometry (green)

{2;2} - One geometry (green)

{2;3} - One geometry (green) ... etc


{0} -One geometry (purple)

{1} - Two geometries (dark blue)

{2} - Four geometries (light blue)

{3} - Eight geometries (green) ...etc

Well ... what about Plan Z(illions)? Marry the princess > get the zillions > go to Monaco .

But if you insist:

1. First: these little square pieces are Breps (trimmed surfaces) meaning that are portions of something bigger meaning that the U/V at (0.5, O.5) is outside the BrepFace boundaries meaning ... Armageddon. If on the other hand you are after an "auto location" of pockets  ... that is possible but requires several lines of code (and as Tom [the wise Ducati lover German] would ask: why ???).

2. Second: well ... what is the purpose of the nested loop?

3. Third: what is the scope of this? Copy the Y shaped thingy (2 times, then 3 times then ...) and do a collection of Y thingies? (sampled in a DataTree of thingies)  If so why they overlap?

Answers to: The Lord, Apartment 666, District 9, North Pole.

Hi Matthew,

Hi Peter,

Sorry for explaining myself really bad(once more).

I will try it again:

Well the internalized Brep was just a fast drawn Testpiece(to be replaced), i want to get something simple like this I saw some days ago here:

(should have posted it, was monday morning here(sorry)), hehe

How I understand it is:

1) copying itselfs on the TrunkPlanes to BranchPlanes

2)than cheking for intersection with a mesh and itself before putting(or not).

They dont need to be fitted in each other like in Matthews drawing(thanks for your time man!).

To Peters questions:

No princess in Monaco for me, to boring.

1) well i will draw the srf by hand to have them untrimmed( for training I try it by codein a separate code), just to not overcomplicate things at the moment(didnt knew Tom likes Ducati).

2) thought to access both(Trunk,- ans BranchPlanes) to Copy the Brep on them they need to be in a nested loop.

3)Will change the piece later, this one supplied was just to see if it works(Next time will think better before post some generic).

Thanks guys,


No princess means no Lambo as well (think about that: I would recommend a LP-550 Balboni)

1. If you have a BrepFace try AreaMassProperties (or get the outer Loop and find the centroid). But in general this "pocket" is made prior to that phase thus dealing with that must follow a different approach.

2. Recursion is required here (get N deliver N+1). But ... the big thing is that if you attempt to copy the same item a zillion times you'll discover the hard way that this is NOT the way to go (place instance definitions is the only solution - obviously via code)

3. If you do the piece the parametric way (the right thing to do) you'll need to define an instance definition first and then (and only then) multiply it  Z times.

Moral1: Be a pro > NEVER copy the same thing Z times.

Moral2: Stick to Plan Z

And this is the right moment for a walk to the wild side (kinda driving a LP-550 properly [sideways + no electronics]).


And here's the ultimate challenge for you: Using the previous thing and that one > take the challenge and do a proper sardine tree (only for the brave).

I hear you: what all these have to do with my initial question? Well ... that's the 1M question, he he.


First of all thanks for your time!

Think, i got it,

writng a xform function outside(pFrom pTo) and a

    if(loop >= maxLoops) return;
    MakeLines(ref  lineTree);

thing outside to place the blocks(wtf happened to Tiara?) recursively on their planes.

Now its time to Frankenstein it all together,hehe.

I hear you: what all these have to do with my initial question? Well ... that's the 1M question, he he. 

Nope, wasnt me you heard, think its clear, thanks for the DataTree challenge!

btw: princess and Lambo- real man here just need botas y sombrero

1. First get the max of all lines (as List: say lines) and then define a List of scales (and the planes) as follows:

List<double> scales = new List<double>();

List<Plane> planes = new List<Plane>();

foreach (Line line in lines) {

  double length = line.Length;

  scales.Add(length/max); // the max line yields a 1:1 sardine

  Plane plane = new Plane(line.PointAt(0), line.Direction);

  planes.Add(plane); // sardines "along" Z axis (read below)


2. So we have planes to put the hot stuff and scales to scale the hot stuff. Remember that the instances should be placed at Plane.WorldXY with the sardine "along" Z (you can randomly rotate the planes [ZAxis] as well).

3. Then use a classic Plane to Plane transformation to place (and then scale) a sardine instance definition. Keep in mind that this works only with Da Morgada stuff.

NOTE: Some mods are required in the C# that does the instance placement in order to accept the predefined scale values (it works using random stuff or steady stuff but not a collection of user provided scales [life sucks]).

Moral: Math.Pow(LOL, LOL);

BTW: If you succeed on that ... then (maybe, just maybe) you'll be ready for the next step: the notorious SardineChaos (TM) (C) collection of C# defs by the Lord (Himself) where WOW sardine related things happen.


  • dancing with sardines
  • maelstrom on sardines
  • brep stripes from sardines
  • sardine stripes from breps
  • sardine domination
  • sardine Apocalypse
  • ...

To go back to the initial thing,how I understand, to get the stacked thing like Petras I shouldnt scale the lines(cause pieces wouldnt fit together anymore)

I would try it get done in a recursion with blocks from PlaneWorldXY to next BranchPlane available.

So PLan is:

1)xform function outside the MainCode

2)getting PLanes and Z line direction of Planes(Not sure: needs to be in the funtion(not in MainCode), right?)

(3)checking for intersection in Maincode)

4) Placing Sardines(blocks) in the MainCode

Any hints/suggestions?

1. Recursion is ALREADY done with the tree like graph. No need to approach this recursively ... since you have a recursive result on hand.

2. If you intend to respect the graph (as a tree) then several changes are required in the C# that place the instances. Avoid (for the moment).

3. Get the line graph > make a List of planes/scales AND slightly modify the C# in 2 to accept equal number of scale values to the number of planes.

4. Placing sardines WHILE respecting clash issues between them is NOT a thing to attempt at present time.  

The scope of the sardine tree is to get the gist of the instance definitions AND NOT to create the perfect sardine tree. There's plenty of time later on to exploit complex techniques to do that.

ok, thanks, think o got it now, hehe.

Will start at lunchtime.






  • Add Photos
  • View All

© 2018   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service