Hi,
I understand we can only xref a dwg file. It happens to be that sometimes the process doesn't allow us to open dxf and save as dwg, and we only need to read some info in the dxf file before detach it(if we could attach in the first place).
Is there a work around, please? Or I have to write a script to read dxf text?
Thank you very much!
Solved! Go to Solution.
Solved by deepak.a.s.nadig. Go to Solution.
It is not possible to attach a DXF file as an external reference.
However, you could write a .NET appplication to read DXF file using "Database.DxfIn" method.
Here is a .NET sample showing the usage of Database.DxfIn :
[CommandMethod("ReadDxfFile")] public void ReadDxfFile() // This method can have any name { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; // DXF file to read String dxfFilename = @"C:\temp\Sample.DXF"; //log file to write the error messages while reading the DXF file String logFilename = @"C:\temp\LogSample.log"; using (Transaction tr = db.TransactionManager.StartTransaction()) { //new database with constructor's buildDefaultDrawing argument set to false using (Database Dxfdb = new Database(false, true)) { //function reads the DXF file specified Dxfdb.DxfIn(dxfFilename, logFilename); //to insert the contents of DXF file into active drawing Matrix3d dxfTrf = Matrix3d.Identity; db.Insert(dxfTrf, Dxfdb, true); db.UpdateExt(true); ViewTableRecord vTable = new ViewTableRecord(); Point3d minPoint = db.Extmin; Point3d maxPoint = db.Extmax; Point2d vMax = new Point2d(maxPoint.X, maxPoint.Y); Point2d vMin = new Point2d(minPoint.X, minPoint.Y); vTable.CenterPoint = vMin + 0.5 * (vMax - vMin); vTable.Height = vMax.Y - vMin.Y; vTable.Width = vMax.X - vMin.X; doc.Editor.SetCurrentView(vTable); tr.Commit(); } } }
Can't find what you're looking for? Ask the community or share your knowledge.