<?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: Grid Element Curve misbehavior? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778513#M52454</link>
    <description>&lt;P&gt;Hi Jeremy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm actually trying to achieve more functionality. I need to control the correct orientation because I'm creating&amp;nbsp;sections automatically. I need them to be according to the plan visualization standards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope the next images can help to understand what I'm trying to achieve:&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="Grids positioned  parallel to X and Y axis." style="width: 541px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463148i25A4A32CD34C379D/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="Grids positioned  parallel to X and Y axis." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Grids positioned  parallel to X and Y axis.&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Grids positioned in a diagonal location." style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463150i4BF2EE4150A30C04/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="Grids positioned in a diagonal location." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Grids positioned in a diagonal location.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I don't have control of the orientation, the section that I'm building is created in the opposite direction and you see the element's flipped in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2018 20:45:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-02-14T20:45:56Z</dc:date>
    <item>
      <title>Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778140#M52452</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm dealing with some issues with the curves geometry from the grid elements. In my code I asked to get te StartPoint and End Point for every grid to do some stuff later with the curve orientation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I draw the grids like in the orientation as the following image:&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="image.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463089iEE92DAF083BA21EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The result I got is as follows:&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="image.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463093iF6F6A021E1DC8BD1/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see in the schedule, the Start Point coordinates indicate that the curves were created in the opposite direction. Just to show in more detail the issue, I replicated the example in DYnamo and got the same conclusion:&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="image.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463094iC9201725DCFB554A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I would like to know:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.- What am I missing here?&lt;/P&gt;&lt;P&gt;2.- If I replicate this procedure with a wall element (for ex.) using the location of the wall, I get the coordinates according to the drawn orientation. So, Are grids working in a different&amp;nbsp;way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 18:48:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778140#M52452</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-14T18:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778398#M52453</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest you add functionality to your code to make it independent of the line start and end point orientation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not believe that Revit will guarantee any specific direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you need them oriented in a specific direction?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 20:07:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778398#M52453</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-14T20:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778513#M52454</link>
      <description>&lt;P&gt;Hi Jeremy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm actually trying to achieve more functionality. I need to control the correct orientation because I'm creating&amp;nbsp;sections automatically. I need them to be according to the plan visualization standards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope the next images can help to understand what I'm trying to achieve:&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="Grids positioned  parallel to X and Y axis." style="width: 541px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463148i25A4A32CD34C379D/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="Grids positioned  parallel to X and Y axis." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Grids positioned  parallel to X and Y axis.&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Grids positioned in a diagonal location." style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/463150i4BF2EE4150A30C04/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="Grids positioned in a diagonal location." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Grids positioned in a diagonal location.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I don't have control of the orientation, the section that I'm building is created in the opposite direction and you see the element's flipped in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 20:45:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778513#M52454</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-14T20:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778620#M52455</link>
      <description>&lt;P&gt;Can\t you create the section in the opposite opposite direction&amp;nbsp;in the cases when that is what you need?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 21:24:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7778620#M52455</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-14T21:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7779963#M52456</link>
      <description>&lt;P&gt;Hi Jeremy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exactly, but I just to know the orientation first to pick those cases. I'm actually doing what you mentioned and it works just fine. The question I was looking here was why a grid element created from Left to Right has the Curve start point at the right and the end at the left.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it just happening&amp;nbsp;with grid elements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 11:21:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7779963#M52456</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-15T11:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780014#M52457</link>
      <description>&lt;P&gt;One thing you can probably do is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Determine whether the curve orientation is the way you require.&lt;/LI&gt;
&lt;LI&gt;If not, read the existing curve, invert its direction, and use Grid.SetCurveInView to flip it:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2018.1/eaff0038-34f2-03cf-185b-2872cffb84af.htm" target="_blank"&gt;http://www.revitapidocs.com/2018.1/eaff0038-34f2-03cf-185b-2872cffb84af.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 11:41:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780014#M52457</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-15T11:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780042#M52458</link>
      <description>&lt;P&gt;Thanks, Jeremy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already did something pointing in that direction. I'll dig into the method you mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private bool direccionCurva(XYZ sp, XYZ ep)
        {
            //Caso que las curvas sean paralelas al eje Y
            if(Math.Round(sp.X, 2) == Math.Round(ep.X, 2))
            {
                if (Math.Round(sp.Y, 2) &amp;gt; Math.Round(ep.Y, 2)) {
                    return false;
                }
                else
                {
                    return true;
                }
            }

            //Caso que las curvas sean paralelas al eje X
            else if (Math.Round(sp.Y, 2) == Math.Round(ep.Y, 2))
            {
                if (Math.Round(sp.X, 2) &amp;gt; Math.Round(ep.X, 2))
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }

            //Caso que las curvas sean paralelas al eje X
            else if (Math.Round(sp.X, 2) &amp;lt; Math.Round(ep.X, 2) &amp;amp;&amp;amp; Math.Round(sp.Y, 2) != Math.Round(ep.Y, 2))
            {
                return true;
            }
            else
            {
                return false;
            }

        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 11:50:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780042#M52458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-15T11:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780235#M52459</link>
      <description>&lt;P&gt;You can simplify&amp;nbsp;your approach using a comparison operator, which might look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    public static int Compare(
      double a,
      double b,
      double tolerance = _eps )
    {
      return IsEqual( a, b, tolerance ) 
        ? 0 
        : ( a &amp;lt; b ? -1 : 1 );
    }

    public static int Compare( 
      XYZ p, 
      XYZ q )
    {
      int d = Compare( p.X, q.X );

      if( 0 == d )
      {
        d = Compare( p.Y, q.Y );

        if( 0 == d )
        {
          d = Compare( p.Z, q.Z );
        }
      }
      return d;
    }&lt;/PRE&gt;
&lt;P&gt;This is part of The Building Coder samples:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/Util.cs#L58-L99" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/Util.cs#L58-L99&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 13:02:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780235#M52459</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-15T13:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Grid Element Curve misbehavior?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780352#M52460</link>
      <description>&lt;P&gt;Thanks for the recommendation Jeremy. I'll include it in my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 13:36:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/grid-element-curve-misbehavior/m-p/7780352#M52460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-15T13:36:58Z</dc:date>
    </item>
  </channel>
</rss>

