Hi,
I have some Python dwg codes that can filter layers, polylines and points
for the last one i like to extract the point coordinates by layer name. everything is working except to get the points coordinates. anyone an idea? this code is working well with polylines.
In the picture the result i like to get under the Element.Geometry node. But my Python script gives the error…
import clr
# 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
geo_opt = Autodesk.Revit.DB.Options()
doc = DocumentManager.Instance.CurrentDBDocument
dwgImport = UnwrapElement(IN[0])
layerName = IN[1]
# Layer name to String
for name in layerName:
x = name
# Get DWG geometry
geometry = dwgImport.get_Geometry(geo_opt)
points = []
list = []
# Get geometry in DWG (Points)
for geo_inst in geometry:
geo_elem = geo_inst.GetInstanceGeometry()
for point in geo_elem:
element = doc.GetElement(point.GraphicsStyleId)
# Get Layer Names
layer = element.GraphicsStyleCategory.Name
is_point = point.GetType().Name
if is_point == "Point" and layer == x:
list.append(is_point)
for pts in point.GetCoordinates():
points.append(pts)
OUT = points