.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
ConvertFro m
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
60 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.D ocumentManager.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
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.D
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
