Hi all,
I have a slab that has split lines and I am trying to get the crease line in order to give it an offset.
Before hand I would like to get the curve of the crease lines which I seem to get an error with.
I try getting the curve using SlabShapeCrease.Curve but I am getting an error that “Autodesk.Revit.Db.SlabShapeCrease has no attribute get_Curve”.
I am using Revit 2023.
Any idea why this is? Appreciate the help
Here is the code I am using:
import clr
import sys
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
floors = UnwrapElement(IN[0]) if isinstance(UnwrapElement(IN[0]),list) else [UnwrapElement(IN[0])]
floor = floors[0]
slabEdit = floor.SlabShapeEditor
creases = slabEdit.SlabShapeCreases
curve = []
for crease in creases:
curve.append(crease.Curve.ToProtoType())
OUT = curve
I just managed to get the curve elements but am having an issue now with converting to dynamo curve. I tried using ToProtoType() and ToDynamoType(), I tried also CurveElement.Curve but seems like it isn’t working…
import clr
import sys
import System
from System import Array
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument
floors = UnwrapElement(IN[0]) if isinstance(UnwrapElement(IN[0]),list) else [UnwrapElement(IN[0])]
floor = floors[0]
slabShapeE = floor.SlabShapeEditor
sLines = slabShapeE.SlabShapeCreases
iter = sLines.ForwardIterator()
li = []
for it in sLines:
if it.CreaseType==2:
c = it.Curve
li.append(c) # For other types of curves, use the default
OUT = li
for it in sLines:
if it.CreaseType==2:
c = it.Curve
# Revit.GeometryConversion.RevitToProtoCurve.Convert(c)
li.append([c.GetEndPoint(0).ToPoint(), c.GetEndPoint(1).ToPoint()]) # For other types of curves, use the default
Thank you!
Care to explain why is necessary to clone the curve for it to work?
If I may ask another question related, I want to modify the line heights using subelements. When I selected the crease type 2 it seemed to have returned all the creases that are mid slab not including the first and last (based on the count of creases in the list). What would be the best method to get the creases in order including the first and last for further modifying? Or is it better to just create a new slab with the modified geometry?
ToProtoType() method explicitly needs the curve type (DB.Line, DB.Arc, etc…) and SlabShapeCrease.Curve Property only returns an object of Type DB.Curve (maybe a bug)
so I tried using Clone() to re-create a copy of the geometry in the specific Type
For the order of the lines, I’ll use one of the 2 arcs as a guide (calculating the parameter on the arc for each line).