do you know how can I use API function in python code?
Here is my try…
Need to define start vertex and end vertex…
Can somebody help?
api url help
http://www.revitapidocs.com/2017/fb041590-6361-7fda-4f48-6e381dbb9f5d.htm
do you know how can I use API function in python code?
Here is my try…
Need to define start vertex and end vertex…
Can somebody help?
api url help
http://www.revitapidocs.com/2017/fb041590-6361-7fda-4f48-6e381dbb9f5d.htm
Check out this class from 2015 AU that has an option for doing slab splits.
thx…but I am not beginner. The video is about how to you each node. I need something extra from API.
Hi @P_Fiala ,
the problem here is the way you try to set the vertices of the split line.
First of all, there doesn’t seem to be a SlabShapeVector method . I think the only way to add vertices to the slabshape editor is to use DrawPoint(XYZ), where XYZ is a Revit point.
Once you add vertices, you can use them to create the SplitLine with DrawSplitLine:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#Unwrap you slab element
slab = UnwrapElement(IN[0])
#Get SlabShape editor of your slab
sseditor = slab.SlabShapeEditor
#Make XYZ from point list
ptlist = []
for i in IN[1]:
ptlist.append(XYZ(i.X,i.Y,i.Z))
TransactionManager.Instance.EnsureInTransaction(doc)
#Adding slabshapevertices
slabshapevertices = []
for i in ptlist:
slabshapevertices.append(sseditor.DrawPoint(i))
#creating split line from slabshapevertices)
sseditor.DrawSplitLine(slabshapevertices[0],slabshapevertices[1])
TransactionManager.Instance.TransactionTaskDone()
OUT = slabshapevertices
Beware of Units ! revit works with feet internally, so unless you’re working with feet you’ll have to convert the coordinates of your points when before creating the XYZs
thanx…it is really split line? it work also without this line.
sseditor.DrawSplitLine(slabshapevertices[0],slabshapevertices[1])
and still its only points not line
If you delete that line you’ll only add slabshapevertices .
If you enter the slabshape editor in revit you’ll see the line :
You wil only see the line directly if the slabshapevertices are on the edges of your slab :
@P_Fiala
This is very likely to be a unit issue. Maybe this will work :
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#Unwrap you slab element
slab = UnwrapElement(IN[0])
#Get SlabShape editor of your slab
sseditor = slab.SlabShapeEditor
#Make XYZ from point list
UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits
if isinstance(IN[1],list):
ptlist = [XYZ(UnitUtils.ConvertToInternalUnits(i.X,UIunit),UnitUtils.ConvertToInternalUnits(i.Y,UIunit),UnitUtils.ConvertToInternalUnits(i.Z,UIunit)) for i in IN[1]]
else :
ptlist = [XYZ(UnitUtils.ConvertToInternalUnits(IN[1].X,UIunit),UnitUtils.ConvertToInternalUnits(IN[1].Y,UIunit),UnitUtils.ConvertToInternalUnits(IN[1].Z,UIunit))]
TransactionManager.Instance.EnsureInTransaction(doc)
sseditor.ResetSlabShape()
#Adding slabshapevertices
slabshapevertices = []
for i in ptlist:
slabshapevertices.append(sseditor.DrawPoint(i))
TransactionManager.Instance.TransactionTaskDone()
OUT = slabshapevertices
thanks …
but there was some notidentify bugs
now all works.