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

How to ddd external references in the drawing? (C#)

1 REPLY 1
Reply
Message 1 of 2
Sfinks7s
439 Views, 1 Reply

How to ddd external references in the drawing? (C#)

Hello, I want to load the external references in the drawing, how to implement this program?
I returned to the drawing path and the way I want to load it using the insertion point.

The code error is probably somewhere not understand where.
Please help )

[CommandMethod("TDMSXREF", CommandFlags.Session)]

publicvoid TDMSXREF()

{

   Document doc = Application.DocumentManager.MdiActiveDocument;

   Database db = doc.Database;

   Editor ed = doc.Editor;

   Transaction tr = db.TransactionManager.StartTransaction();

   using (tr)

   {

      string path = "0";

      string moduleName = "CMD_SYSLIB";

      string functionName = "CheckOutSelObj";

      TDMSApplication tdmsAppDlg = newTDMSApplication();

      //path = tdmsAppDlg.ExecuteScript(moduleName, functionName);

      ObjectId xrefObj = db.AttachXref(@"C\MyD.dwg", "test");

      BlockReference br = newBlockReference(newPoint3d(0, 0, 0), xrefObj);

      BlockTable btTable =       (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

      BlockTableRecord modelSpace = (BlockTableRecord)tr.GetObject(btTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

      modelSpace.AppendEntity(br);

      tr.AddNewlyCreatedDBObject(br, true);

      ed.WriteMessage(path);

      }

   tr.Commit();

}

 

 

1 REPLY 1
Message 2 of 2
fenton.webb
in reply to: Sfinks7s

don't call AttachXRef while inside a transaction, see if that solves your problem.




Fenton Webb
AutoCAD Engineering
Autodesk

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