Get the left curve of a box

Hi, sorry to be a pain. But where do I start to figure out how to get the left curve of a bounding box. I’m trying to find nodes to identify the vertical ones atm. Also my script used to work till 2022 the bounding box lists changed to a different way.

Get the min and max point and use them to make a line.

The left curve at the base of the box would be;

Point 1 = min.x, min.y, min.z
Point 2 = min.x, max.y, min.z

This is doing my head in. Had to many beers at lunch. how do I isolate it with point one and two?

1 Like

min and max point of the bounding box you meant?

I made an envelope. I cant quite figure out how to use points in ==

I should get a prize for the dumbest way to use dynamo. Depending on the view orientation this isn’t going to help I think anyway

yup how do you tell right from left depending on if the view was flipped around to be outside the building. I guess I could get into some true false stuff weather it was flipped or not to move. Must be a smarter way though

Hmm, try this, might be a start.
Check if the section of code that builds the plane x-axis works for the flipped views.

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

bbox = IN[0]

result = []

for b in bbox:
	vertical_lines = []
	for l in b:
		v = Vector.ByTwoPoints(l.StartPoint,l.EndPoint)
		if v.Z > 0 or v.Z < 0:
			# Line is vertical
			vertical_lines.append(l)
	
	# Find the vertical line which is the left one by using a plane oriented by the bbox x Axis and Z being up as expected
	
	bbox_plane_points = []
	for l in b:
		bbox_plane_points.append(l.StartPoint)
	
	bbox_plane = Plane.ByBestFitThroughPoints(bbox_plane_points)
	
	bbox_plane_xAxis = bbox_plane.XAxis
	
	v1 = vertical_lines[0].StartPoint.X
	
	if v1 < bbox_plane_xAxis.X:
		result.append(vertical_lines[0])
	else:
		result.append(vertical_lines[1])
		
OUT = result
1 Like

In that case I’d use the normal direction of the window family and then project the width of your window left and right by half the window width, assuming they are all windows. Bounding box is not reliable if you can’t predict its desired orientation - it’s always oriented to the Y axis (until Dynamo 2.16 at least).

1 Like

Instead of working with the bounding box, why not pull the window’s opening, sort the lines by Z value of the midpoint, loft a surface between the lowest and highest midpoint Z, and pull the perimeter curves of that surface?

1 Like

Thanks @Ewan_Opie but no luck. Got me thinking it might not be achievable with what I’m doing at the start to look at the outside curtain wall face? After I create the view I’m naming it then pulling the bounding box with the wall orientation again which isn’t correct to the created view. To be honest I find this all quite confusing. But when I get some time will dive deeper and try do what Gavin and Jacob are saying.

@JacobSmall and @GavinCrump would what your saying work considering I’m flipping views to the curtain walls orientation at the start?

Maybe I could use the location point of where its creating the view to determine the left side?

1 Like

I think you’d be best served by stepping back for a minute, and instead of asking “how do I get the goal from my current work” ask “how would I most readily attain the goal from scratch”.

One method to do that is (assuming I understand the intent) is what I was hinting at before. Ignore the bounding boxes entirely, get the opening lines, and use those to drive your crop boundary (which it appears is what you actually are after here - I could be wrong though).

1 Like

+1 to what Jacob said. If you can ever get more useful geometry than a BB then that’s best. BBs are usually best when the geometry is complex/slow to work with and you can predict the orientation of the element vs the Y axis.

If you can get the outline of your curtain walls as a frame as well as the orientation of the wall that should be enough to make elevations.

How do I get the outline without BB?

I thought maybe flipping the wall orientation to when the elevation point flips might solve it but didn’t. Not sure why this didnt work. Maybe I need to flip the curves, not the wall orientation

Without knowing how your windows were built, we can only guess.

Element.Curves would be the method which would work on the families I used to use when I practiced, but my families won’t necessarily align to yours.

I’m using curtain walls

In which case the profile of the wall would be one method to consider.

Another would be to use the curtain grids which only have one adjacent panel.

You’ve got options in this case, but again, how you’ve built your content will matter.

Use element.getlocation, then extrude it upward by the unconnected height parameter. The perimeter curves of the surface are the box outline minus any edit profile changes.

1 Like

Sorry I may have explained things pretty poorly last Friday. I have a script that creates curtain wall elevations and dimensions them (thanks Ewan). Because I don’t trust people modeling them exterior facing. When the elevation point is placed, if it lands on a internal floor itll flip around to the other side (external side) and create the elevation. This was making the bounding box curves I got by the wall orientation flip around. I was using those bounding box curves with offset curves to place the dimensions. What I’ve done in the end is flip the curves if the elevation point that was placed was flipped to the other side. Then got the lowest point of the vertical lines to get the “left” line. Thanks for your help, not sure if there was some confusion from my shitty half cut explanation on Friday or what you were saying would work with the whole flipped view situation. Just chucking the solution I got below if your interested.

Flipping the view curves if the elevation was flipped to the other side.

my wack job way of getting the vertical lines and then the vertical line with the lowest start point. Which I think is what Gavin meant in his first response.

The gift that keeps giving… The solution dosnt seem to work all the time yet…

@GavinCrump Looking at your idea to extrude upward by the unconnected height parameter. Could this mean if someone has edited the profile and left the height parameter on something silly the crop outline could come out funny and thus the dimensioning location line? I like to try make my scripts to avoid all the crazy things people can do when modeling. Bounding box I know I’m going to get the right shape around the element no matter what the user has done to offset from.

@JacobSmall if I used the profile of the wall I could get a funny shape. Do you mean get that and then create a box around it to use and offset dimension placing lines after?