<?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 access pressure network parts lists using VB.NET in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/10184776#M14432</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M&lt;/a&gt;, @Anonymous&amp;nbsp;is there any way to access other internal methods?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example PressurePartSize?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need create pressure network and need this information&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 01:22:09 GMT</pubDate>
    <dc:creator>benkas</dc:creator>
    <dc:date>2021-03-25T01:22:09Z</dc:date>
    <item>
      <title>How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6205962#M14425</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm developing a tool that deals with both pipe networks and pressure pipe networks using VB.NET.&lt;/P&gt;&lt;P&gt;I can obtain the object Ids of pipe networks parts lists and can easily access their properties. However, for pressure networks parts lists I coudn't find a way even to obtain the Object Ids of existing parts lists in the drawing; I'm wondering if pressure parts lists are basically exposed in the API. Can anybody help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Remah Foda&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 07:18:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6205962#M14425</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-09T07:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6206682#M14426</link>
      <description>Welcome to the forums, Remah! &lt;BR /&gt;&lt;BR /&gt;Pressure pipes are somewhat exposed, but no documentation exists that I know of. You must add a reference to AeccPressurePipesMgd.dll &lt;BR /&gt;&lt;BR /&gt;Use the "Search this Board" tool to the right of the message listing, enter "Pressure", you will find quite a few similar messages and answers,</description>
      <pubDate>Wed, 09 Mar 2016 15:38:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6206682#M14426</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-03-09T15:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6206782#M14427</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;Thanks for trying to help. I already have the reference of AeccPressurePipesMgd.dll and can access the objects of "pressure pipe" and "pressure network" through it.&lt;/P&gt;&lt;P&gt;What I can't reach&amp;nbsp;specifically is the "parts list" object of the pressure networks. I read some articles about this reference library and checked the object browser also but didn't find it. I'm trying to find a different way to catch it if any.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 16:15:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6206782#M14427</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-09T16:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6207196#M14428</link>
      <description>&lt;P&gt;Sorry, Remah, I misunderstood your request. Looking at the dll file with Ilspy I see that the GetPressurePartLists() method is defined as an Internal extension method, not Public, so it's not directly exposed. However, using Reflection you can still get the PartListCollection as an object...all of the PressurePartList classes are defined as Internal, so actually working with them may prove difficult.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an extension method, in c# as that is what I know, to get the PartLists:&lt;/P&gt;
&lt;PRE&gt;        public static object GetPressurePartListsExt(this StylesRoot styles)
        {
            object[] args = { styles };
            var mytype = typeof(Autodesk.Civil.DatabaseServices.Styles.StylesRootPressurePipesExtension);
            var mi = mytype.GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
            var m = mi[0]; //at this time there is only 1 member, may need to adjust in the future
            var plist = m.Invoke(null, args);
            return plist;
        }


//and I would call it like so from wherever:
                var pplist = civdoc.Styles.GetPressurePartListsExt();
&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2016 19:22:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6207196#M14428</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-03-09T19:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6213017#M14429</link>
      <description>&lt;P&gt;That's excellent, thanks Jeff.&lt;/P&gt;&lt;P&gt;I&amp;nbsp;wrote an&amp;nbsp;equivalent VB code and it worked well. I can now obtain the names and objectIds of the existing pressure parts lists.&lt;/P&gt;&lt;P&gt;I'm sharing this VB code here below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.Civil.DatabaseServices
Imports Autodesk.Civil.ApplicationServices

'for reflection of private methods of pressure parts list
Imports System
Imports System.Reflection
Imports System.Reflection.Emit
Imports Microsoft.VisualBasic


