<?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 pipes and structures in profileview in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6288189#M14243</link>
    <description>&lt;P&gt;You use it like this:&lt;/P&gt;
&lt;PRE&gt;Network.FindShortestNetworkPath(part1.ObjectId, part2.ObjectId, ref dbl);&lt;/PRE&gt;
&lt;P&gt;Where Network is the Class, not the actual network you are working with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the help for it:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/html/4e245ebc-ede6-291d-0ead-7c0d2b3f86d9.htm" target="_blank"&gt;http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/html/4e245ebc-ede6-291d-0ead-7c0d2b3f86d9.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Apr 2016 01:42:12 GMT</pubDate>
    <dc:creator>Jeff_M</dc:creator>
    <dc:date>2016-04-23T01:42:12Z</dc:date>
    <item>
      <title>Get pipes and structures in profileview</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6283968#M14238</link>
      <description>&lt;P&gt;I have a problem.&amp;nbsp;first, I select a pipe in upperstreamline, next &amp;nbsp;i select a pipe in lowerstreamline, then i select profileview, which contain them. &lt;SPAN&gt;I want to get entire pipes and structures in profileview, and ascending to sort them according to station. Can you give me this code?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 10:38:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6283968#M14238</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-21T10:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get pipes and structures in profileview</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6284987#M14239</link>
      <description>&lt;P&gt;@Anonymous﻿, welcome to the forums! Do you have any code you've already tried and are having trouble with? We are here to help, not do it for you.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 17:21:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6284987#M14239</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-04-21T17:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get pipes and structures in profileview</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6285916#M14240</link>
      <description>&lt;P&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Windows.Forms;&lt;BR /&gt;using acad = Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;using Autodesk.AutoCAD.DatabaseServices;&lt;BR /&gt;using Autodesk.AutoCAD.EditorInput;&lt;BR /&gt;using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;using Autodesk.AutoCAD.Geometry;&lt;/P&gt;
