<?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 Re: Generate Direct Shape from Selected Wall Geometry in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344964#M25768</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;thank you for the quick response. I got the solids and created the direct shape this way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zrodgersTSSSU_0-1622134560911.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/923826iCCD69CBC6B056FAC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zrodgersTSSSU_0-1622134560911.png" alt="zrodgersTSSSU_0-1622134560911.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Element elem = uidoc.Document.GetElement(elemId);
                                    if((BuiltInCategory)elem.Category.Id.IntegerValue == BuiltInCategory.OST_Walls)
                                    {
                                        
                                        Options opts = new Options();
                                        opts.ComputeReferences = true;
                                        opts.IncludeNonVisibleObjects = true;
                                        
                                        GeometryElement geoEle = elem.get_Geometry(opts);

                                        foreach (GeometryObject geomObj in geoEle)
                                        {
                                            Solid geomSolid = geomObj as Solid;
                                            if (null != geomSolid)
                                            {

                                                DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_Walls));
                                                ds.ApplicationId = "Application id";
                                                ds.ApplicationDataId = "Geometry object id";
                                                ds.SetShape(new GeometryObject[] {geomSolid});
 
                                            }
                                        }&lt;/LI-CODE&gt;&lt;P&gt;however... when i run it it gives me 4 extra solids.... seem to be faces. any idea how to only get the solid in the back?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zrodgersTSSSU_1-1622134687676.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/923830iB8240988D22558B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zrodgersTSSSU_1-1622134687676.png" alt="zrodgersTSSSU_1-1622134687676.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 May 2021 16:58:13 GMT</pubDate>
    <dc:creator>zrodgersTSSSU</dc:creator>
    <dc:date>2021-05-27T16:58:13Z</dc:date>
    <item>
      <title>Generate Direct Shape from Selected Wall Geometry</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344645#M25766</link>
      <description>&lt;P&gt;Hey Everyone, So dynamo allows you to get an elements geometry and then create a direct shape from the returned geometry. I am trying to do that same thing with API. I want to select a wall get its geometry and then create a direct shape that reflects all the openings in the wall.&amp;nbsp; I originally was going to copy and paste the wall in place then rotate it but revit doesnt alow you to rotate walls in the direction i want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zrodgersTSSSU_1-1622128417720.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/923785i4B3565BB93DA4CA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zrodgersTSSSU_1-1622128417720.png" alt="zrodgersTSSSU_1-1622128417720.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using (Transaction tx = new Transaction(doc))
                        {
                            tx.Start("Generate Tilt Wall");
                            foreach (ElementId elemId in selectedIds)
                            {
                                try
                                {
                                    Element elem = uidoc.Document.GetElement(elemId);
                                    if((BuiltInCategory)elem.Category.Id.IntegerValue == BuiltInCategory.OST_Walls)
                                    {
                                        Options opts = new Options();
                                        GeometryElement geoEle = elem.get_Geometry(opts);

                                        
                                        XYZ newloc = new XYZ(0, 0, 0);

                                        //gets wall curve for rotation
                                        Curve eleCurve = (elem.Location as LocationCurve).Curve;
                                        XYZ startPoint = eleCurve.GetEndPoint(0);
                                        XYZ endPoint = eleCurve.GetEndPoint(1);

                                        //need to set this equal to something so i can modify it
                                        //ICollection&amp;lt;ElementId&amp;gt; newElemColl = ElementTransformUtils.CopyElement(doc, elemId, newloc);
                                        //ElementId newEleId = newElemColl.First();

                                        XYZ pt1 = new XYZ(0, 0, 0);
                                        XYZ pt2 = new XYZ(0, 0, 10);
                                        Line axis = Line.CreateBound(pt1, pt2);

                                        //ElementTransformUtils.RotateElement(doc, newEleId, axis, rotAngle);

                                        DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_Walls));
                                        ds.ApplicationId = "Application id";
                                        ds.ApplicationDataId = "Geometry object id";
                                        ds.SetShape(new GeometryObject[] { geoEle });

                                       
                                        

                                    }

                                }
                                catch(Exception e) { throw e; }
                            }

                            


                            tx.Commit();
                        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zrodgersTSSSU_0-1622128329531.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/923784i13F6AC4C53A91C77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zrodgersTSSSU_0-1622128329531.png" alt="zrodgersTSSSU_0-1622128329531.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 15:16:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344645#M25766</guid>
      <dc:creator>zrodgersTSSSU</dc:creator>
      <dc:date>2021-05-27T15:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Direct Shape from Selected Wall Geometry</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344880#M25767</link>
      <description>&lt;P&gt;From DirectShapeType.SetShape&amp;nbsp; method noted in Revit API.chm:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;&lt;EM&gt;pGeomArr&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;&lt;EM&gt;Type: System.Collections.Generic.IList&amp;lt;(Of &amp;lt;(&amp;lt;'GeometryObject&amp;gt;)&amp;gt;)&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;&lt;EM&gt;Shape of this object expressed as a collection of GeometryObjects. These will be copied. Shape and Category should be consistent: geometry supplied as shape should be valid for the Category the type object is associated with. The &lt;U&gt;&lt;STRONG&gt;supported types of GeometryObjects are: Solid, Mesh, GeometryInstance, Point, Curve and PolyLine. &lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e. GeometryElement (a collection of primitives) is not a supported GeometryObject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to take the items out of it that are supported above and put them in your input list of GeometryObject.&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 16:42:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344880#M25767</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-05-27T16:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Direct Shape from Selected Wall Geometry</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344964#M25768</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;thank you for the quick response. I got the solids and created the direct shape this way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zrodgersTSSSU_0-1622134560911.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/923826iCCD69CBC6B056FAC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zrodgersTSSSU_0-1622134560911.png" alt="zrodgersTSSSU_0-1622134560911.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Element elem = uidoc.Document.GetElement(elemId);
                                    if((BuiltInCategory)elem.Category.Id.IntegerValue == BuiltInCategory.OST_Walls)
                                    {
                                        
                                        Options opts = new Options();
                                        opts.ComputeReferences = true;
                                        opts.IncludeNonVisibleObjects = true;
                                        
                                        GeometryElement geoEle = elem.get_Geometry(opts);

                                        foreach (GeometryObject geomObj in geoEle)
                                        {
                                            Solid geomSolid = geomObj as Solid;
                                            if (null != geomSolid)
                                            {

                                                DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_Walls));
                                                ds.ApplicationId = "Application id";
                                                ds.ApplicationDataId = "Geometry object id";
                                                ds.SetShape(new GeometryObject[] {geomSolid});
 
                                            }
                                        }&lt;/LI-CODE&gt;&lt;P&gt;however... when i run it it gives me 4 extra solids.... seem to be faces. any idea how to only get the solid in the back?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zrodgersTSSSU_1-1622134687676.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/923830iB8240988D22558B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zrodgersTSSSU_1-1622134687676.png" alt="zrodgersTSSSU_1-1622134687676.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 16:58:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344964#M25768</guid>
      <dc:creator>zrodgersTSSSU</dc:creator>
      <dc:date>2021-05-27T16:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Direct Shape from Selected Wall Geometry</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344990#M25769</link>
      <description>&lt;P&gt;You are including non-visible objects:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;opts.IncludeNonVisibleObjects = true&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would set that to false, have a look in RevitLookup to try an understand their meaning. Could be related to layers or references within the wall (not necessarily useful).&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 17:06:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10344990#M25769</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-05-27T17:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Direct Shape from Selected Wall Geometry</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10345006#M25770</link>
      <description>&lt;P&gt;Thank you that worked!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 17:09:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/generate-direct-shape-from-selected-wall-geometry/m-p/10345006#M25770</guid>
      <dc:creator>zrodgersTSSSU</dc:creator>
      <dc:date>2021-05-27T17:09:03Z</dc:date>
    </item>
  </channel>
</rss>

