<?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: Wall.Create throwing exception in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3740751#M80042</link>
    <description>&lt;P&gt;Anyone? &amp;nbsp;Autodesk?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a simple example that throws the same exception when your selection set contains a line or wall.&lt;/P&gt;&lt;PRE&gt;public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
    UIDocument uiDoc = commandData.Application.ActiveUIDocument;

    Autodesk.Revit.UI.Selection.SelElementSet set = uiDoc.Selection.Elements;

    foreach (Element e in set)
    {
        Wall.Create(uiDoc.Document, (e.Location as LocationCurve).Curve, uiDoc.ActiveView.GenLevel.Id, false);
    }
    return Result.Succeeded;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I replace Wall.Create with the code below it works fine but this method is obsolete:&lt;/P&gt;&lt;PRE&gt;uiDoc.Document.Create.NewWall((e.Location as LocationCurve).Curve, uiDoc.ActiveView.GenLevel, false);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2012 15:22:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-12-20T15:22:11Z</dc:date>
    <item>
      <title>Wall.Create throwing exception</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3739007#M80041</link>
      <description>&lt;P&gt;I'm having trouble figuring out why the new Wall.Create method is throwing an ArgumentNullException against my curve. &amp;nbsp;What's throwing me off is that the deprecated method of creating a wall works just fine with the same curve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting the curve from another element's location property (and previously ensuring it has a curve based location and not a locationpoint)&lt;/P&gt;&lt;PRE&gt;LocationCurve lCurve = (LocationCurve)elem.Location;

curves.Append(lCurve.Curve);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My curve is not null and is of type Autodesk.Revit.DB.Line (see attachment) but throws an exception when I try to create a wall using the static Wall.Create method.&lt;/P&gt;&lt;PRE&gt;     foreach (Curve c in curveArray)
     {&lt;BR /&gt;        // This works but is deprecated
         Wall w = uidoc.Document.Create.NewWall(c, uidoc.ActiveView.GenLevel, false);&lt;BR /&gt;&lt;BR /&gt;         // This throws an ArgumentNullException (see attachment)
         Wall wall = Wall.Create(uidoc.Document, c, uidoc.ActiveView.GenLevel.Id, false);
     }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something else that changed with the new Wall.Create method or am I missing something else? &amp;nbsp;Has anyone else seen this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Dec 2012 14:33:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3739007#M80041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-18T14:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Wall.Create throwing exception</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3740751#M80042</link>
      <description>&lt;P&gt;Anyone? &amp;nbsp;Autodesk?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a simple example that throws the same exception when your selection set contains a line or wall.&lt;/P&gt;&lt;PRE&gt;public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
    UIDocument uiDoc = commandData.Application.ActiveUIDocument;

    Autodesk.Revit.UI.Selection.SelElementSet set = uiDoc.Selection.Elements;

    foreach (Element e in set)
    {
        Wall.Create(uiDoc.Document, (e.Location as LocationCurve).Curve, uiDoc.ActiveView.GenLevel.Id, false);
    }
    return Result.Succeeded;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I replace Wall.Create with the code below it works fine but this method is obsolete:&lt;/P&gt;&lt;PRE&gt;uiDoc.Document.Create.NewWall((e.Location as LocationCurve).Curve, uiDoc.ActiveView.GenLevel, false);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2012 15:22:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3740751#M80042</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-20T15:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Wall.Create throwing exception</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3754531#M80043</link>
      <description>&lt;P&gt;Hi Joe,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try with Curve.Clone() instead share the same curve between two elements. The Clone() will ensure a copy is used and avoid further problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 15:40:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/wall-create-throwing-exception/m-p/3754531#M80043</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2013-01-16T15:40:44Z</dc:date>
    </item>
  </channel>
</rss>

