<?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 回复： Finding Baseline Name with COM Interface in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12297712#M2929</link>
    <description>&lt;P&gt;I don't think so，&lt;/P&gt;
&lt;P&gt;Corridors are different，&lt;/P&gt;
&lt;P&gt;Baselines are different.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Oct 2023 00:49:41 GMT</pubDate>
    <dc:creator>465340553</dc:creator>
    <dc:date>2023-10-11T00:49:41Z</dc:date>
    <item>
      <title>Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12269284#M2926</link>
      <description>&lt;P&gt;The following code comes from C:\ProgramData\Autodesk\C3D 2023\enu\Data\Reports\Net\Source\C3DReports\C3DReports.vbproj&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that cycling through the Baselines (COM) gives you only the alignment name associated with the Baseline and the same alignment name can be in use for multiple baselines. The Using section has been added to show it is easy to cycle through the baselines (NET) and get all the baseline names. There doesn't seem to be a method for translating the COM object to .NET.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could assume that when cycling through the order is the same in .NET and COM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;' this works&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Dim sampleLineGroupId As ObjectId = FromAcadObject(AeccLandLib.AeccSampleLineGroup)&lt;/P&gt;&lt;P&gt;Dim oSampleLineGroup As SampleLineGroup = trans.GetObject(sampleLineGroupId , OpenMode.ForRead)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;' this does not work&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Dim baseLineGroupId As ObjectId = FromAcadObject(AeccRoadLib.AeccBaseline)&lt;/P&gt;&lt;P&gt;Dim oBaseline As Baseline = trans.GetObject(oBaseline, OpenMode.ForRead)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code from ReportForm_CorridorSlopeStake:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        For Each oBaseline As AeccRoadLib.IAeccBaseline In oCorridor.Baselines
            If oCorridorInfo.mBaselines.ContainsKey(oBaseline.Alignment.Name) = False Then
                Dim oBaselineInfo As CBaseline
                oBaselineInfo = New CBaseline

                Dim currentSamplelineGroupCount As Integer = 0
                Dim currentSamplelineCount As Integer = 0
                Dim currentLinkCodesGroupCount As Integer = 0
                Dim currentBaselineName As String = ""

                Using trans As Transaction = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction
                    Dim doc As CivilDocument = CivilApplication.ActiveDocument
                    For Each objId As ObjectId In doc.CorridorCollection
                        Dim objCorridor As Corridor = trans.GetObject(objId, OpenMode.ForRead)
                        For Each baselineEnt As Baseline In objCorridor.Baselines
                            currentBaselineName = baselineEnt.Name
                            Dim alignmentEnt As Alignment = trans.GetObject(baselineEnt.AlignmentId, OpenMode.ForRead)
                            currentBaselineName = baselineEnt.Name &amp;amp; " - " &amp;amp; alignmentEnt.Name
                        Next
                    Next
                End Using

                If buildBaselineInfo(oBaseline, oBaselineInfo, currentSamplelineGroupCount, currentSamplelineCount, currentLinkCodesGroupCount) Then
                    oCorridorInfo.mBaselines.Add(oBaseline.Alignment.Name, oBaselineInfo)
                End If

                samplelineGroupCount += currentSamplelineGroupCount
                samplelineCount += currentSamplelineCount
                linkCodesGroupCount += currentLinkCodesGroupCount
            End If
        Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 07:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12269284#M2926</guid>
      <dc:creator>GTVic</dc:creator>
      <dc:date>2023-09-27T07:45:47Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12290829#M2927</link>
      <description>&lt;P&gt;Baseline probably not Database Object，&lt;/P&gt;
&lt;P&gt;There is no correspondent ObjectID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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="465340553_1-1696662773228.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1276374i3B8780A5730312FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="465340553_1-1696662773228.png" alt="465340553_1-1696662773228.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2023 07:13:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12290829#M2927</guid>
      <dc:creator>465340553</dc:creator>
      <dc:date>2023-10-07T07:13:03Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12296891#M2928</link>
      <description>&lt;P&gt;Thanks, that makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I assume the following code retrieves the exact same baselines in the same order in any drawing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;' COM loop
For Each oBaseline As AeccRoadLib.IAeccBaseline In oCorridor.Baselines
' NET loop
For Each baselineEnt As Baseline In objCorridor.Baselines&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 16:44:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12296891#M2928</guid>
      <dc:creator>GTVic</dc:creator>
      <dc:date>2023-10-10T16:44:11Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12297712#M2929</link>
      <description>&lt;P&gt;I don't think so，&lt;/P&gt;
