Guys,
Just to be sure: Revit API doesn't allow us to set a Projectlocation right?
So let's say you have 10 ProjectLocations and you want to set a specific one as the ActiveProjectLocation
Solved! Go to Solution.
Solved by architect.bim. Go to Solution.
Hi!
I think it allows. In the latest API versions there is SetProjectPosition method
I'm sorry! The previous one changes the properties of the location itself. And this property (ActiveProjectLocation) is responsible for the current document location.
Yeah,
So one can't set a specific one as ActiveLocation.
no API workflow would be: press the "make current" button
Sorry, I do not understand what the problem is. You simply need to set new value for the ActiveProjectLocation property. Here is Python sample. I create duplicate the existing location and set it as the current:
current_location = doc.ActiveProjectLocation
with DB.Transaction(doc, 'Set New Current Location') as t:
t.Start()
new_location = current_location.Duplicate('New Location')
doc.ActiveProjectLocation = new_location
t.Commit()
The results are in the screenshot below:
To retrieve all the project locations get the ProjectLocations value and iterate through the ProjectLocationSet to get the location you need.
As the screenshot above shows:
I have 3 defined sitelocations (each with the own survey point, rotation etc.etc.)
I want to make one of those current: as if I pressed the "make current" button
What stops you from doing so? Setting the ActiveProjectLocation property does the same as you if you push "Make Current" button in Revit UI.
Before:
Python Code:
all_locations = doc.ProjectLocations
for location in all_locations:
if location.Name == 'New Location 2':
break
with DB.Transaction(doc, 'Set New Current Location') as t:
t.Start()
doc.ActiveProjectLocation = location
t.Commit()
After:
Okay!
I am glad it finally helped. 😃
Can't find what you're looking for? Ask the community or share your knowledge.