&lt;P&gt;using acil = Autodesk.Civil.ApplicationServices;&lt;BR /&gt;using Autodesk.Civil.DatabaseServices;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;namespace chinhcong&lt;BR /&gt;{&lt;BR /&gt;public partial class Chinh_nhieu_cong : Form&lt;BR /&gt;{&lt;BR /&gt;public Chinh_nhieu_cong()&lt;BR /&gt;{&lt;BR /&gt;InitializeComponent();&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;private void Chinh_nhieu_cong_Load(object sender, EventArgs e)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;BR /&gt;// đăt tên biến chung&lt;BR /&gt;Pipe _p1 = null;&lt;BR /&gt;Pipe _p2 = null;&lt;BR /&gt;public void btn_choncong_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;acad.Document doc = acad.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database db = doc.Database;&lt;BR /&gt;Editor ed = doc.Editor;&lt;BR /&gt;acil.CivilDocument _civil = acil.CivilApplication.ActiveDocument;&lt;/P&gt;
&lt;P&gt;using (acad.DocumentLock acLck = doc.LockDocument())&lt;BR /&gt;{&lt;BR /&gt;Transaction tr = db.TransactionManager.StartTransaction();&lt;BR /&gt;using (tr)&lt;BR /&gt;{&lt;BR /&gt;this.Hide();&lt;BR /&gt;TypedValue[] _tv = new TypedValue[] {&lt;BR /&gt;new TypedValue((int)DxfCode.Start, "AECC_GRAPH_PROFILE_NETWORK_PART")&lt;BR /&gt;};&lt;BR /&gt;SelectionFilter _slf = new SelectionFilter(_tv);&lt;/P&gt;
&lt;P&gt;PromptSelectionOptions _sop = new PromptSelectionOptions();&lt;BR /&gt;ed.WriteMessage("\n Chon cong thuong luu");&lt;BR /&gt;PromptSelectionResult _kq = ed.GetSelection(_sop, _slf);&lt;BR /&gt;if (_kq.Status != PromptStatus.OK) return;&lt;BR /&gt;ObjectId _id1 = _kq.Value.GetObjectIds()[0];&lt;/P&gt;
&lt;P&gt;_sop = new PromptSelectionOptions();&lt;BR /&gt;ed.WriteMessage("\n Chon cong ha luu");&lt;BR /&gt;_kq = ed.GetSelection(_sop, _slf);&lt;BR /&gt;if (_kq.Status != PromptStatus.OK) return;&lt;BR /&gt;ObjectId _id2 = _kq.Value.GetObjectIds()[0];&lt;/P&gt;
&lt;P&gt;// chon doi tuong profileview&lt;BR /&gt;TypedValue[] _tv1 = new TypedValue[] {&lt;BR /&gt;new TypedValue((int)DxfCode.Start, "AECC_PROFILE_VIEW")&lt;BR /&gt;};&lt;BR /&gt;SelectionFilter _slf1 = new SelectionFilter(_tv1);&lt;/P&gt;
&lt;P&gt;_sop = new PromptSelectionOptions();&lt;BR /&gt;ed.WriteMessage("\n Chọn ProfileView");&lt;BR /&gt;_kq = ed.GetSelection(_sop, _slf1);&lt;BR /&gt;if (_kq.Status != PromptStatus.OK) return;&lt;BR /&gt;ObjectId _id3= _kq.Value.GetObjectIds()[0];&lt;/P&gt;
&lt;P&gt;// get cống về đối tượng part&lt;BR /&gt;ProfileViewPart _ct = tr.GetObject(_id1, OpenMode.ForRead) as ProfileViewPart;&lt;BR /&gt;ProfileViewPart _ch = tr.GetObject(_id2, OpenMode.ForWrite) as ProfileViewPart;&lt;/P&gt;
&lt;P&gt;Autodesk.Civil.DatabaseServices.Entity _ent1 = tr.GetObject(_ct.ModelPartId, OpenMode.ForWrite) as Autodesk.Civil.DatabaseServices.Entity;&lt;BR /&gt;Autodesk.Civil.DatabaseServices.Entity _ent2 = tr.GetObject(_ch.ModelPartId, OpenMode.ForWrite) as Autodesk.Civil.DatabaseServices.Entity;&lt;BR /&gt;if (_ent1 is Pipe &amp;amp;&amp;amp; _ent2 is Pipe)&lt;BR /&gt;{&lt;BR /&gt;_p1 = _ent1 as Pipe;&lt;BR /&gt;_p2 = _ent2 as Pipe;&lt;BR /&gt;txt_ct.Text = _p1.Name;&lt;BR /&gt;txt_ch.Text = _p2.Name;&lt;BR /&gt;}&lt;BR /&gt;// get trắc dọc về đối tượng profileview&lt;BR /&gt;ProfileView _prfv = tr.GetObject(_id3, OpenMode.ForRead) as ProfileView;&lt;BR /&gt;// get toàn bộ các đối tượng cống và hầm ga có trong profileview&lt;BR /&gt;//&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;I&amp;nbsp;can help me.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;public void btn_ok_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;// so lieu dau vao&lt;BR /&gt;double _i = Convert.ToDouble(txt_i.Text);&lt;BR /&gt;double _drop = Convert.ToDouble(txt_drop.Text);&lt;/P&gt;
&lt;P&gt;// get tuyến chứa cống đầu tiên&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Windows.Forms;
using acad = Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;

using acil = Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;


namespace chinhcong
{
public partial class Chinh_nhieu_cong : Form
{
public Chinh_nhieu_cong()
{
InitializeComponent();
}

private void Chinh_nhieu_cong_Load(object sender, EventArgs e)
{

}
// đăt tên biến chung
Pipe _p1 = null;
Pipe _p2 = null;
public void btn_choncong_Click(object sender, EventArgs e)
{
acad.Document doc = acad.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
acil.CivilDocument _civil = acil.CivilApplication.ActiveDocument;

using (acad.DocumentLock acLck = doc.LockDocument())
{
Transaction tr = db.TransactionManager.StartTransaction();
using (tr)
{
this.Hide();
TypedValue[] _tv = new TypedValue[] {
new TypedValue((int)DxfCode.Start, "AECC_GRAPH_PROFILE_NETWORK_PART")
};
SelectionFilter _slf = new SelectionFilter(_tv);

PromptSelectionOptions _sop = new PromptSelectionOptions();
ed.WriteMessage("\n Chon cong thuong luu");
PromptSelectionResult _kq = ed.GetSelection(_sop, _slf);
if (_kq.Status != PromptStatus.OK) return;
ObjectId _id1 = _kq.Value.GetObjectIds()[0];

_sop = new PromptSelectionOptions();
ed.WriteMessage("\n Chon cong ha luu");
_kq = ed.GetSelection(_sop, _slf);
if (_kq.Status != PromptStatus.OK) return;
ObjectId _id2 = _kq.Value.GetObjectIds()[0];

// chon doi tuong profileview
TypedValue[] _tv1 = new TypedValue[] {
new TypedValue((int)DxfCode.Start, "AECC_PROFILE_VIEW")
};
SelectionFilter _slf1 = new SelectionFilter(_tv1);

_sop = new PromptSelectionOptions();
ed.WriteMessage("\n Chọn ProfileView");
_kq = ed.GetSelection(_sop, _slf1);
if (_kq.Status != PromptStatus.OK) return;
ObjectId _id3= _kq.Value.GetObjectIds()[0];

// get cống về đối tượng part
ProfileViewPart _ct = tr.GetObject(_id1, OpenMode.ForRead) as ProfileViewPart;
ProfileViewPart _ch = tr.GetObject(_id2, OpenMode.ForWrite) as ProfileViewPart;

Autodesk.Civil.DatabaseServices.Entity _ent1 = tr.GetObject(_ct.ModelPartId, OpenMode.ForWrite) as Autodesk.Civil.DatabaseServices.Entity;
Autodesk.Civil.DatabaseServices.Entity _ent2 = tr.GetObject(_ch.ModelPartId, OpenMode.ForWrite) as Autodesk.Civil.DatabaseServices.Entity;
if (_ent1 is Pipe &amp;amp;&amp;amp; _ent2 is Pipe)
{
_p1 = _ent1 as Pipe;
_p2 = _ent2 as Pipe;
txt_ct.Text = _p1.Name;
txt_ch.Text = _p2.Name;
}
// get trắc dọc về đối tượng profileview
ProfileView _prfv = tr.GetObject(_id3, OpenMode.ForRead) as ProfileView;
// get toàn bộ các đối tượng cống và hầm ga có trong profileview
//

 

// I can help me.


}
}
}

public void btn_ok_Click(object sender, EventArgs e)
{
// so lieu dau vao
double _i = Convert.ToDouble(txt_i.Text);
double _drop = Convert.ToDouble(txt_drop.Text);

// get tuyến chứa cống đầu tiên


}
}
}&lt;/PRE&gt;
&lt;P&gt;Note in the fututure when posting code please use the code window on the Rich text tab see image it helps the other posters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edited by&lt;BR /&gt;Discussion_Admin&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/234277iCD8E63A153FAFA25/image-size/original?v=v2&amp;amp;px=-1" alt="code box.png" title="code box.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 16:45:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6285916#M14240</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-22T16:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get pipes and structures in profileview</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6287514#M14241</link>
      <description>&lt;P&gt;@Anonymous﻿, since you have the start &amp;amp; end parts that you want to use, you can call the FindShortestNetworkPath() method. This returns an ObjectIdCollection of all of the parts between those 2 parts.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 18:22:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6287514#M14241</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-04-22T18:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get pipes and structures in profileview</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6288181#M14242</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M﻿&lt;/a&gt;&amp;nbsp;I can't use this method. what reference i need add to use this method ? if you have written this method, could you give it for me? thank you so much!&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 01:26:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6288181#M14242</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-23T01:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get pipes and structures in profileview</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6288189#M14243</link>
      <description>&lt;P&gt;You use it like this:&lt;/P&gt;
&lt;PRE&gt;Network.FindShortestNetworkPath(part1.ObjectId, part2.ObjectId, ref dbl);&lt;/PRE&gt;
&lt;P&gt;Where Network is the Class, not the actual network you are working with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the help for it:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/html/4e245ebc-ede6-291d-0ead-7c0d2b3f86d9.htm" target="_blank"&gt;http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/html/4e245ebc-ede6-291d-0ead-7c0d2b3f86d9.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 01:42:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/get-pipes-and-structures-in-profileview/m-p/6288189#M14243</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-04-23T01:42:12Z</dc:date>
    </item>
  </channel>
</rss>

