<?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: Document.Create.NewFamilyInstance places element with wrong Z-coordinate in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601658#M33441</link>
    <description>&lt;P&gt;Ok, so I think I've figured out the problem...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I get the point for the target element I get the absolute Z-offset not the floor offset! So I first have to get the parameter value and create a new XYZ like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var floorOffset = targetElement.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).AsDouble()
var offset = new XYZ(targetObjectPoint.X, targetObjectPoint.Y, floorOffset);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A little bit weird that you get the absolute offset value, not the floor offset value, but at the same time it makes sense. Maybe there should be a more intuitive way to get the floor offset.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2020 15:29:16 GMT</pubDate>
    <dc:creator>ottosson_mathias</dc:creator>
    <dc:date>2020-06-25T15:29:16Z</dc:date>
    <item>
      <title>Document.Create.NewFamilyInstance places element with wrong Z-coordinate</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601107#M33438</link>
      <description>&lt;P&gt;I'm trying to place a new element next to another element.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;To do this I have the target element location, which I use to create the new element in the exact same position, as a start... But here is where thing go wrong!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var targetLocation = targetElement.Location as LocationPoint;

var newElement = doc.Create.NewFamilyInstance(targetLocation.Point, familySymbol, targetElement.LevelId, StructuralType.NonStructural);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I debug and set a break point after the element has been created newElement has position 0, 0, 0! This gets updated after the transaction has been committed, which is fine I guess...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After the commit the element X and Y-coordinates are correct, but not Z which now is a much larger (I've made sure the targetElement.LevelId is correct for the newElement).&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="Z-issue.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/788201i45575A68F22D3E87/image-size/large?v=v2&amp;amp;px=999" role="button" title="Z-issue.png" alt="Z-issue.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why has the element got correct coordinates in X and Y but not in Z?&lt;BR /&gt;Bonus question: Why is the new element position 0, 0, 0 after creation before transaction has been committed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently testing my code with Revit 2018.3.3.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 12:03:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601107#M33438</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2020-06-25T12:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Document.Create.NewFamilyInstance places element with wrong Z-coordinate</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601330#M33439</link>
      <description>&lt;P&gt;What's the elevation of the level you are inserting on?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did a quick review of my code where I use&amp;nbsp;NewFamilyInstance. I pass the Z-coordinate as 0 and my instance ends up at the elevation of my level. Try setting Z to 0 and see what happens.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 13:27:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601330#M33439</guid>
      <dc:creator>David_Robison</dc:creator>
      <dc:date>2020-06-25T13:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Document.Create.NewFamilyInstance places element with wrong Z-coordinate</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601351#M33440</link>
      <description>&lt;P&gt;No luck... then the Z-elevation is 0 from the current level... as you'd expect!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe it has something to do with units being handled differently for Z-offset? Which feels extremely unintuitive...&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 13:37:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601351#M33440</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2020-06-25T13:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Document.Create.NewFamilyInstance places element with wrong Z-coordinate</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601658#M33441</link>
      <description>&lt;P&gt;Ok, so I think I've figured out the problem...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I get the point for the target element I get the absolute Z-offset not the floor offset! So I first have to get the parameter value and create a new XYZ like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var floorOffset = targetElement.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).AsDouble()
var offset = new XYZ(targetObjectPoint.X, targetObjectPoint.Y, floorOffset);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A little bit weird that you get the absolute offset value, not the floor offset value, but at the same time it makes sense. Maybe there should be a more intuitive way to get the floor offset.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 15:29:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-create-newfamilyinstance-places-element-with-wrong-z/m-p/9601658#M33441</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2020-06-25T15:29:16Z</dc:date>
    </item>
  </channel>
</rss>

