I´m trying this to get a polyline 3d in the drawing from feature line.
public static void prueba(Autodesk.AutoCAD.DatabaseServices.ObjectId id) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; using (DocumentLock docLock = doc.LockDocument()) { using (Transaction trans = db.TransactionManager.StartTransaction()) { Autodesk.AutoCAD.DatabaseServices.DBObject obj = trans.GetObject(id, OpenMode.ForWrite); DBObjectCollection entitats = new DBObjectCollection(); FeatureLine FL = obj as FeatureLine; if (FL != null) { System.Type tipo = FL.GetType(); if (tipo.Name != "SurveyFigure") { // get the projected curve from feature line Curve baseCurve = FL.BaseCurve; baseCurve.Layer = FL.Layer; //lo ponemos en la misma capa que la capa de la línea característica. // Now append the curve to db BlockTable table = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord model = trans.GetObject(table[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; model.AppendEntity(baseCurve); trans.AddNewlyCreatedDBObject(baseCurve, true); } } trans.Commit(); } //end transaction } //end candado }
However, in some cases, generally if the feature line has arc and lines, the result polyline 3d has some repeated vertex.(3 times).
For exemple, in the attached drawing file, vertex 30,31 and 32 has the same position.
Are there any simply methods to erase repeated(duplicated) vertex of one entity?
Do you know if the original feature line had the duplicate vertices or is the BaseCurve method generating them?
In this situation you can use Map clean up tools or iterate through the vertices to check if there is any duplicate.
Thanks,
thanks.
Hi.
I have a question about BaseCurve() method.
Once an arc segment has divided in a lot of line segments, how can we set the length of these line segments?
For example in the "test.dwg" each segment line has length= 15.9295
Can I set this length in Civil 3D settings? And can I do with API programming?
ok.
It is in Site properties (3d Geometry tab) Arrow length.