Change site in Revit, Export IFC, and then change the site back

Hi there,

I’m trying to figure out if the above subject would be possible to do in Dynamo. But after looking into it, I’ve been struggling to find a node that can change/swap the current site.

It’s these sites I would like to be able to swap using dynamo, and then swap back again after an IFC export:

I hope someone knows a nice package that can help me out with this, or even better if some of you Python magicians can help me out with a custom node.

Thanks a lot in advance,

Hi @Jens_Kaarsholm did you find any solution on this

Hi I had a script with similar workflow, it ask the user to choose the Shared site to export after opening a detached copy of the model so the actuall model stays unchanged, hope the swapping site part can help you build your script. Good luck…:slight_smile:
Export-NWC-IFC&DWFX.dyn (132.1 KB)
Navis_DWFX_IFC-Export-W-SharedSite.dyf (88.5 KB)


Thanks @saju_autodesk for sharing
I was looking to develop for NWC.

I am looking to export NWC for multiple project locations of same file.
Think so will have to rely on python for iterating through all locations.

Hi, I want to ask how can I get the Package of ( F+P Power Tools Dynamo ) to get (Location.ProjectLocation) node

Hi this is an internal package and i can’t share it with you but I am sure you will find similar node in other packages. Currently I don’t have my laptop to quickly find one.

I think it was done using ProjectLocationSet Class by iterating each project location on the document.

1 Like

I tried to use the (Get Project Location) node from GeniusLoci Package but it just gets the Active Current location not all Locations, is there another node to get all Locations or to get all Project Base Point from linked files

Hi @Khalid.fekry try take a look on this post here, but i guess you only can get one at time …so a workaround with genius loci node is set the location and export one by one…

think something here…

2 Likes

Yes, You are Right about the genius loci node I can only Export one to one but I do not know If there is a custom node to export all Site Locations

not as far i know…

1 Like

@Khalid.fekry May be you can try the following script I put together to match the output of the Locations.ProjectLocations Node here you go:

here is the code:

import clr
import math
clr.AddReference("RevitServices")
import RevitServices 
from RevitServices.Persistence import DocumentManager
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
version=int(app.VersionNumber)

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

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

inputdoc = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]

out=[]

for i in inputdoc:
	AllLocations=[]
	AllNames =[]
	
	Locationset = i.ProjectLocations
	iterator = Locationset.ForwardIterator()
	
	
	while iterator.MoveNext() != False:
		projectLocation = iterator.Current
		AllLocations.append(projectLocation)
		AllNames.append(projectLocation.Name)
	
	out.append(AllLocations)
	out.append(AllNames)

OUT = out
1 Like

Thank You @saju_autodesk, but we are still having issues getting all the Information and coordinates for the list of project locations, it still just gets the coordinates for the current Location

Great but i dont think its the issue to get locations names, but get the location data (coordinates) as i guess it will only give the active i think :wink:

It was just a starting point to get all locations, we could extend it easily like below to get the coordinates, angle and elevation.

	ProjectPosition = (i.GetProjectPosition(XYZ.Zero))
	out.append([ProjectPosition.EastWest,ProjectPosition.NorthSouth,ProjectPosition.Elevation,ProjectPosition.Angle])
2 Likes

Hi @saju_autodesk thats great :wink: thanks

1 Like

Hi @saju_autodesk Thank you, I tried to do that to get Project Base Point properties, is there a way to get the same value of Project Base Point from the ( Get Project Location ) node

@Khalid.fekry its just a matter of unit conversion, I think Revit internally uses feet as standard you may need to convert feet to mm to get this

same for Radians to degrees :

1 Like

OK @saju_autodesk, that is great Thank You

Hi, I tried to get all site locations in the same Revit file by Previous Python code after convert to mm and by the Get project locations node
but notice that the coordinates from the Get project locations node match with the Revit file and from the Python code only the angle match with the Revit file and the E/w,N/S, and Elevation have Slight differences and do not match
can you help with this Issue

Can you perhaps share the screen grab of the entire screen with outputs? also the dyn if possible, I can have a look into it.