<?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: how to add smooth AlignmentTransition in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11175948#M5417</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Thank you very much！&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;the method “AddAutoWidenings”&amp;nbsp;&lt;SPAN&gt;meets my needs。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="QQ截图20220518075912.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1068490i45AF5484B877DC67/image-size/large?v=v2&amp;amp;px=999" role="button" title="QQ截图20220518075912.jpg" alt="QQ截图20220518075912.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I convert the code to C#。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;[CommandMethod("TestOffsetAlign2")]
public void C_TestOffsetAlign2()
{
    var doc = Application.DocumentManager.MdiActiveDocument;
    var ed = doc.Editor;
    var db = doc.Database;
    var civDoc = CivilApplication.ActiveDocument;
    var entOpts = new PromptEntityOptions("\nSelect an alignment to offset:");
    entOpts.SetRejectMessage("...not an alignment, try again!");
    entOpts.AddAllowedClass(typeof(Alignment), true);
    var entSel = ed.GetEntity(entOpts);
    if (entSel.Status != PromptStatus.OK)
        return;
    List&amp;lt;AlignmentSubEntityArc&amp;gt; alignmentSubEntityArcList = new List&amp;lt;AlignmentSubEntityArc&amp;gt;();
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        //Open Main Alignment for Read
        Alignment align = tr.GetObject(entSel.ObjectId, OpenMode.ForRead) as Alignment;

        //Build List of Alignment Arcs
        foreach (AlignmentEntity alignEnt in align.Entities)
        {
            int subEntCount = System.Convert.ToInt32(alignEnt.SubEntityCount);
            for (int i = 0; i &amp;lt;= subEntCount - 1; i++)
            {
                AlignmentSubEntity alignSubEnt = alignEnt[i];

                if (alignSubEnt.SubEntityType == AlignmentSubEntityType.Arc)
                {
                    alignmentSubEntityArcList.Add(alignSubEnt as AlignmentSubEntityArc);

                }

            }
        }

        //Convert List of Arcs to Array
        AlignmentSubEntityArc[] arcs = alignmentSubEntityArcList.ToArray();

        //Create Left and Right Offset Alignments
        ObjectId offsetAlignRightId = Alignment.CreateOffsetAlignment(db, "MyOffsetAlignmentRight", align.Name, 30, "Standard");
        ObjectId offsetAlignLeftId = Alignment.CreateOffsetAlignment(db, "MyOffsetAlignmentLeft", align.Name, -30, "Standard");

        //Get Left and Right Offset Alignments
        Alignment offsetAlignRight = offsetAlignRightId.GetObject(OpenMode.ForWrite) as Alignment;
        Alignment offsetAlignLeft = offsetAlignLeftId.GetObject(OpenMode.ForWrite) as Alignment;

        //Get Left andd Right Offset Info
        OffsetAlignmentInfo offsetInfoRight = offsetAlignRight.OffsetAlignmentInfo;
        OffsetAlignmentInfo offsetInfoLeft = offsetAlignLeft.OffsetAlignmentInfo;

        //Create AutoWidening Info
        AutoWideningInfo widenInfo = new AutoWideningInfo() { IncreasedWidth = 50, Side = Autodesk.Civil.WideningSide.Both, TransitionLength = 100 };

        //Add the Left and Right AutoWidening Info
        offsetInfoRight.AddAutoWidenings(widenInfo, arcs);
        offsetInfoLeft.AddAutoWidenings(widenInfo, arcs);

        //Commit Transaction
        tr.Commit();
    }
} 

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 00:20:47 GMT</pubDate>
    <dc:creator>465340553</dc:creator>
    <dc:date>2022-05-18T00:20:47Z</dc:date>
    <item>
      <title>how to add smooth AlignmentTransition</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11171398#M5415</link>
      <description>&lt;P data-unlink="true"&gt;I reference this &lt;A href="https://forums.autodesk.com/t5/civil-3d-customization/how-to-add-offset-alignment-widening-with-in-and-out-taper/m-p/8772174" target="_blank" rel="noopener"&gt;post&lt;/A&gt;，&amp;nbsp;&lt;/P&gt;
