Using the code:
foreach (GeometryObject geometryObj in dwg.get_Geometry(new Options()))
I can loop the objects of the linked cad file. My problem is that I want to get the layer name of the object.
Thanks & Regards
Solved! Go to Solution.
Revit does not use layers.
I do not believe that a GeometryObject can be queried for that, or even has such a concept.
You might be able to open the original DWG file using AutoCAD.NET and analyse that instead.
the information is contained in the GraphicalStyle element:
GraphicsStyle gStyle = document.GetElement(geometryObj.GraphicsStyleId) as GraphicsStyle;
Thanks to Fair59 for the nice succinct answer. Promoted to a blog post:
Search the Autodesk Knowledge Network for more content.
New: Get an Activation Code
Mac OS X 10.12 Support
Windows 10 Support
Autodesk Online Store Help
Serial Numbers & Product Keys
Installation & Licensing
Online Activation & Registration
Network License Administration
Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.