<?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 Failed to Edit the sketches of the walls using C# in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/failed-to-edit-the-sketches-of-the-walls-using-c/m-p/11783775#M13658</link>
    <description>&lt;P&gt;Hi Revit users.&amp;nbsp;&lt;BR /&gt;I was trying to see how can I create walls and edit their sketches(Profile)&amp;nbsp; via C# . I have written this code .&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get Document and UIDocument&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;UIDocument uidoc = commandData.Application.ActiveUIDocument;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Level lev = collector.Where(e =&amp;gt; e.Name.Contains("1")).First() as Level;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;IList&amp;lt;Curve&amp;gt; curves = new List&amp;lt;Curve&amp;gt;();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p1 = new XYZ(0, 0, 0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p2 = new XYZ(50, 50, 0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p3 = new XYZ(0, 0, 20);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p4 = new XYZ(50, 50, 10);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ referencevector = new XYZ(0, 0, 1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l1 = Line.CreateBound(p1, p2);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l2 = Line.CreateBound(p2, p3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l3 = Line.CreateBound(p3, p4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l4 = Line.CreateBound(p4, p3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l2);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Transaction transaction1 = new Transaction(doc);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;transaction1.Start("Create Wall");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Wall w1 = Wall.Create(doc, curves, true);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;transaction1.Commit();&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;return Result.Succeeded;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;BR /&gt;I am getting this error&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Failed Wall.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1181772iF313000836A8CA34/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Failed Wall.PNG" alt="Failed Wall.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; What am I doing wrong ? and how can I edit these sketches. I'd appreciate any answer.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wall Profile Shape.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1181774i0C15AC25DEE0E176/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wall Profile Shape.PNG" alt="Wall Profile Shape.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Mon, 27 Feb 2023 09:15:05 GMT</pubDate>
    <dc:creator>ahmadkhalaf7892</dc:creator>
    <dc:date>2023-02-27T09:15:05Z</dc:date>
    <item>
      <title>Failed to Edit the sketches of the walls using C#</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/failed-to-edit-the-sketches-of-the-walls-using-c/m-p/11783775#M13658</link>
      <description>&lt;P&gt;Hi Revit users.&amp;nbsp;&lt;BR /&gt;I was trying to see how can I create walls and edit their sketches(Profile)&amp;nbsp; via C# . I have written this code .&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get Document and UIDocument&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;UIDocument uidoc = commandData.Application.ActiveUIDocument;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Level lev = collector.Where(e =&amp;gt; e.Name.Contains("1")).First() as Level;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;IList&amp;lt;Curve&amp;gt; curves = new List&amp;lt;Curve&amp;gt;();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p1 = new XYZ(0, 0, 0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p2 = new XYZ(50, 50, 0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p3 = new XYZ(0, 0, 20);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p4 = new XYZ(50, 50, 10);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ referencevector = new XYZ(0, 0, 1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l1 = Line.CreateBound(p1, p2);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l2 = Line.CreateBound(p2, p3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l3 = Line.CreateBound(p3, p4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l4 = Line.CreateBound(p4, p3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l2);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Transaction transaction1 = new Transaction(doc);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;transaction1.Start("Create Wall");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Wall w1 = Wall.Create(doc, curves, true);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;transaction1.Commit();&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;return Result.Succeeded;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;BR /&gt;I am getting this error&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Failed Wall.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1181772iF313000836A8CA34/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Failed Wall.PNG" alt="Failed Wall.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; What am I doing wrong ? and how can I edit these sketches. I'd appreciate any answer.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wall Profile Shape.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1181774i0C15AC25DEE0E176/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wall Profile Shape.PNG" alt="Wall Profile Shape.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 09:15:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/failed-to-edit-the-sketches-of-the-walls-using-c/m-p/11783775#M13658</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-02-27T09:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to Edit the sketches of the walls using C#</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/failed-to-edit-the-sketches-of-the-walls-using-c/m-p/11783822#M13659</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get Document and UIDocument&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;UIDocument uidoc = commandData.Application.ActiveUIDocument;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Level lev = collector.Where(e =&amp;gt; e.Name.Contains("1")).First() as Level;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// create an ilist for the curevs&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;IList&amp;lt;Curve&amp;gt; curves = new List&amp;lt;Curve&amp;gt;();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p1 = new XYZ(0, 0, 0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p2 = new XYZ(50, 50, 0);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p3 = new XYZ(50, 50, 500);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p4 = new XYZ(0, 0, 20);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// create the curves&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ referencevector = new XYZ(0, 0, 1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l1 = Line.CreateBound(p1, p2);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l2 = Line.CreateBound(p2, p3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l3 = Line.CreateBound(p3, p4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve l4 = Line.CreateBound(p4, p1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l2);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l3);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(l4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Transaction transaction1 = new Transaction(doc);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;transaction1.Start("Create Wall");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Wall w1 = Wall.Create(doc, curves, true);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;transaction1.Commit();&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;return Result.Succeeded;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;BR /&gt;Apparently I was using a wrong Command and list of points&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 09:39:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/failed-to-edit-the-sketches-of-the-walls-using-c/m-p/11783822#M13659</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-02-27T09:39:02Z</dc:date>
    </item>
  </channel>
</rss>