Public Class MyCommands
    &amp;lt;CommandMethod("GetPressurePartsLists")&amp;gt; Public Sub cmdGetPressurePartsLists()

        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor 'autocad document editor
        Dim civDoc As CivilDocument = CivilApplication.ActiveDocument 'civil 3d document

        'get pressure part lists collection
        Dim pressPartLists As Styles.StyleCollectionBase = MyTypes.GetPressurePartsListsExt(civDoc.Styles)
        ed.WriteMessage(vbLf &amp;amp; vbLf &amp;amp; "The number of pressure parts lists = " &amp;amp; pressPartLists.Count)

        'list the names of existing pressure parts lists
        Using trans As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction
            Try
                Dim partsList As Autodesk.Civil.DatabaseServices.Styles.StyleBase
                For Each id As ObjectId In pressPartLists
                    partsList = trans.GetObject(id, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)
                    ed.WriteMessage(vbLf &amp;amp; partsList.Name)
                Next
            Catch
            End Try
        End Using

    End Sub

End Class
Public Class MyTypes

    'This function obtains the pressure parts list in a drawing
    Public Shared Function GetPressurePartsListsExt(styles As Styles.StylesRoot) As Styles.StyleCollectionBase

        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor 'autocad document editor
        Dim myType As Type = GetType(Styles.StylesRootPressurePipesExtension)

        'get the private method
        Dim myArrayMethodInfo As MethodInfo() = myType.GetMethods((BindingFlags.Static Or BindingFlags.NonPublic))
        ed.WriteMessage(vbLf &amp;amp; "The number of protected methods is " &amp;amp; myArrayMethodInfo.Length.ToString() &amp;amp; ".")

        ' Display information for all methods.
        Dim i As Integer
        For i = 0 To myArrayMethodInfo.Length - 1
            Dim myMethodInfo As MethodInfo = CType(myArrayMethodInfo(i), MethodInfo)
            ed.WriteMessage(vbLf &amp;amp; "The name of the method is " &amp;amp; myMethodInfo.Name &amp;amp; ".")
        Next i

        'run the method of getpressurelists
        Dim pressPartLists As Styles.StyleCollectionBase
        Dim myGetPressPartLists As MethodInfo = myArrayMethodInfo(0) 'the number 0 here depends on the composition of AeccPressurePipesMgd.dll library
        Dim arParam(0) As Object
        arParam(0) = styles
        pressPartLists = myGetPressPartLists.Invoke(Nothing, arParam)

        Return pressPartLists

    End Function

End Class&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Mar 2016 08:37:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6213017#M14429</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-13T08:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6531849#M14430</link>
      <description>@Anonymous Would you mind sharing the code that you used to obtain the object Ids of pipe networks parts lists and access their properties? Ima newbie and im tryng to do the same</description>
      <pubDate>Tue, 30 Aug 2016 17:53:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6531849#M14430</guid>
      <dc:creator>heitz15</dc:creator>
      <dc:date>2016-08-30T17:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6532184#M14431</link>
      <description>&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M&lt;/a&gt; &lt;BR /&gt;&lt;BR /&gt;I guess you could help me too?</description>
      <pubDate>Tue, 30 Aug 2016 19:38:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/6532184#M14431</guid>
      <dc:creator>heitz15</dc:creator>
      <dc:date>2016-08-30T19:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/10184776#M14432</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M&lt;/a&gt;, @Anonymous&amp;nbsp;is there any way to access other internal methods?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example PressurePartSize?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need create pressure network and need this information&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 01:22:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/10184776#M14432</guid>
      <dc:creator>benkas</dc:creator>
      <dc:date>2021-03-25T01:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to access pressure network parts lists using VB.NET</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/10241907#M14433</link>
      <description>&lt;P&gt;Remah,&lt;/P&gt;&lt;P&gt;Do you know how I can set the Pressure Network "Default Parts List" with VB?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 17:45:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-access-pressure-network-parts-lists-using-vb-net/m-p/10241907#M14433</guid>
      <dc:creator>mbrynildsenUSQBS</dc:creator>
      <dc:date>2021-04-15T17:45:06Z</dc:date>
    </item>
  </channel>
</rss>

