iam trying to rotate the section box to be align with a selected face but iam a beginner
Crumple nodes has the View.SectionBox node which can retrieve the current box (note: this is not the CropBox) - Using the bounding box you can convert it to cuboid geometry and manipulate. Use coordinate systems to do this - then extract the max and min points and convert to new bounding box before utilising a Clockwork View3D.SetSectionBox node
thanks it worked
but not exactly the way i wanted, i want to select a face then the sectionbox becomes parallel to that face
ty
i built the correct boundingbox as seen in 3dview but the node from cloclwork doesnt fit the sectionbox to the newboundingbox
I don’t know which type of face you selected (vertical or horizontal), but we can only rotate a sectionbox along the Z-axis.
its a horizontal face
yes i want to rotate the section box around z axis to fit the created bounding box
Hi,
here is an example

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
def set_SectionBox(view3d, ds_bbx):
current_box = view3d.GetSectionBox()
center_box = (current_box.Min + current_box.Max) / 2
cs = ds_bbx.ContextCoordinateSystem
tf = Transform.Identity
tf.BasisX = cs.XAxis.ToXyz()
tf.BasisY = cs.YAxis.ToXyz()
tf.BasisZ = XYZ.BasisZ #coord_system.ZAxis.ToXyz()
tf.Origin = cs.Origin.ToXyz()
newbox = BoundingBoxXYZ()
newbox.Max = current_box.Max
newbox.Min = current_box.Min
newbox.Transform = tf
view3d.SetSectionBox(newbox)
views = UnwrapElement(IN[0])
ds_bboxes = IN[1]
TransactionManager.Instance.EnsureInTransaction(doc)
if isinstance(IN[0], list):
if isinstance(IN[1], list): OUT = [set_SectionBox(x, y) for x, y in zip(views, ds_bboxes)]
else: OUT = [set_SectionBox(x, ds_bboxes) for x in views]
else:
if isinstance(IN[1], list): OUT = set_SectionBox(views, ds_bboxes[0])
else: OUT = set_SectionBox(views, ds_bboxes)
TransactionManager.Instance.TransactionTaskDone()
OUT = views
Worked flawlessly thanks


