Create Rectangle around centre point

I’m sure this is a easy task but I can’t find a neat solution. I’ve got a list of lines that I have used to generate walls, and I’m wanting to create callouts centred on each of these walls, so I need to create a rectangle to use as the callout extents.

I was hoping I can get the midpoint of the line, and create a rectangle centred on that, but my initial attempt was incredibly messy and longwinded, so I scrapped that.

1 Like

@dan.buckingham .

i did this way


grafik
KR
Andreas

  1. Create the rectangle at the origin, using a Rectangle.ByWidthHeight node which takes a plane as an input; depending on the orientation desired you’ll want either Plane.XY, Plane.YZ, or Plane.XZ as the plane input. My gut says Plane.XY though.
  2. Take the curves which define the wall and pull the coordinate system at parameter 0.5, which will be the midpoint as lines are uniform.
  3. Transform the one rectangle by each coordinate system.
  4. Break for coffee and a job well done.
1 Like

Sounds perfect, thanks!

Beats my method of translating the line up and down, and then getting the start & end points of those line, and trying to create a rectangle from them!

@jacob.small right, got the rectangle sorted on the XY plane, got the midpoint of the wall line (as a point), how do I transform the rectangle? I’ve not used this kind of geometry handling before.

Ooo, I might just have it!

If you wanted to move a geometry from the origin to a point, you can change the point to a vector using a Point.ToVector node, and then use a Geometry.Translate node which takes geometry and direction as the only inputs.

You don’t want to do that though as the rectangles won’t rotate to match the curve. You could rotate the rectangles before/after, but that’s extra work. Instead you want to Transform the geometry, which takes a coordinate system as the input.

Should look something like this:

1 Like

Ah I see thanks.
In my particular use case here, all my walls are in the same orientation. Its a bit of an odd workflow, but I’m essentially generating small sections of each wall type in an Admin phase prior to the Existing phase, and using that to report “semi-live” taggable info, rather than using the clunky Revit legend system.
Seems so silly that we can’t tag legend components! I understand due to them not containing instance information, but that is a topic for another day…