Splitting structural framing element - End Extension does not allow to get overwritten

Hello friends,

I’m trying to create dynamo script that would slice structural framing element and overwriting start/end extension parameters*. As I didn’t found node that allow split Revit element I used python script with Split() method from API. Then for both elements I used methods DisallowJoinAtEnd() so I could release parameter End Extension for original element. With this it should be no longer read-only. Unfortunately it didn’t help and later as I try to overwrite this parameter within Dynamo I’m still getting warning that it’s read-only. In Revit model after running this script I can change this parameter without any problems. I’ve tried to select this element once again by Id unfortunately it didn’t help and error still occurs.

It looks like the status of the parameter isn’t updated until script is done so it’s not allowing for overwriting it. Has anyone met such problem or has an idea how to approach it?

Here is the code I use for splitting element:

#### General imports  ##### 
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

doc = DocumentManager.Instance.CurrentDBDocument

element = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)

element_id = element.Id
new_element_id = element.Split(0.7)

new_element = doc.GetElement(new_element_id)

Autodesk.Revit.DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(element, 0)
Autodesk.Revit.DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(element, 1)
Autodesk.Revit.DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(new_element, 0)
Autodesk.Revit.DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(new_element, 1)

TransactionManager.Instance.TransactionTaskDone()

OUT = element, new_element

*Ultimately I’m planing on slicing one element with other multiple elements and reading width of cutting elements so the offsets will be automatically adjusted - joins need to be disallowed as some times we will need do add additional offset in order to get correct montage spaces

Looks like I’ve found temporary solution:
flipping structural framing start/end twice with
Autodesk.Revit.DB.Structure.StructuralFramingUtils.FlipEnds(element)
causes element to reload status of end extension and allows to modify those parameters further.
It’s ugly solution but works for now
Maybe someone will know more sophisticated solution

1 Like