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

Error creating new DWG file using objectARX 2014

0 REPLIES 0
Reply
Message 1 of 1
jobinelv
628 Views, 0 Replies

Error creating new DWG file using objectARX 2014

Hi,
i am creating app in vs 2012 using .net 4 and autocad version 2014, to export my drawing to DWG format. i have strongly signed objectARX files.
when i run program i am getting error 'Common Language Runtime detected an invalid program.'

code snip:

public void DrawLine(Pen pen,double px1,double py1,double px2,double py2) { Line line = new Line(new Point3d(px1, py1, 0), new Point3d(px2, py2, 0)); Autodesk.AutoCAD.Colors.EntityColor colent = new Autodesk.AutoCAD.Colors.EntityColor(pen.Color.R, pen.Color.G, pen.Color.B); line.ColorIndex = colent.ColorIndex; //<<-- exeception here SaveEntity(line); } public void SaveEntity(Entity entity) { //using (Transaction acTrans = acDB.TransactionManager.StartTransaction()) //<<-- exeception here Transaction acTrans = acDB.TransactionManager.StartTransaction(); { // Open the Block table for read BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(acDB.BlockTableId, OpenMode.ForRead) as BlockTable; // Open the Block table record Model space for write BlockTableRecord acBlkTblRec; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; // Create a line that starts at 5,5 and ends at 12,3 //Line acLine = new Line(new Point3d(5, 5, 0), new Point3d(12, 3, 0)); // Add the new object to the block table record and the transaction acBlkTblRec.AppendEntity(entity); acTrans.AddNewlyCreatedDBObject(entity, true); // Save the new object to the database acTrans.Commit(); } }

 

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report

”Boost