FileNotFoundException was unhandled
Hi,
I am trying to insert custom object into bricscad application using VB.net (VS 2010). I am getting the error:
Could not load file or assembly 'TD_Mgd.dll' or one of its dependencies. The specified module could not be found.
Although TD_Mgd.dll is already add in the reference.
My code is below written to insert the object into Bricscad:
[code] Dim refPath As String = "D:\\Ok.png"
Dim hostPath As String = "D:\\Try1.dwg"
'Dim blockObjb As BricscadDb.
Dim xref As Object
xref.ReadDwgFile(hostPath, FileShare.ReadWrite, False, "")
Using trx As Transaction = xref.TransactionManager.StartTransaction()
Dim xrefBt As BlockTable = xref.BlockTableId.GetObject(OpenMode.ForRead)
Dim btrMs As BlockTableRecord = xrefBt(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
Dim xrefObjId As ObjectId = xref.AttachXref(refPath, Path.GetFileNameWithoutExtension(refPath))
Dim bref As New BlockReference(Teigha.Geometry.Point3d.Origin, xrefObjId)
btrMs.AppendEntity(bref)
trx.AddNewlyCreatedDBObject(bref, True)
xref.CloseInput(True)
xref.SaveAs(hostPath, DwgVersion.Current)
trx.Commit()[/code]
Please also let me know above code is right way to insert object into bricscad.
Other Details:
OS: Windows 7 (32 bit)
Bricscad: V12.1.20
Thanks and Regards!
SSD
I am trying to insert custom object into bricscad application using VB.net (VS 2010). I am getting the error:
Could not load file or assembly 'TD_Mgd.dll' or one of its dependencies. The specified module could not be found.
Although TD_Mgd.dll is already add in the reference.
My code is below written to insert the object into Bricscad:
[code] Dim refPath As String = "D:\\Ok.png"
Dim hostPath As String = "D:\\Try1.dwg"
'Dim blockObjb As BricscadDb.
Dim xref As Object
xref.ReadDwgFile(hostPath, FileShare.ReadWrite, False, "")
Using trx As Transaction = xref.TransactionManager.StartTransaction()
Dim xrefBt As BlockTable = xref.BlockTableId.GetObject(OpenMode.ForRead)
Dim btrMs As BlockTableRecord = xrefBt(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
Dim xrefObjId As ObjectId = xref.AttachXref(refPath, Path.GetFileNameWithoutExtension(refPath))
Dim bref As New BlockReference(Teigha.Geometry.Point3d.Origin, xrefObjId)
btrMs.AppendEntity(bref)
trx.AddNewlyCreatedDBObject(bref, True)
xref.CloseInput(True)
xref.SaveAs(hostPath, DwgVersion.Current)
trx.Commit()[/code]
Please also let me know above code is right way to insert object into bricscad.
Other Details:
OS: Windows 7 (32 bit)
Bricscad: V12.1.20
Thanks and Regards!
SSD
0
Comments
-
You may be targeting the .NET 4.0 framework whereas 2.0 - 3.5 is default. if you're not using any 4.0 features, change your project to target 3.5, or if you need 4.0, edit the Bricscad.exe.config file in your install folder. There is a commented 4.0 configuration inside Bricscad.exe.config file Cheers : )0
-
Thanks for reply!
I tried:
1) Modify the bricscad.exe.config for version 4.0 as par suggestion. Please find the attached config file for 4.0. still I am getting same error.
2) Change the target version 2.0 but in this case I am getting below error:
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
please find my attached sample project and help me.
Thanks and Regards!
SSD0 -
Ah ok, You cannot reference the managed API (BrxMgd.dll and TD_Mgd.dll) from an out of process .EXE, only as a loadable module (.dll) . However you can use the COM API.
Dan
0
This discussion has been closed.