Orthogonality

Hi,

In my rotated project how can i set boundingboxes in dynamo orthogonal to the revit geometry?
Is there a node in dynamo that controls this?
eg. set my dynamo geometry orthogonal to Project Base Point, Origin(=preset) or Survey Point?

Thanks
Marcel

Hi @Marcel_Rijsmus

Did you find a solution?

Or a different strategy?

Kind regards,

Willem

1 Like

@willem.creffierKCWFB @Marcel_Rijsmus

i have a directshape methode…

grafik

import clr
import sys 

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

# 🧷 functions
def BB_to_DS_rotated(bb, el):

	# 1️⃣ Get Min/Max points
	pt_min = bb.Min
	pt_max = bb.Max

	# 2️⃣ Create points for Rectangle
	pt0 = XYZ(pt_min.X, pt_min.Y, pt_min.Z)
	pt1 = XYZ(pt_max.X, pt_min.Y, pt_min.Z)
	pt2 = XYZ(pt_max.X, pt_max.Y, pt_min.Z)
	pt3 = XYZ(pt_min.X, pt_max.Y, pt_min.Z)

	# 3️⃣ CurveLoop from  Lines
	curve0 = Line.CreateBound(pt0, pt1)
	curve1 = Line.CreateBound(pt1, pt2)
	curve2 = Line.CreateBound(pt2, pt3)
	curve3 = Line.CreateBound(pt3, pt0)
	curve_loop = CurveLoop.Create([curve0, curve1, curve2, curve3])

	# 4️⃣ Get Door's Position + Rotation
	door_location = door.Location
	door_position = door_location.Point
	door_rotation = door_location.Rotation


	# 5️⃣ Apply Rotation + Translation
	# origin = XYZ(0,0,0) # For Testing
	origin = door_position
	axis   = XYZ(0,0,1) #Z-Axis

	t_rotate    = Transform.CreateRotationAtPoint(axis, door_rotation, origin)
	t_translate = Transform.CreateTranslation(door.Location.Point)
	transform   = t_rotate.Multiply(t_translate) #Combine 2 Transforms

	curve_loop_transformed = CurveLoop.CreateViaTransform(curve_loop, transform) #Recreate CurveLoop with Transform


	# 💥 Create DirectShape
	height = 10 #Random height for this example
	shape  = GeometryCreationUtilities.CreateExtrusionGeometry([curve_loop_transformed], XYZ(0,0,1), height)
	cat_id = ElementId(BuiltInCategory.OST_GenericModel)
	ds     = DirectShape.CreateElement(doc, cat_id)
	ds.SetShape([shape])

	return ds

# 🔱collector
collector = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Doors)
doors = collector.WhereElementIsNotElementType().ToElements()

# 🔓 create Box
t = Transaction(doc, "Set BoundingBox")
t.Start()
for door in doors:
	symbol = door.Symbol
	symbl_BB = symbol.get_BoundingBox(None)
	ds = BB_to_DS_rotated(symbl_BB, door)

t.Commit()
# 🔒 finished

OUT = "Done"

that would be i nice homework for the dynamo team! i know the game “angry birds” used 2D bounding boxings with physics … :wink:

Bounding box by minimum volume was added in on think Revit 2023.1 or Revit 2024.

1 Like

@jacob.small

do have an example ?

Released in 2.16, see the blog post here: Dynamo Core 2.16 Release - Dynamo BIM

@jacob.small

is this the API Property ?

i can`t find it directly

It’s a Dynamo node, not a Revit method.

For a Revit method you could pull the bounding box of the door symbol, and transform it by the sum of the door instance’s transforms; not an easy lift and not something I’d bother to code, as you’re better off building the clearances in the family itself, or hosting a clearance family based on the door.

2 Likes

The
BoundingBox.ByMinimumVolume &
Geometry.OrientedBoundingBox

nodes generate the following message in the Biomorph node

Geometry.OrientedBoundingBox

Looks like bimorph needs an update.

Hmm…

It looks up to date.

Revit 2023

image

If somebody would like to test… please find them attached.

Kind regards,

Willem
split test 09.rvt (1.8 MB)
read parameters.dyn (140.5 KB)

Yes - I don’t think Bimorph allows non-orthogonal bounding boxes.

OK, then I will proceed on @Draxl_Andreas direct shapes…

@jacob.small
@Draxl_Andreas

Direct shapes work!

thank for the feedback on bounding boxes and the suggestion to take a look at direct shapes.

Please find the codes I the graph, if it’s to anybody’s interest.

read write parameters direct shape.dyn (81.8 KB)

2 Likes