I’m new to Dynamo and wanna force myself to learn, so I wanted to start by creating a script that can center a window between the exterior face of two perpendicular interior walls. Seems like a simple script but I don’t know where to even start. I know I want to select the existing window in Revit, but I don’t know how to then have it find the closet perpendicular walls and center itself between them.
Here is an image that should properly explain what I hope to do:
the use of Element.Face can be used instead to have the closest faces
which intercept the LocationLine
an enlargement of the surfaces will be considered in relation to the middle of it
Hi,
Inspired by Mr. sovitek’s answer, I tried via API
use of the
Dimension Class Property
I am constantly learning
this can definitely be improved
Script Python:
import sys
import clr
#Import the class you want to use for Method and Properties
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import Dimension,Transaction
#Unwrap the Element
dim=UnwrapElement(IN[0])
#Get the document
doc=dim.Document
#number of segments have the dimension
nbsegments=dim.NumberOfSegments
#Create a transaction to modify
t=Transaction(doc,"Move the window by Dimension Properties")
if nbsegments==2:
t.Start()
# Set the equality to Dimension Properties
dim.AreSegmentsEqual=True
t.Commit()
t.Start()
# Set the equality to Dimension Properties
dim.AreSegmentsEqual=True
t.Commit()
out="The window is move on center"
else:
out=" One or more than 2 Segments in dimension"
OUT = out