# Change the name of the Project location in Dynamo

**URL:** <https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [March 4, 2020, 8:57am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609 "2020-03-04T08:57:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hieu.Doan](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@Hieu.Doan](https://forum.dynamobim.com/u/Hieu.Doan)\
**Post date:** [March 4, 2020, 8:57am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/1 "2020-03-04T08:57:51Z")

</div>

Hi all member,

Please help me, How can change the name of the Project location use Dynamo.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/c/cc4c512d44b2463702715cbaaaa42745c2cee199.png)

Thank you!

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [March 4, 2020, 9:50am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/2 "2020-03-04T09:50:22Z")

</div>

Resolved 😇

> import clr  
> clr.AddReference(‘RevitAPI’)  
> clr.AddReference(‘RevitAPIUI’)  
> from Autodesk.Revit.DB import \*  
> clr.AddReference(‘RevitNodes’)  
> import Revit  
> clr.ImportExtensions(Revit.GeometryConversion)  
> clr.ImportExtensions(Revit.Elements)  
> clr.AddReference(‘RevitServices’)  
> from RevitServices.Persistence import DocumentManager as DM # Document manager  
> from RevitServices.Transactions import TransactionManager as TM # Transaction manager  
> NewName = IN[0]  
> doc = DM.Instance.CurrentDBDocument  
> TM.Instance.EnsureInTransaction(doc)  
> projloc = doc.ActiveProjectLocation  
> NEW = projloc.Name = NewName  
> TM.Instance.TransactionTaskDone()  
> OUT = NewName

---

<div class="post-metadata">

**Author:** ![Hieu.Doan](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@Hieu.Doan](https://forum.dynamobim.com/u/Hieu.Doan)\
**Post date:** [March 4, 2020, 10:06am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/3 "2020-03-04T10:06:15Z")

</div>

Thank boss!

---

<div class="post-metadata">

**Author:** ![smontoya7UZHP](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@smontoya7UZHP](https://forum.dynamobim.com/u/smontoya7UZHP)\
**Post date:** [November 25, 2020, 3:53pm UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/4 "2020-11-25T15:53:29Z")

</div>

Hi @chuongmep,

Thanks for sharing this code. I am testing it but I get this error:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/0/6005c48ac9d010d99262d6acdaa61b71c52f3fd2.png)

I just pasted your code on a Python node. Is it there anything else I have to do?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [November 26, 2020, 6:06am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/5 "2020-11-26T06:06:03Z")

</div>

Try, i thinks that is a problem with dynamo version higher `"` vs` '`  
import clr  
clr.AddReference(“RevitAPI”)  
clr.AddReference(“RevitAPIUI”)  
from Autodesk.Revit.DB import \*  
clr.AddReference(“RevitNodes”)  
import Revit  
clr.ImportExtensions(Revit.GeometryConversion)  
clr.ImportExtensions(Revit.Elements)  
clr.AddReference(“RevitServices”)  
from RevitServices.Persistence import  
DocumentManager as DM # Document manager  
from RevitServices.Transactions import TransactionManager as TM # Transaction manager  
NewName = IN[0]  
doc = DM.Instance.CurrentDBDocument  
TM.Instance.EnsureInTransaction(doc)  
projloc = doc.ActiveProjectLocation  
NEW = projloc.Name = NewName  
TM.Instance.TransactionTaskDone()  
OUT = NewName

---

<div class="post-metadata">

**Author:** ![smontoya7UZHP](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@smontoya7UZHP](https://forum.dynamobim.com/u/smontoya7UZHP)\
**Post date:** [November 26, 2020, 10:38am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/6 "2020-11-26T10:38:10Z")

</div>

Hi @chuongmep,  
Thanks for coming back. I finally managed to make it work! It is really useful. The issue was the type of token, for some reason Dynamo 2.0.2 does not recognise ´, ’, “ or ”, but yes " or '. Maybe it is a matter of keyobard language or symbols.

By the way, now that the rename current Project Location works, I am wondering if there is a way to rename multiple Project Locations of current document. Or even better from linked documents. Sorry, I am pretty new with Python…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/0/f031fa1aebed7cdc9ce37a99c859ad8a52622a0f.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![Sergio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sergio/32/106789_2.png) [@Sergio](https://forum.dynamobim.com/u/Sergio)\
**Post date:** [November 26, 2020, 3:42pm UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/7 "2020-11-26T15:42:19Z")

</div>

Hi @chuongmep,

I managed to change name to multiple locations. Please see below. Last step that I would like to achive is to do it from a Host model to several linked instances. If you have any idea it would be appreciated. Thanks for the support!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/629dfe215ed47fdbaac437c56309cb99c80b3b60.png)

```
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

# Do some actions in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

ProjectLocations = UnwrapElement(IN[0])
NewCurrentLocationName = IN[1]
NewLocationNames = IN[2]

CurrentLocationElement = list()
NamedElementsList = list()
ExceptList = list()

CurrentLocationID = doc.ActiveProjectLocation.Id

for ProjectLocation, NewName in zip(ProjectLocations, NewLocationNames):
	try:
		if ProjectLocation.Id == CurrentLocationID:
			ProjectLocation.Name = NewCurrentLocationName
			CurrentLocationElement.append(ProjectLocation)		
		else:
			ProjectLocation.Name = NewName
			NamedElementsList.append(ProjectLocation)
	except:
		ExceptList.append("Error"+ProjectLocation.Id)
		
# Finish Transaction
TransactionManager.Instance.TransactionTaskDone()

# Final Output
OUT = [CurrentLocationElement, NamedElementsList, ExceptList]
```

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [December 2, 2020, 3:31am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/8 "2020-12-02T03:31:27Z")

</div>

Right ?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/f/6f82b7b76ffb4d08d75ead85f721a3478ae86082.png)  
[Test.dyn](https://forum.dynamobim.com/uploads/short-url/clXM2xacyVYFWyTK1Iljc14eaEI.dyn) (13.0 KB)

---

<div class="post-metadata">

**Author:** ![ahmedabdlsalamm](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ahmedabdlsalamm/32/129400_2.png) [@ahmedabdlsalamm](https://forum.dynamobim.com/u/ahmedabdlsalamm)\
**Post date:** [September 25, 2023, 11:56am UTC](https://forum.dynamobim.com/t/change-the-name-of-the-project-location-in-dynamo/47609/9 "2023-09-25T11:56:36Z")

</div>

what are the package of location.byname
