rhino.inside-revit
rhino.inside-revit copied to clipboard
Add "Add Curtain Grid Line" Feature
Could you please add a component similar to the "Add Grid Line (U)" described here: https://discourse.mcneel.com/t/curtain-wall-grid/103674/2
import clr
clr.AddReference('System.Core')
clr.AddReference('RhinoInside.Revit')
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from System import Enum
import rhinoscriptsyntax as rs
import Rhino
import RhinoInside
import Grasshopper
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
from RhinoInside.Revit import Revit, Convert
from Autodesk.Revit import DB
clr.ImportExtensions(RhinoInside.Revit.Convert.Geometry)
# active Revit verison
REVIT_VERSION = Revit.ActiveUIApplication.Application.VersionNumber
# access the active document object
doc = Revit.ActiveDBDocument
def show_warning(msg):
ghenv.Component.AddRuntimeMessage(RML.Warning, msg)
def show_error(msg):
ghenv.Component.AddRuntimeMessage(RML.Error, msg)
def show_remark(msg):
ghenv.Component.AddRuntimeMessage(RML.Remark, msg)
# create and start the transaction
t = DB.Transaction(doc, 'AddGridLine')
t.Start()
try:
# change Revit document here
CGL = CG.AddGridLine(U, DB.XYZ(P.X, P.Y, P.Z), False)
# commit the changes after all changes has been made
t.Commit()
except Exception as txn_err:
# if any errors happen while changing the document, an exception is thrown
# make sure to print the exception message for debugging
print(str(txn_err))
# and rollback the changes made before error
try:
t.RollBack()
except Exception as rb_err:
print(str(rb_err))
The above implements the AddGridLine Revit API Method: https://www.revitapidocs.com/2019/8886680c-2075-f542-9fcd-140b8bd87d12.htm
Many thanks