Distinguished Contributor
Posts: 347
Registered: ‎12-05-2003
Message 1 of 1 (88 Views)


88 Views, 0 Replies
10-13-2005 01:26 PM
I have this code to convert a old style polyline to lwpolyline. I got a error message: "eInvalidContext".
What's wrong in my code?

Here is the code:
// RSPline
public static void RSPline2_Test()
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Database db = HostApplicationServices.WorkingDatabase;
Transaction trans = db.TransactionManager.StartTransaction();

PromptEntityOptions prEntOpts = new PromptEntityOptions("Please pick any pline:");
PromptEntityResult prEntRes = ed.GetEntity(prEntOpts);

if (prEntRes.Status != PromptStatus.OK )return ;

ObjectId obj = prEntRes.ObjectId;
Entity ent = (Entity)trans.GetObject(obj, OpenMode.ForWrite);
Polyline pline = new Polyline();
pline.ConvertFrom(ent, true);
catch (System.Exception caught)

Thank you for your help

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community