As the title suggests, I’m looking for a way to set the insertion point of my profile views relative to my design. One idea I had was to select the property boundary closed polyline and use the centroid as a starting point then offset the x, y coordinates by a set amount. I’ve come to learn that I cannot get the centroid of a closed polyline, only a polygon.
If anyone has a way a solution, even if it isn’t following the same line of thinking i.e. centroid and shift, I would appreciate the insight.
Maybe you could get the bounding box of the elements within the project limits and then use a corner of the bounding box (or the centroid) to be the origin for your shift. Do you know how to work with bounding boxes?
What I generally do is pick a line along which i need my profile views to be align.
get the start point of that line and place your first profile view at that location
and other profile views can be placed with respect to that point keeping x constant and changing y value as per bandsets overlap dist etc. Just like autocad section view
User have to select the line and all profile views will be placed on model along that line.
Thanks for replying, I thought of a similar solution, but the idea of manually grabbing a point in model space to enter into dynamo felt antithetical to the spirit of solving the problem programmatically.
Every object (or collection of objects) fits within a bounding box that is aligned with the world X and Y axes. You can get the bounding box of an AutoCAD or Civil 3D object directly with the Object.Extents node or you can get the Dynamo geometry first and then use BoundingBox.ByGeometry. From there, look under the Geometry → Abstract → BoundingBox shelf for nodes to get information from the bounding box, such as the corner points.
The Surface.PointAtParameter node os worth playing around with.
To simplify the use, each surface has a U Axis and a V axis, these follow the surface in perpendicular directions. With these in place you can select a point by defining how far along each axis you want to progress.
Assuming a rectangle with standard orientation, a U and V value of 0 you would be the lower left corner, and a UV value of 1,1 would be the upper right. Think of it as walking a percentage of the overall surface in one direction, than turning 90 degrees and walking a percentage of the overall surface in that direction.
So if you walk 0% along the U and 50% along the V of our rectangle, you would be at the mid point of the left edge. 25% along the U and 25% along the V would be the about 1/4 of the way between the lower left corner and the upper right. And 50% on the U and V would be the center of the surface. To finish speaking in terms of simplified parameterization, we use a decimal value rather than a percentage to make the math easier. So Surface.PointAtParameter(0.5,0.5) would be a point in the middle of the surface.
There are two more ‘big things’ to know. The first is that parameters of a surface are not clipped to your surface, so you might get a point that isn’t on your surface (imagine a donut shaped surface - parameter 0.5,0.5 is in the opening). This can be annoying, but also helpful when you really start doing computational design work - after all there are other ways to ensure the point is on the surface, such as Geometry.ClosestPointTo.
The last key bit of info is that the parameters need not be constrained between 0 and 1 - you can actually use a value of 2 to find a point that is one length of the surface along the axis beyond the surface… using this to your advantage might be the easiest way to find a point ‘outside of your design area’. Surface.PointAtParameter( -0.5,0) will return a point outside the lower left corner of the surface, exactly 1/2 of the surface’s U axis away from the surface itself.