<?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: GetEndPointReference null from analytical curve in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133978#M76397</link>
    <description>&lt;P&gt;I'm just lucky I guess&amp;nbsp;&lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://forums.autodesk.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I normally do if I need to do something new with the API&lt;SPAN&gt;&amp;nbsp;(and google has failed me...)&amp;nbsp;&lt;/SPAN&gt;is just go to the relevant class&amp;nbsp;definitions in visual studio and browse through the members. If I need more clarification I look it up in the API reference. If that doesn't help I just start messing with code while stepping through with the debugger to see what's actually going on. I have a good diagnostics and rapid prototyping framework which has evolved over time that handles all the boring stuff and lets me get right at the problem quickly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I'm glad to be of assistance. The main reason I get on here and try to solve problems is that it I love a good puzzle and it gets me looking into parts of the API that I havn't seen before.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jul 2014 10:31:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-07-04T10:31:45Z</dc:date>
    <item>
      <title>GetEndPointReference null from analytical curve</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5132002#M76394</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Revit 2014, I can't successfully get a point reference so I can create a boundary condition. &amp;nbsp;A null is returned and I'm not sure why (after the transaction finishes, I can manually create a boundary condition).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample code to reproduce this is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]&lt;BR /&gt;public class ImportIFCGeomGym : IExternalCommand&lt;BR /&gt;{&lt;BR /&gt;public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;Document doc = commandData.Application.ActiveUIDocument.Document;&lt;BR /&gt;Transaction trn = new Transaction(doc, "ggTest");&lt;BR /&gt;trn.Start();&lt;BR /&gt;int cat = (int)BuiltInCategory.OST_StructuralFraming;&lt;BR /&gt;FamilySymbol fs = null;&lt;BR /&gt;FilteredElementCollector fec = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol));&lt;BR /&gt;foreach (FamilySymbol f in fec)&lt;BR /&gt;{&lt;BR /&gt;if (f != null &amp;amp; f.Category.Id.IntegerValue == cat)&lt;BR /&gt;{&lt;BR /&gt;fs = f;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;Level lvl = null;&lt;BR /&gt;fec = new FilteredElementCollector(doc).OfClass(typeof(Level));&lt;BR /&gt;foreach (Level l in fec)&lt;BR /&gt;{&lt;BR /&gt;if (l != null)&lt;BR /&gt;{&lt;BR /&gt;lvl = l;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;Line line = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(0, 3, 0));&lt;BR /&gt;FamilyInstance fi = doc.Create.NewFamilyInstance(line, fs, lvl, StructuralType.Beam);&lt;BR /&gt;doc.Regenerate();&lt;BR /&gt;AnalyticalModel am = fi.GetAnalyticalModel();&lt;BR /&gt;if (am != null)&lt;BR /&gt;{&lt;BR /&gt;if (am.IsSingleCurve())&lt;BR /&gt;{&lt;BR /&gt;Autodesk.Revit.DB.Curve c = am.GetCurve();&lt;BR /&gt;if (c.GetEndPointReference(0) == null)&lt;BR /&gt;System.Windows.Forms.MessageBox.Show("Null REference!");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;trn.Commit();&lt;BR /&gt;return Result.Succeeded;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2014 13:47:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5132002#M76394</guid>
      <dc:creator>GeomGym</dc:creator>
      <dc:date>2014-07-03T13:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: GetEndPointReference null from analytical curve</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133540#M76395</link>
      <description>&lt;P&gt;I've not played with the analytical model before, but looking at the API reference I think this is what you need to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (am.IsSingleCurve())&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Autodesk.Revit.DB.Curve c = am.GetCurve();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;AnalyticalModelSelector ams =&amp;nbsp;new AnalyticalModelSelector(c, AnalyticalCurveSelector.StartPoint);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Reference startRef = am.GetReference(ams);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;if (startRef == null)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Windows.Forms.MessageBox.Show("Null REference!");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've not tested this, but it's something to try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could just be that Revit doesn't fully develop the analytical model until the transaction is commited, there's a few things that a Regenerate() just can't fix &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2014 03:43:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133540#M76395</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-07-04T03:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: GetEndPointReference null from analytical curve</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133712#M76396</link>
      <description>Hi Scott,&lt;BR /&gt;&lt;BR /&gt;Thanks for the answer, this seems to work well. I'd be interested to know where you found this in the documentation (and how). I did search for a while but didn't turn up anything like this.&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Fri, 04 Jul 2014 07:26:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133712#M76396</guid>
      <dc:creator>GeomGym</dc:creator>
      <dc:date>2014-07-04T07:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: GetEndPointReference null from analytical curve</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133978#M76397</link>
      <description>&lt;P&gt;I'm just lucky I guess&amp;nbsp;&lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://forums.autodesk.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I normally do if I need to do something new with the API&lt;SPAN&gt;&amp;nbsp;(and google has failed me...)&amp;nbsp;&lt;/SPAN&gt;is just go to the relevant class&amp;nbsp;definitions in visual studio and browse through the members. If I need more clarification I look it up in the API reference. If that doesn't help I just start messing with code while stepping through with the debugger to see what's actually going on. I have a good diagnostics and rapid prototyping framework which has evolved over time that handles all the boring stuff and lets me get right at the problem quickly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I'm glad to be of assistance. The main reason I get on here and try to solve problems is that it I love a good puzzle and it gets me looking into parts of the API that I havn't seen before.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2014 10:31:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/getendpointreference-null-from-analytical-curve/m-p/5133978#M76397</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-07-04T10:31:45Z</dc:date>
    </item>
  </channel>
</rss>

