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: 

Replace Pi Point from FeatureLine

1 REPLY 1
Reply
Message 1 of 2
ahernandezmendez
129 Views, 1 Reply

Replace Pi Point from FeatureLine

Hi, I'm trying to replace a pi point with the same one but changing the elevation, this is because the Z attribute of a Point3d is read only.

Most of the time it does fine, but sometimes it throws the following exception.

ArgumentException("The specified point is before or on the start point of feature line")

I understand the message, but I'm not able to see why it does it occasionally.

Here is the point where the code fails:

 

try {
using Transaction tr = CivilDB.GetDatabase().TransactionManager.StartTransaction();
FeatureLine flMod = fl.ObjectId.GetObject(OpenMode.ForWrite) as FeatureLine;

Point3d pointModify = new Point3d(point.X, point.Y, newElevation);

//RemovePointFromFL(ref flMod, point);
flMod.DeletePIPoint(point);
flMod.InsertPIPoint(pointModify);
coords[direction] = pointModify;

fl = flMod;
tr.Commit();
}
catch (System.Exception ex) {

UtilsServices.WriteCoordinates("Error point: ", pointFl.X, pointFl.Y, pointFl.Z);
CivilDB.Write("Error in Fl: " + fl.Name + "|| Point in position " + direction + " not typed correctly.");
CivilDB.Write("Civil3D failed due to : " + ex.Message);
}

I have to comment that CivilDB is a class of its own where I encapsulate several methods.

Thank you very much
Best regards.

Tags (2)
Labels (1)
1 REPLY 1
Message 2 of 2
hippe013
in reply to: ahernandezmendez

You should use the 'SetPointElevation' method of the featureline. 

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report