Hi guys,
For some reason in the attached script I won’t be able to use custom nodes so I have to somehow make a work around to replace the use of bimorph and orchid nodes with python script.
The attached script is prepared for Revit2022 + Dynamo 2.12.
It moves coordination link by comparison of current document coordination grids intersection point with analogous grids in linked coordination model. Than acquires shared site from that link.
The first issue is the Bimorph nodes group.
I would like to achieve exactly the same thing. Select elements in link by chosen category then convert them to “standard elements” but with a Python script. Would anyone be willing to help me with this?
The second one, I know it’s not exactly related with this topic title - I’m sorry for that, is to get link insertion point like I did with orchid node. I think this node reads insert point by link’s internal origin, what is fine for me.
That’s a lot of work to duplicate the efforts of those package authors. Certainly less effort to use the packages directly, and a better practice overall.
Hi Jacob, thank you for the answer!
Yes, I know it ain’t the best way to go. Unluckily in this case I have no other option.
Seems like I’ll have to pass this task to some python developers
import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
import Autodesk
from Autodesk.Revit.DB import *
def get_linked_elements_of_category(linked_instance, category):
linked_doc = linked_instance.GetLinkDocument()
# Use a filtered element collector to get elements of a specific category
linked_collector = FilteredElementCollector(linked_doc)
linked_elements = linked_collector.OfCategory(category).WhereElementIsNotElementType().ToElements()
return linked_elements
linked_instance = UnwrapElement(IN[0])
cat = UnwrapElement(IN[1])
built_in_category = cat.BuiltInCategory
linked_elems = get_linked_elements_of_category(linked_instance, built_in_category)
OUT = linked_elems
About the “GET LINK INSTANCES” script, well I’m sorry to say that, but it was already solved in the script with Design Script code block What I need as a second script is to get an insert location of Link instance.
Anyway, great job! Thank you so much for helping me
Ok than just take at this to find which BuiltInCategory you need and you can enter it manually.
import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
import Autodesk
from Autodesk.Revit.DB import *
def get_linked_elements_of_category(linked_instance, category):
linked_doc = linked_instance.GetLinkDocument()
# Use a filtered element collector to get elements of a specific category
linked_collector = FilteredElementCollector(linked_doc)
linked_elements = linked_collector.OfCategory(category).WhereElementIsNotElementType().ToElements()
return linked_elements
linked_instance = UnwrapElement(IN[0])
category = BuiltInCategory.OST_Grids #Change to the desired BuiltInCategory
linked_elems = get_linked_elements_of_category(linked_instance, category)
OUT = linked_elems
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
linkInstance = UnwrapElement(IN[0])
category = UnwrapElement(IN[1])
OUT = FilteredElementCollector(linkInstance.GetLinkDocument())\
.OfCategoryId(category.Id)\
.WhereElementIsNotElementType()\
.ToElements()