ImportError: No module named RevitServices

hello everyone,when i improt the RevitServices module,i get a error like this:
error1
i’m sure that i have the dll file in my disk:
C:\Program Files\Dynamo\Dynamo Revit\2\Revit_2018\RevitServices.dll
and this my python code:

Import ProtoGeo

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

Import RevitAPI

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

Import DocumentManager and TransactionManager

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

Import ToDSType(bool) extension method

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

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

#room list
roomElements = UnwrapElement(IN[0])

#Variables for collecting list
roomElems =
roomLocations =
roomNumbers =
roomNone =

for item in roomElements:

if area is placed then get stuff

if item.Area > 0:
    location = item.Location.Point.ToPoint()

    # assign your stuff to lists	
    roomElems.append(item)
    roomNumbers.append(item.Number)
    roomLocations.append(location)
else:
        roomNone.append("Rooms not Placed")

List your stuff to the OUT variablez

OUT = roomElems, roomNumbers, roomLocations

i don’t know how to solve this issue,and i hope to get some help,thanks very much:smiley:

I met the same problem. Have you found any solutions

可能是插件引起的,在导入是添加路径就可以了。代码如下:
import sys
sys.path.append(r’C:\Program Files\Dynamo\Dynamo Revit\2\Revit_2019’)
clr.AddReference(‘RevitServices.dll’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

1 Like

Watch the double vs single quotes and make sure the quotes are correct if your copying and pasting from the web.

https://primer.dynamobim.org/10_Custom-Nodes/10-6_Python-Templates.html

It fixed my problem.Thanks

1 Like