&lt;P&gt;add widening to alignment，&lt;/P&gt;
&lt;P&gt;but the&amp;nbsp;&lt;SPAN&gt;transition isn't smooth。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I know using command “Addwidening” create&amp;nbsp; widening manually，&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I can modify the command settings “LinearTransitionAroundCurves.NumberOfSegments”，&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and then the&amp;nbsp;transition&amp;nbsp;is smooth 。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to modify the code to create a smooth transition？&lt;/P&gt;
&lt;P&gt;thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="QQ截图20220516175449.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1067681iD08B07922B083CEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="QQ截图20220516175449.jpg" alt="QQ截图20220516175449.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;[CommandMethod("TestOffsetAlign")]
public void offalign()
{
    var doc = Application.DocumentManager.MdiActiveDocument;
    var ed = doc.Editor;
    var db = doc.Database;
    var civDoc = CivilApplication.ActiveDocument;
    var entOpts = new PromptEntityOptions("\nSelect an alignment to offset:");
    entOpts.SetRejectMessage("...not an alignment, try again!");
    entOpts.AddAllowedClass(typeof(Alignment), true);
    var entSel = ed.GetEntity(entOpts);
    if (entSel.Status != PromptStatus.OK)
        return;
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        var align1 = (Alignment)tr.GetObject(entSel.ObjectId, OpenMode.ForRead);
        var align2id = Alignment.CreateOffsetAlignment("OffsetAlignment", align1.ObjectId, 10.0, align1.StyleId);
        var align2 = (Alignment)tr.GetObject(align2id, OpenMode.ForWrite);
        var oInfo = align2.OffsetAlignmentInfo;
        oInfo.AddWidening(150, 250, 20);
        var r2 = oInfo.Regions[1];
        r2.EntryTransition.TransitionType = Autodesk.Civil.TransitionType.CurveLineCurve;
        CurveLineCurveTransitionDescription entrydesc = (CurveLineCurveTransitionDescription)r2.EntryTransition.TransitionDescription;
        entrydesc.StartStation = 100;
        entrydesc.Length = 50;
        entrydesc.EntryCurveRadius = 15;
        entrydesc.ExitCurveRadius = 15;
        r2.ExitTransition.TransitionType = Autodesk.Civil.TransitionType.Linear;
        LinearTransitionDescription exitdesc = (LinearTransitionDescription)r2.ExitTransition.TransitionDescription;
        exitdesc.StartStation = 250;
        exitdesc.Length = 250;
        tr.Commit();
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 10:07:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11171398#M5415</guid>
      <dc:creator>465340553</dc:creator>
      <dc:date>2022-05-16T10:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to add smooth AlignmentTransition</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11172520#M5416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at this it may help you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/civil-3d-customization/how-to-creat-offset-alignment-that-has-widening-at-curve/td-p/9870570" target="_blank"&gt;https://forums.autodesk.com/t5/civil-3d-customization/how-to-creat-offset-alignment-that-has-widening-at-curve/td-p/9870570&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 17:26:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11172520#M5416</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2022-05-16T17:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to add smooth AlignmentTransition</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11175948#M5417</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you very much！&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;the method “AddAutoWidenings”&amp;nbsp;&lt;SPAN&gt;meets my needs。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="QQ截图20220518075912.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1068490i45AF5484B877DC67/image-size/large?v=v2&amp;amp;px=999" role="button" title="QQ截图20220518075912.jpg" alt="QQ截图20220518075912.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I convert the code to C#。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;[CommandMethod("TestOffsetAlign2")]
public void C_TestOffsetAlign2()
{
    var doc = Application.DocumentManager.MdiActiveDocument;
    var ed = doc.Editor;
    var db = doc.Database;
    var civDoc = CivilApplication.ActiveDocument;
    var entOpts = new PromptEntityOptions("\nSelect an alignment to offset:");
    entOpts.SetRejectMessage("...not an alignment, try again!");
    entOpts.AddAllowedClass(typeof(Alignment), true);
    var entSel = ed.GetEntity(entOpts);
    if (entSel.Status != PromptStatus.OK)
        return;
    List&amp;lt;AlignmentSubEntityArc&amp;gt; alignmentSubEntityArcList = new List&amp;lt;AlignmentSubEntityArc&amp;gt;();
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        //Open Main Alignment for Read
        Alignment align = tr.GetObject(entSel.ObjectId, OpenMode.ForRead) as Alignment;

        //Build List of Alignment Arcs
        foreach (AlignmentEntity alignEnt in align.Entities)
        {
            int subEntCount = System.Convert.ToInt32(alignEnt.SubEntityCount);
            for (int i = 0; i &amp;lt;= subEntCount - 1; i++)
            {
                AlignmentSubEntity alignSubEnt = alignEnt[i];

                if (alignSubEnt.SubEntityType == AlignmentSubEntityType.Arc)
                {
                    alignmentSubEntityArcList.Add(alignSubEnt as AlignmentSubEntityArc);

                }

            }
        }

        //Convert List of Arcs to Array
        AlignmentSubEntityArc[] arcs = alignmentSubEntityArcList.ToArray();

        //Create Left and Right Offset Alignments
        ObjectId offsetAlignRightId = Alignment.CreateOffsetAlignment(db, "MyOffsetAlignmentRight", align.Name, 30, "Standard");
        ObjectId offsetAlignLeftId = Alignment.CreateOffsetAlignment(db, "MyOffsetAlignmentLeft", align.Name, -30, "Standard");

        //Get Left and Right Offset Alignments
        Alignment offsetAlignRight = offsetAlignRightId.GetObject(OpenMode.ForWrite) as Alignment;
        Alignment offsetAlignLeft = offsetAlignLeftId.GetObject(OpenMode.ForWrite) as Alignment;

        //Get Left andd Right Offset Info
        OffsetAlignmentInfo offsetInfoRight = offsetAlignRight.OffsetAlignmentInfo;
        OffsetAlignmentInfo offsetInfoLeft = offsetAlignLeft.OffsetAlignmentInfo;

        //Create AutoWidening Info
        AutoWideningInfo widenInfo = new AutoWideningInfo() { IncreasedWidth = 50, Side = Autodesk.Civil.WideningSide.Both, TransitionLength = 100 };

        //Add the Left and Right AutoWidening Info
        offsetInfoRight.AddAutoWidenings(widenInfo, arcs);
        offsetInfoLeft.AddAutoWidenings(widenInfo, arcs);

        //Commit Transaction
        tr.Commit();
    }
} 

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 00:20:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-add-smooth-alignmenttransition/m-p/11175948#M5417</guid>
      <dc:creator>465340553</dc:creator>
      <dc:date>2022-05-18T00:20:47Z</dc:date>
    </item>
  </channel>
</rss>

