Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add new band data to existing profile using API

1 REPLY 1
Reply
Message 1 of 2
Anonymous
538 Views, 1 Reply

Add new band data to existing profile using API

Hello all!

How to add a new band data to existing profile with API? I have an array of points on alignment, and want to see them in a profile. 

In this sample of Partha Sarkar a new data is added to band as an existing data. I need a new one.

 

Database db = AcadApp.DocumentManager.MdiActiveDocument.Database;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
  CivilDocument civilDoc = CivilApplication.ActiveDocument;
  //open the profile view
  ProfileView pv = trans.GetObject(pvId, OpenMode.ForWrite) asProfileView;
  //get the style of the first Bottom Bands         
  ObjectId bandStyleId = pv.Bands.GetBottomBandItems()[0].BandStyleId;
  //now access the collection of top band
  ProfileViewBandItemCollection topBandItems = pv.Bands.GetTopBandItems();  //add a new one (using the above style)
  topBandItems.Add(bandStyleId);
  //now Set the Top Bands
  pv.Bands.SetTopBandItems(topBandItems);         
  trans.Commit();
}

 

 

 

Thank you in advance

1 REPLY 1
Message 2 of 2
Civil3DReminders_com
in reply to: Anonymous

I'm not sure if COGO Points can be added to a profile view band. Adding a band to a profile view is the code you provided. 

 

If you want to draw AutoCAD objects at the point location, you'd find the Station/Offset in plan view and then convert that to XY on the profile view using FindXYAtStationAndElevation:

http://docs.autodesk.com/CIV3D/2014/ENU/API_Reference_Guide/html/2dae4508-c78b-883f-c695-d6e424635a6...

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report