Hello all,
I’m working on Revit 2022, and I was hoping I could use the API methods that were introduced in this version to modify Wall Profiles. I’m mostly interested in accessing the RemoveProfileSketch Method
However I haven’t been able to find a node that does this.
How difficult would it be to write one? One that takes an Element input and applies the action to it.
If it’s a simple syntax, could you give me hand?
If it’s more involved than that, what similar nodes could I look into as an example?
(I’m about to get into studying Python and the Revit API. This is both a problem I need to solve and a learning experience.)
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
toList = lambda x : x if hasattr(x, '__iter__') else [x]
#Preparing input from dynamo to revit
lstelems = toList(UnwrapElement(IN[0]))
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for e in lstelems:
if isinstance(e, DB.Wall):
e.RemoveProfileSketch()
TransactionManager.Instance.TransactionTaskDone()
OUT = lstelems
Thank you very much @c.poupin!
It works exactly as expected, and now I have a template for future reference on how to call individual API actions. This helps me a lot. Thank you very much!