.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ConvertFrom

0 REPLIES 0
Reply
Message 1 of 1
wesbird
199 Views, 0 Replies

ConvertFrom

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
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
0 REPLIES 0

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost