Message 1 of 1
Attach Xref File Access Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all, I am having some issues with attaching an xref. In the text file, I have got the code, AutoCAD Text window output and the errors that I am getting.
I have not been able to find much information about attaching xrefs. Correct me if I am wrong, but in VBA it is just decared as a block reference, and attached, whereas in .NET you need to access it through the database.
The file exists and have access to it and is not read-only.
I have tried to attach the text file but it keeps giving me an error. Apolgies for jumble below
'<<<<<<<<<<
I have not been able to find much information about attaching xrefs. Correct me if I am wrong, but in VBA it is just decared as a block reference, and attached, whereas in .NET you need to access it through the database.
The file exists and have access to it and is not read-only.
I have tried to attach the text file but it keeps giving me an error. Apolgies for jumble below
'<<<<<<<<<<
>>>>>>>>>>
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.ApplicationServices.Document
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Imports ADApp = Autodesk.AutoCAD.ApplicationServices.Application
Imports System.Windows.Forms
'More code
'attach xref
Try
Dim dwg As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim db As Database = dwg.Database
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = dwg.TransactionManager
Dim oxref As ObjectId = db.AttachXref(StrXrefFile, StrXrefName)
Dim myBlock As Autodesk.AutoCAD.DatabaseServices.BlockReference = New BlockReference(New Autodesk.AutoCAD.Geometry.Point3d(0, 0, 0), oxref)
Catch ex As Exception
Debug.Print(ex.Message)
End Try
'<<<<<<<<<<>>>>>>>>>>
<<>>
Attach Xref "Village Extension":
O:\G&I\CAD\Projects\PES832\Drawings\Models\Civ\Jundu Village Extension Rev 1.dwg
** File O:\G&I\CAD\Projects\PES832\Drawings\Models\Civ\Jundu Village Extension
Rev 1.dwg isn't a valid drawing.
<<>>
A first chance exception of type 'Autodesk.AutoCAD.Runtime.Exception' occurred in AcdbMgd.dll
Thanks in advance Brent