Linked Element Location Co Ordinates

I Need Custom Nodes to Get The Linked Elements Co Ordinates For Multiplie Site Can Anyone Prefer anything for me

@ahmedabdlsalamm ,

that can be a starting point

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
links =  FilteredElementCollector(doc).OfClass(RevitLinkInstance)

output = []
for i in links:
	doclink = i.GetLinkDocument()
	collector = FilteredElementCollector(doclink).OfCategory(BuiltInCategory.OST_GenericModel)
	all_elements = collector.WhereElementIsNotElementType().ToElements()
	output.append(collector)

OUT = output
#Template 
#DraxlA
#19.07.2023
import clr
import sys 

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#functions
def tolist(x):
    if hasattr(x,'__iter__'): return x
    else: return [x]


#Preparing input from dynamo to revit
elements = UnwrapElement(tolist(IN[0]))

output = []

for i in elements:
	output.append(i.Location.Point.ToPoint())
	

OUT = output

grafik

KR

Andreas

Hi @ahmedabdlsalamm is it something here you look after ?

Revit_zPrmzYDbC0

2 Likes

yes i want something like that but i need to get location for more than one shared site

you can only have one active site at time, but you can just change you site and get your linked elements location from that site, relative or absolut

i want to get this all Shared Site Location for this links

i want to get this all Shared Site Location for this links

@ahmedabdlsalamm ,

thats a other issue… i understand

You could try export these site location…

Revit_qeE7WdxlO1

2 Likes

Hi,

I’m not sure if I answer the request exactly, but here is a workflow with python

import clr
import sys
import System

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary

#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
uiapp = DocumentManager.Instance.CurrentUIApplication


rvtLinkInstance = UnwrapElement(IN[0])
lnkDoc = rvtLinkInstance.GetLinkDocument()

lenghtUnit = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()
angleUnit = doc.GetUnits().GetFormatOptions(SpecTypeId.Angle).GetUnitTypeId()

projLocation = next((p for p in lnkDoc.ProjectLocations if p.Name in rvtLinkInstance.Name), None)

if projLocation:
    projPosition =  projLocation.GetProjectPosition(XYZ.Zero)
    
    angle = UnitUtils.ConvertFromInternalUnits(projPosition.Angle, angleUnit)
    east_west = UnitUtils.ConvertFromInternalUnits(projPosition.EastWest, lenghtUnit)
    north_south = UnitUtils.ConvertFromInternalUnits(projPosition.NorthSouth, lenghtUnit)
    elevation = UnitUtils.ConvertFromInternalUnits(projPosition.Elevation, lenghtUnit)
    
    OUT = rvtLinkInstance.Name, f"angle : {angle}", f"east_west : {east_west}",  f"north_south : {north_south}",  f"elevation : {elevation}"

Hi, I have a question related with UI Script.
When I was run a script the UI will appears on my screen to enter the first input and press set values. the UI will be hide to export data to excel and I will run script again to enter the second input and so.
Is there a way to keep a UI script on my screen
To enter first input and run to export data then enter second input and run to export data without the UI will be hide every time.

Hi not with datashapes

1 Like