C3D2013 How to display Labels on a Polyline?

C3D2013 How to display Labels on a Polyline?

Anonymous
Not applicable
658 Views
2 Replies
Message 1 of 3

C3D2013 How to display Labels on a Polyline?

Anonymous
Not applicable

Hello everyone, I am new to Autocad Civil 3D 2013 .NET API and I created a polyline and my problem is I have no idea of showing labels on it.

 

This is I really want to do:

> I want to display the index of the points.

> and I want to display the area of the polyline beside it.

 

By the way, I used C# as a language. Here is my code for making a polyline just for you to know and if you have any ideas how to

incorporate labels and areas with that code.

 

[CommandMethod("AddLightweightPolyline")]
public static void AddLightweightPolyline()
{
// Get the current document and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;

// Start a transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// Open the Block table for read
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
OpenMode.ForRead) as BlockTable;

// Open the Block table record Model space for write
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
OpenMode.ForWrite) as BlockTableRecord;

// Create a polyline with two segments (3 points)
using (Polyline acPoly = new Polyline())
{
acPoly.AddVertexAt(0, new Point2d(-315.27, 105.15), 0, 0, 0);
acPoly.AddVertexAt(1, new Point2d(-326.2, 101.66), 0, 0, 0);
acPoly.AddVertexAt(2, new Point2d(-326.75, 102.49), 0, 0, 0);
acPoly.AddVertexAt(3, new Point2d(-331.02, 109.33), 0, 0, 0);
acPoly.AddVertexAt(4, new Point2d(-318.39, 113.59), 0, 0, 0);
acPoly.AddVertexAt(5, new Point2d(-315.27, 105.15), 0, 0, 0);
//acPoly.AddVertexAt(5, new Point2d(-315.27, 105.15), 0, 0, 0);
acPoly.Closed = true;
// Add the new object to the block table record and the transaction
acBlkTblRec.AppendEntity(acPoly);
acTrans.AddNewlyCreatedDBObject(acPoly, true);

}

// Save the new object to the database
acTrans.Commit();
}
}

 

I also attached a file of what I am trying to display.

Please help me with this problem. I appreciate the effort. Thanks!

 

@BushW has edited your subject line for clarity: How to display Labels on a Polyline?

0 Likes
659 Views
2 Replies
Replies (2)
Message 2 of 3

rl_jackson
Mentor
Mentor

It appears that almost everything you are wanting to do can be done natively using either points, parcels or labels. Everything in your picture could be done using those or a combination of those functions.

I might recommend you run through the tutorials.


Rick Jackson
Survey CAD Technician VI

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you for your response, I run thru the tutorials but I cannot find anything what I need. Can you give some examples?

 

Thank you.

0 Likes