Hi ,
Does anyone here on the Dynamo Forum know which API call should be used to switch between different Structural Plan types?
I’ve been looking for a solution to this but can’t find anything.
Best regards,
Mikael
Hi ,
Does anyone here on the Dynamo Forum know which API call should be used to switch between different Structural Plan types?
I’ve been looking for a solution to this but can’t find anything.
Best regards,
Mikael
Hello @mikael.zeylonGRFY6 and welcome…you could try something viewfamilytypes is from rhytm
Hi @sovitek!
Thanks for your answer
That’s a good idea.
What I had thought was how to change this via the Revit api. I end up having to write this code in C# so I’m just trying to solve it via Python and the Revit Api in Dynamo at a first stage.
Do you have any ideas on how this could be solved with Python?
Hello @mikael.zeylonGRFY6 …if you mean for viewfamily type, then i would take a look on genius loci great node "all elements of type+ its written in python…so you can see how it can be done…good luck
Hello @sovitek and thanks again for the reply.
I don’t think that node can do what I want in this case (or I misunderstood as usual hehe).
What I want to accomplish is to change from ‘Structural Plan - Down’ (default) to 'Structural Plan - Up) via the app.
Thanks again
Hello,
an example
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
#Preparing input from dynamo to revit DB.
view = UnwrapElement(IN[0])
familyViewName = IN[1]
#ALL_MODEL_TYPE_NAME
rule = ParameterFilterRuleFactory.CreateEqualsRule(ElementId(BuiltInParameter.ALL_MODEL_TYPE_NAME), familyViewName, True)
filter = ElementParameterFilter(rule)
famViewTypeId = FilteredElementCollector(doc).OfClass(DB.ViewFamilyType).WherePasses(filter).FirstElementId()
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
if famViewTypeId is not None:
view.ChangeTypeId(famViewTypeId)
TransactionManager.Instance.TransactionTaskDone()
OUT = famViewTypeId
Hi @c.poupin!
Thank you very much, it works exactly as I imagined.
It works in Revit 2020 but not in Revit 2023.
Any idea if it’s a problem with the Revit 2023 api?
Error message:
<TypeError: No method matches given arguments for ChangeTypeId: (<class ‘Autodesk.Revit.DB.Viewplan’>, <class ‘Autodesk.Revit.DB.ElementId’>) [’ File “”, line 48, in \n’].
Best Regards,
Mikael
It’s an overload issue with CPython/Python.Net use IronPython engine instead (especially since you are going to switch to C# afterwards)