&lt;P&gt;Corridors are different，&lt;/P&gt;
&lt;P&gt;Baselines are different.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 00:49:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12297712#M2929</guid>
      <dc:creator>465340553</dc:creator>
      <dc:date>2023-10-11T00:49:41Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302540#M2930</link>
      <description>I'll ask the question in a different way.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Assuming oCorridor and objCorridor are COM and .NET variables that point to the exact same corridor, would each For loop return the baselines for that corridor in the same order?&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Oct 2023 21:11:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302540#M2930</guid>
      <dc:creator>GTVic</dc:creator>
      <dc:date>2023-10-12T21:11:22Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302850#M2931</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;public void C_Test20231013()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    var comCivilDoc = (Autodesk.AECC.Interop.UiLand.AeccDocument)((Autodesk.AECC.Interop.UiLand.AeccApplication)((AcadApplication)Application.AcadApplication).GetInterfaceObject("AeccXUiland.AeccApplication.12.0")).ActiveDocument;// civil 3d 2018
    using (Transaction tr = doc.TransactionManager.StartTransaction())
    {
        var corridorId = CivilApplication.ActiveDocument.CorridorCollection[0];
        var netCorridor = corridorId.GetObject(OpenMode.ForRead) as Corridor;
        doc.Editor.WriteMessage("\n.Net baseline Info");
        foreach (var bl in netCorridor.Baselines)
        {
            //doc.Editor.WriteMessage("\n" + bl.Name);
            doc.Editor.WriteMessage("\n" + bl.StartStation);
            doc.Editor.WriteMessage("\t" + bl.EndStation);
        }
        Autodesk.AECC.Interop.Roadway.IAeccCorridor comCorridor = comCivilDoc.ObjectIdToObject(corridorId.OldIdPtr.ToInt64());
        doc.Editor.WriteMessage("\nCom baseline Info");
        foreach (Autodesk.AECC.Interop.Roadway.AeccBaseline bl in comCorridor.Baselines)
        {
            //doc.Editor.WriteMessage("\n" + bl.Name);
            doc.Editor.WriteMessage("\n" + bl.StartStation);
            doc.Editor.WriteMessage("\t" + bl.EndStation);
        }
        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;I tested a dwg，&lt;/P&gt;
&lt;P&gt;The results obtained were consistent.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="465340553_0-1697157889117.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1278715iBD4347C28635AAD9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="465340553_0-1697157889117.png" alt="465340553_0-1697157889117.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way，&lt;/P&gt;
&lt;P&gt;Use Com API，&lt;/P&gt;
&lt;P&gt;I can't get the name of the baseline，&lt;/P&gt;
&lt;P&gt;There is no API to get the name：&lt;/P&gt;
&lt;P&gt;&lt;A href="http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXRoadwayLib__IAeccBaseline.htm" target="_blank" rel="noopener"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="465340553_1-1697157984695.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1278718i1F597AD7A047E465/image-size/medium?v=v2&amp;amp;px=400" role="button" title="465340553_1-1697157984695.png" alt="465340553_1-1697157984695.png" /&gt;&lt;/span&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 01:31:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302850#M2931</guid>
      <dc:creator>465340553</dc:creator>
      <dc:date>2023-10-13T01:31:38Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302889#M2932</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This question arises from &lt;STRONG&gt;Toolspace &amp;gt; Reports Manager &amp;gt; Corridor &amp;gt; Slope Stake Report&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that it does not allow you to select the Baseline, only the Alignment. If you have multiple Baselines with the same alignment it will list the alignment only once so you will be reporting on the first Baseline that uses the alignment. My modification allows selection by Baseline instead by retrieving the Baseline names via .NET.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Modified version:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GTVic_1-1697160500292.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1278722iDD202271332A138F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GTVic_1-1697160500292.png" alt="GTVic_1-1697160500292.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 01:29:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302889#M2932</guid>
      <dc:creator>GTVic</dc:creator>
      <dc:date>2023-10-13T01:29:49Z</dc:date>
    </item>
    <item>
      <title>回复： Finding Baseline Name with COM Interface</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302920#M2933</link>
      <description>&lt;P&gt;These codes are relatively early，&lt;/P&gt;
&lt;P&gt;When writing this code there may not be .Net API,&lt;/P&gt;
&lt;P&gt;Now，Only use .Net API ，all can be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 02:09:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/finding-baseline-name-with-com-interface/m-p/12302920#M2933</guid>
      <dc:creator>465340553</dc:creator>
      <dc:date>2023-10-13T02:09:58Z</dc:date>
    </item>
  </channel>
</rss>

