<?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: Get center bar of a Rebar Layout in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831599#M41942</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;! I'll be very attent to hear from you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2019 14:11:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-04T14:11:49Z</dc:date>
    <item>
      <title>Get center bar of a Rebar Layout</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831547#M41940</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking a way to get the center &lt;STRONG&gt;Rebar&lt;/STRONG&gt; from a &lt;STRONG&gt;Rebar Layout&lt;/STRONG&gt; (Maximum spacing). I need to get this element to get its Centerline to create a &lt;STRONG&gt;DetailLine&lt;/STRONG&gt; in the same position.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 13:53:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831547#M41940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-04T13:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get center bar of a Rebar Layout</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831576#M41941</link>
      <description>&lt;P&gt;I asked the development team for you...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 14:00:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831576#M41941</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-06-04T14:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get center bar of a Rebar Layout</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831599#M41942</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;! I'll be very attent to hear from you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 14:11:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831599#M41942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-04T14:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get center bar of a Rebar Layout</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831817#M41943</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;, by now I managed to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;double numBars = barra.NumberOfBarPositions;

                        double indice = 0;

                        // Si es Par
                        if (numBars % 2 == 0)
                        {
                            indice = (numBars / 2) - 1;
                        }

                        // Si es impar
                        else
                        {
                            indice = Math.Truncate(numBars / 2);
                        }

                        #endregion

                        #region SE CREAN LOS DETAIL LINES EN LA POSICION DE LA BARRA CENTRAL

                        if (numBars &amp;gt; 1)
                        {
                            IList&amp;lt;Curve&amp;gt; curva_patron = barra.GetCenterlineCurves(
                                true,
                                true,
                                true,
                                MultiplanarOption.IncludeOnlyPlanarCurves,
                                Convert.ToInt32(indice));

                            DetailCurve dc = doc.Create.NewDetailCurve(
                                doc.ActiveView,
                                curva_patron.First());

                            dc.LineStyle = fe_losa;
                        }&lt;/PRE&gt;&lt;P&gt;In my iteration, get the "indice" variable (index) as the number I want (the middle index), and using the&amp;nbsp;&lt;STRONG&gt;GetCenterlineCurves&lt;/STRONG&gt; with that index, I always get the first one and my detail line is created in this position.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&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: 564px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/643864i4D6AB0708A44AAE7/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;Regards!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 15:33:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8831817#M41943</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-04T15:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get center bar of a Rebar Layout</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8835626#M41944</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Jorge,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your update and congratulations on the progress.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I heard back from the development team, and they say:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The property Rebar.NumberOfBarPositions will give us the number of bars in the set.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Method Rebar.GetCenterlineCurves receives a barPositionIndex and will return the centreline curves for that bar.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I’m not sure what you mean by 'centre bar'; if in the set are 4 bars (indexes 0,1,2,3). It should be index 1 or 2?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  public IList&amp;lt;Curve&amp;gt; GetCenterlineCurves(
    bool adjustForSelfIntersection,
    bool suppressHooks,
    bool suppressBendRadius,
    MultiplanarOption multiplanarOption,
    int barPositionIndex)&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What is missing in your code: GetCenterlineCurves will return the curves as they are positioned on the first bar.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can obtain a transform which will move the curves into the desired position:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  RebarShapeDrivenAccessor accessor = rebar.GetShapeDrivenAccessor();
  Transform trf = accessor.GetBarPositionTransform(indice);
  // Now apply the trf on each curve obtained from calling GetCenterlineCurves()&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 06:29:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8835626#M41944</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-06-06T06:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get center bar of a Rebar Layout</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8837272#M41945</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following your indication I made exactly what I needed. Here is a snippet of the code II'm using so it may help some else in the future and the visual representation of what I achieved!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IList&amp;lt;Curve&amp;gt; curva_patron = barra.GetCenterlineCurves(
                                true,
                                true,
                                true,
                                MultiplanarOption.IncludeOnlyPlanarCurves,
                                Convert.ToInt32(indice));

                        // Se lleva la curva a la posicion central
                        RebarShapeDrivenAccessor accessor = barra.GetShapeDrivenAccessor();
                        Transform trf = accessor.GetBarPositionTransform(Convert.ToInt32(indice));

                        Curve curva_trans = curva_patron.First().CreateTransformed(trf);

                        DetailCurve dc = doc.Create.NewDetailCurve(
                            doc.ActiveView,
                            curva_trans);
                        dc.LineStyle = fe_losa;&lt;/PRE&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: 783px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/644869i02C60E307ECD35B1/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;Again, thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 19:40:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-center-bar-of-a-rebar-layout/m-p/8837272#M41945</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-06T19:40:40Z</dc:date>
    </item>
  </channel>
</rss>

