Cut Structural Members by a Reference plane


#1

I’m trying to write a Python script which automates the cutting of structural members (framing or columns) by reference planes.

With the method below, this only works between 2 solids. Anyone knows how to cut by a ref plane?

elementA = UnwrapElement(IN[0])
elementB = UnwrapElement(IN[1])

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
TransactionManager.Instance.EnsureInTransaction(doc)

result = Autodesk.Revit.DB.SolidSolidCutUtils.AddCutBetweenSolids(doc, elementA, elementB)
TransactionManager.Instance.TransactionTaskDone()
Out = result

 

Thx.

Dieter


#2

Hi, I am trying to do the same thing. Has anyone got a solution for this. I want to feed in a list of structural framing members and a list of reference planes and cut beam 1 by reference plane 1, beam 2 by reference plane 2 etc etc.

Any help would be appreciated.

Thanks


#3

Hi @nicolasombres ,

I once wanted to do exactly that, but from what I’ve seen during my research I don’t think it’s possible to cut elements by a reference plane. They have to be a solid element. Whtat you could do is use that reference plane to create a large solid (like a cube…) and use it to cut your elements with the following code :

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Autodesk.Revit.DB.SolidSolidCutUtils import AddCutBetweenSolids

doc = DocumentManager.Instance.CurrentDBDocument

if isinstance(IN[0],list):
	tobecut = [UnwrapElement(i) for i in IN[0]]
else:
	tobecut = UnwrapElement(IN[0])
cutting = UnwrapElement(IN[1])
count = []

TransactionManager.Instance.EnsureInTransaction(doc)

for t in tobecut:
	try:
		count.append(AddCutBetweenSolids(doc,t,cutting))
	except:
		pass

TransactionManager.Instance.TransactionTaskDone()


OUT = '%d elements coupés' % (len(count)) 

I have it wraped in the Elements cut node in Node-Mode . I hope this helps.


#4

Thank you so much Mostafa, this might be a good escape from the plane
cutting,
cheers


#5

Hi Mostafa,
One last question: does the structural elements need to be imported from revit for this script or I can just link the StructuralFramingBy.Curve node within dynamo with it? Because it seems to produce no result (but no error) giving back an empty list,
Cheers,

Nicolas Ombres


#6

The output of structuralframing.bycurve gives you revit elements , which is the wxpected input for the code I my previous message . The cutting element needs to be a revit element as well ! Not a dynamo geometry . So if you have a dynamo geometry you can use direct shape import it in revit .

Could you provide a screenshot of your work ? That would help me help you :slight_smile:


#7

Hi Mostafa, here is a screenshot of what I have so far, hope this would help, let me know!


#8

@nicolasombres
two things :
1 - I tweeked the code a little bit for the type of list combination you need :

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Autodesk.Revit.DB.SolidSolidCutUtils import AddCutBetweenSolids

doc = DocumentManager.Instance.CurrentDBDocument

if isinstance(IN[0],list):
	tobecut = [UnwrapElement(i) for i in IN[0]]
else:
	tobecut = [UnwrapElement(IN[0])]

if isinstance(IN[1],list):
	cutting = [UnwrapElement(i) for i in IN[1]]
else:
	cutting = [UnwrapElement(IN[1])]

count = []

TransactionManager.Instance.EnsureInTransaction(doc)

for t,c in zip(tobecut,cutting):

	count.append(AddCutBetweenSolids(doc,t,c))

TransactionManager.Instance.TransactionTaskDone()


OUT = '%d éléments coupés' %(len(count))

2- the type of elements import.ByGeometry will give you does not work with the AddCutBetweenSolids method. I suggest you use familyinstance.ByGeometry (springnodes package):

I have the feeling there might be a bette way to do this because it’s slow and creates many family instances (I used the conceptual volume family template to make them easy to hide though…)

I’ll try to have another look at cutting methods and post my findings :slight_smile:

I hope this helps


#9

Hi Mostafa

I see this topic and you’re node to cut elements with other elements
i have some problems with creating reference plane (other topic from me in this forum)
But one off the reasons that i whant to create a reference plane is to cut structural framings
know i see this topic and i think that it is not possible

or is it in the meantime possible to cut with reference plane?


#10

Hi @Nico_Stegeman
that node uses AddCutBetweenSolids method which cuts a solid with another solid. I tired it with a reference plane without success. I can’t find any method in the API to cut a solid with a reference plane but maybe I’m missing something.


#11

thanks