<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Imported CAD Data with LayerName in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/11135902#M19368</link>
    <description>&lt;P&gt;I am importing solid geometry from dwg Imports and then using those points to generate topo’s.&amp;nbsp; The simplified code that gets the points is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The project is experimental at the moment.&amp;nbsp; The dwg’s include multiple objects other than just terrain so I need to be able to identify the “terrain” objects from the other objects.&amp;nbsp; Clearly the layer name would be an ideal candidate for that.&amp;nbsp; From &lt;A href="https://forum.dynamobim.com/t/revit-api-import-instance-query/5550" target="_blank" rel="noopener"&gt;this post&lt;/A&gt; I can see that a list of layers can be obtained from ImportInstance.Category.SubCategories but I’ve not managed to reconcile the items in that list with the individual geometry objects.&amp;nbsp; This question was &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/how-to-get-layers-information-of-a-importinstance/td-p/5453105" target="_blank" rel="noopener"&gt;asked in 2014&lt;/A&gt; and I’m wondering / hoping that its moved on and we can somehow filter the imported object by Layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ImportInstance dwg = MyImportInstance;

foreach (GeometryObject geometryObj in dwg.get_Geometry(opt))
{
	if (geometryObj is GeometryInstance)
	{
		GeometryInstance dwgInstance = geometryObj as GeometryInstance;

		GeometryElement instanceGeometryElement = dwgInstance.GetSymbolGeometry();
		foreach (GeometryObject instObj in instanceGeometryElement)
		{
			// In this case i'm only interested in Solids.
			// But object might be Mesh, PolyLine, Line, Arc, Etc.
			if (instObj is Solid)
			{
				Solid solid = instObj as Solid;
				if (null == solid || 0 == solid.Faces.Size || 0 == solid.Edges.Size)
					continue;

				// Get the faces and edges from solid
				foreach (Face face in solid.Faces)
				{
					Mesh mesh = face.Triangulate();

					// get points on the mesh and process as required, put into collections, etc.
				}
			}
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2022 17:09:07 GMT</pubDate>
    <dc:creator>grahamcook</dc:creator>
    <dc:date>2022-04-28T17:09:07Z</dc:date>
    <item>
      <title>Imported CAD Data with LayerName</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/11135902#M19368</link>
      <description>&lt;P&gt;I am importing solid geometry from dwg Imports and then using those points to generate topo’s.&amp;nbsp; The simplified code that gets the points is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The project is experimental at the moment.&amp;nbsp; The dwg’s include multiple objects other than just terrain so I need to be able to identify the “terrain” objects from the other objects.&amp;nbsp; Clearly the layer name would be an ideal candidate for that.&amp;nbsp; From &lt;A href="https://forum.dynamobim.com/t/revit-api-import-instance-query/5550" target="_blank" rel="noopener"&gt;this post&lt;/A&gt; I can see that a list of layers can be obtained from ImportInstance.Category.SubCategories but I’ve not managed to reconcile the items in that list with the individual geometry objects.&amp;nbsp; This question was &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/how-to-get-layers-information-of-a-importinstance/td-p/5453105" target="_blank" rel="noopener"&gt;asked in 2014&lt;/A&gt; and I’m wondering / hoping that its moved on and we can somehow filter the imported object by Layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ImportInstance dwg = MyImportInstance;

foreach (GeometryObject geometryObj in dwg.get_Geometry(opt))
{
	if (geometryObj is GeometryInstance)
	{
		GeometryInstance dwgInstance = geometryObj as GeometryInstance;

		GeometryElement instanceGeometryElement = dwgInstance.GetSymbolGeometry();
		foreach (GeometryObject instObj in instanceGeometryElement)
		{
			// In this case i'm only interested in Solids.
			// But object might be Mesh, PolyLine, Line, Arc, Etc.
			if (instObj is Solid)
			{
				Solid solid = instObj as Solid;
				if (null == solid || 0 == solid.Faces.Size || 0 == solid.Edges.Size)
					continue;

				// Get the faces and edges from solid
				foreach (Face face in solid.Faces)
				{
					Mesh mesh = face.Triangulate();

					// get points on the mesh and process as required, put into collections, etc.
				}
			}
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 17:09:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/11135902#M19368</guid>
      <dc:creator>grahamcook</dc:creator>
      <dc:date>2022-04-28T17:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Imported CAD Data with LayerName</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/11137154#M19369</link>
      <description>&lt;P&gt;I am not an expert in the Revit UI. I would hope and expect there to be some kind of option in there to assign different graphics styles to the different imported CAD layers. Then, you might be able to pick up and differentiate those different styles in your code snippet by checking the GeometryObject &lt;U&gt;GraphicsStyleId&lt;/U&gt; property:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2022/4103f148-957e-3f44-9ccd-a5ed6702c689.htm" target="_blank"&gt;https://www.revitapidocs.com/2022/4103f148-957e-3f44-9ccd-a5ed6702c689.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 06:26:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/11137154#M19369</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-04-29T06:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Imported CAD Data with LayerName</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/13302474#M19370</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1070920"&gt;@grahamcook&lt;/a&gt;&amp;nbsp;were you able to solve your problem?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 22:48:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/13302474#M19370</guid>
      <dc:creator>sensiblehira</dc:creator>
      <dc:date>2025-02-05T22:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Imported CAD Data with LayerName</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/13302477#M19371</link>
      <description>&lt;P&gt;I just need to filter Geometries based on Layers&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 22:49:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/imported-cad-data-with-layername/m-p/13302477#M19371</guid>
      <dc:creator>sensiblehira</dc:creator>
      <dc:date>2025-02-05T22:49:23Z</dc:date>
    </item>
  </channel>
</rss>

