I want to create new vertex points in feature line and 3dpol.
I have this:
try { if (obj.GetType() == typeof(Autodesk.AutoCAD.DatabaseServices.Polyline3d)) { Polyline3d p3d = (Polyline3d)trans.GetObject(entRes.ObjectId, OpenMode.ForWrite); for (int i = 0; i <= ListaNuevosVertices.Count - 1; i++) { PolylineVertex3d vertex = new PolylineVertex3d(ListaNuevosVertices[i]); p3d.InsertVertexAt(idVerticeAnterior[i], vertex); } } else { FeatureLine fl = (FeatureLine)trans.GetObject(entRes.ObjectId, OpenMode.ForWrite); Autodesk.AECC.Interop.Land.AeccLandFeatureLine oFtrLn = (Autodesk.AECC.Interop.Land.AeccLandFeatureLine)fl.AcadObject; foreach (Point3d pt in ListaNuevosVertices) { object punt = pt; oFtrLn.InsertFeaturePoint(punt, AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI); } } } catch (System.Exception ex) { ed.WriteMessage( "\nException: {0}", ex.Message ); }
In this code line:
oFtrLn.InsertFeaturePoint(punt, AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI);
always catches the same Exception "the value is not within the expected range" .I have translated it because I get "El valor no está dentro del intervalo esperado". Perhaps is this: " Value does not fall within the expected range.".
I have tried it with different point3d values but always catches Exception.
With pol3d I have similar problem.
Thanks in advance.
Solved! Go to Solution.
Solved by joantopo. Go to Solution.
Solved XD:
else { FeatureLine fl = (FeatureLine)trans.GetObject(entRes.ObjectId, OpenMode.ForWrite); Autodesk.AECC.Interop.Land.AeccLandFeatureLine oFtrLn = (Autodesk.AECC.Interop.Land.AeccLandFeatureLine)fl.AcadObject; foreach (Point3d pt in ListaNuevosVertices) { double[] punto = new double[3]; punto[0] = pt.X; punto[1] = pt.Y; punto[2] = pt.Z; oFtrLn.InsertFeaturePoint((object)punto, AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI); } }
Jeff said me it a week ago. I didn´t remeber it.
Just as with editing the elevation, the COM Featureline InsertFeaturePoint expects an array of 3 doubles passed as an object.
double[] punt = pt.ToArray(); oFtrLn.InsertFeaturePoint((object)punt, AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI);
As for the Polyline3d.InsertVertexAt(), make sure that the index vertex is correct.
Yes, I don´t like to find the proper index vertex.
Luckly that feature lines doesn´t need it.
I´m trying to do an utility for project COGOpoints in 3dpol or feature line and create new vertex in orthogonal.
In command line, the user select if he wants offset right,left or both and value of offset and if he wants new COGOPoints in those new vertex.
Vertex and points have elevation of point projected.
However,it can be sometimes there were two solutions(projected point) if that point is in near in the edge.I have to close and open again database each time I add new vertex in feature line.
You shouldn't ned to open/close for each vertex added to a featureline. Don't open it for write, as you are not editing the .NET object. The COM methods take care of any required open/cose of the object so you just need to pass the AcadObject opened for read.
Can't find what you're looking for? Ask the community or share your knowledge.