Hi,
Your code is good and it works fine..
But when I want to find only Direct Children then what to do?
Suppose I have a Drawing Structure like:
MasterRoot
Root1
MasterChild1
Child
MasterChild2
Child
Root2
MasterChild1
Child
MasterChild2
Child
When I use XrefGraph xg = mainDb.GetHostDwgXrefGraph(true); in Code then I get all the Files as a node including MasterRoot (say count=6).
If I want to get Only direct Children (here, Root1 and Root2)(means count=2 only), then wha i have to do?
Is it Possible?
Any help will be appreciated.
Thanks in Advance..
Thanks & Regards,
Vasant Padhiyar
we meet same problem.
we can get the files attachment by Interop.TRANSMITTALLib.dll, but it's contain the pc3 and so on.
Who has the perfect solution?
Thanks!
Rick
Hi,
Please Go through the following link for the Solution:
Hope it helps..
Thanks,
Thanks, Vasant!
we can get all DWG reference file, but can't find the image(jpg/png/tiff)/PDF format file which attached my xref manager.
so your link's soluton can get the image file name/path?
Thanks!
Rick
Dear Vasant,
We tested the code in the new link(http://adndevblog.typepad.com/autocad/2012/06/finding-all-xrefs-in-the-current-database-using-cnet.h... it's can't find the image file's name/path.
Pls see the attachment of sample drawings with dwg/JPG xref files.
Thanks again!
Rick
ARTVEGAS ... thx for participating with this thread, your input helped me get all references very quickly using "internal" managed c# (NETLOAD DLL).
What about COM?
How would we do the same process in an interop/com development (ouitside AutoCAD)?
I thought that maybe document.filedependencies would list the referenced files. On my test it did not.
Thanks again..
Kevin.
Just to close the discussion here's how to do it...
<CommandMethod("DetachImg")> _
Public Sub detach_img(mainDrawingFile As String)
Dim db As New Database(False, True)
db.ReadDwgFile(mainDrawingFile, System.IO.FileShare.ReadWrite, True, "")
Using db
Dim saveRequired As Boolean = False
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim imageDictId As ObjectId = RasterImageDef.GetImageDictionary(db)
If imageDictId.IsNull Then
Else
Dim imageDefinitions As New Dictionary(Of ObjectId, RasterImageDef)()
Dim imageDictionary As DBDictionary = tr.GetObject(RasterImageDef.GetImageDictionary(db), OpenMode.ForWrite)
For Each entry As DBDictionaryEntry In imageDictionary
Dim id As ObjectId = entry.Value, ObjectId
Dim rasterImageDef__1 As RasterImageDef = tr.GetObject(id, OpenMode.ForWrite)
If rasterImageDef__1.LocateActivePath = "" Then
rasterImageDef__1.Erase()
saveRequired = True
End If
Next
End If
tr.Commit()
tr.Dispose()
End Using
If saveRequired Then
db.SaveAs(mainDrawingFile, DwgVersion.Current)
End If
End Using
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.