.NET

Reply
Distinguished Contributor
wesbird
Posts: 359
Registered: ‎12-05-2003
Message 1 of 1 (90 Views)

ConvertFrom

90 Views, 0 Replies
10-13-2005 01:26 PM
Hi,
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:
[code]
// RSPline
[CommandMethod("RSP_Test")]
public static void RSPline2_Test()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Database db = HostApplicationServices.WorkingDatabase;
Transaction trans = db.TransactionManager.StartTransaction();

try
{
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);
trans.Commit();
}
catch (System.Exception caught)
{
DDebug.WriteMessage(caught.Message.ToString());
}
[/code]


Thank you for your help
Wes
Vault Pro 2014, Windows 7 64 bit, AutoCAD (ACA, Map) 2014
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.