Create NewSlabEdge

Hi!
I can’t create new slab edges. Why? I am realy need help

I am using this methods

This is all script with warning

This pythone code

Two things I think:

  • The error from the Python node says expected SlabEdgeType, got Family Symbol, so I assume you are selecting a profile via Family Types? To get a SlabEdgeType you can use Element Types and choose HostedSweepType and All Elements of Type
  • I don’t think that it will work with ElementCurveReference (I don’t know what type of Element you are selecting from the model), so this example shows getting a Reference using the Genius Loci package (in this case from a ModeCurve)

Hope this helps,
Thomas

4 Likes

Thank you so much!!! This is working) I am stupid)

1 Like

So I’ve built the graph, and copied the code…but for some reason, I don’t have SlabEdgeTypes in my model…even though I have modelled many slab edges.

Why does my HostedSweep and SlabEdgeType only populate with ElementTypes?

Revit 2021.1.7

If I run the same script in 2019 and 2021 on essentially the same model, then you can see in 2019 that the object type is UnknownElement which I think means there wasn’t a wrapper for that kind of element in Dynamo at the time. By 2021 then its objecttype is ElementType which means there is a wrapper. Ultimately they perform the same when used in the Python script, but you can narrow down by using Element.Name to give you the type name to aid selection.

Revit 2019 / Dynamo 2.0.2
image

Revit 2021 / Dynamo 2.6

1 Like

OK. Good to know :slight_smile:

Something wasn’t working right, and I removed the “unwrap” in the python block while trying to trouble-shoot the issue. I’ll check it out later!

So I unwrapped bothe the ElementType and my References…but now it says that it is expecting a referencearray and got list. As I undertsand in “programming-speak” an array is a list.

So how do I convert the list to a ReferenceArray?

I’ve been tinkering for the last 20 min. and have moved no closer to a solution. :frowning:

The python code is expecting a single Reference, not a list of References. It depends how you have adapted the graph but assuming you want to apply it to multiple curve References input into IN[1], then the code needs to be adapted to loop over list, e.g.

for Reference in IN[1]:
	SlabEdge = doc.Create.NewSlabEdge(edgeType, Reference)

Full script:

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)

edgeType = UnwrapElement(IN[0])
Reference = IN[1]

for Reference in IN[1]:
	SlabEdge = doc.Create.NewSlabEdge(edgeType, Reference)

TransactionManager.Instance.TransactionTaskDone()

OUT = SlabEdge
1 Like

That almost got me what I needed!

I looked up ReferenceArray in the Revit API, but I don’t know how to use it in the code…or better said, how to create a reference array and append items to it.

In my mind, I should be able to write something like:
RA = ReferenceArray
for Reference in IN[1]:
Append(RA)

The adjustment to the script you made allowed me to create individual elements for each model curve, but I was hoping I could create a single slab edge using multiple curves, instead of one segment-element per curve.

I am trying to keep my model-element count down…working on a very large project and modeling the insulation-layer at the facade and slab-edge interface.

I’m not sure about constructing a ReferenceArray, but (assuming you want to apply to whole floors) you could use Genius Loci’s Compound Edges References to get the Horizontal References and then iterate through those in Python (same script as last reply above)

In this example I selected two floors and it created a slab edge for each side of each floor

1 Like

Hi Thomas,

Unfortunately, that will essentially get me the same result. I am actually hosting the slab-edges to model curves.

I will ask in the main forum. Thanks for all of your help so far!

Cheers,
Matt

Hi Thomas,

FYI.

2 Likes

I’m working on Revit 2023 with Dynamo 2.13.1 and I don’t see anywhere the Element Types node used here. Was it discontinued? or replaced by another node?

The classic combination of Element Types > All Elements of Type is now Element Classes > All Elements of Class in Revit 2023 and associated Dynamos

There’s a nice explainer by @john_pierson here: Element Type Node Changes in Dynamo for Revit 2023! - YouTube

2 Likes

Thanks a lot. That’s exactly what i was missing.

1 Like

Is there any way to flip slabedge that we created

Hi @projects2RCFL and welcome, this topic here already have a solution for the original questions… try create a new topic and share all you tried so far…

1 Like