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

loadmodule acismobj18.dbx with RealDWG 2011

7 REPLIES 7
Reply
Message 1 of 8
boyan.au
2009 Views, 7 Replies

loadmodule acismobj18.dbx with RealDWG 2011

I am using .Net 3.5 to develop a WPF application, using RealDWG 2011 to read and write DWG files.
In the Tips and Techniques section of RealDWG 2011 Readme, it says 'first link to the Imaging Support Module (ISM) DBX, then have your application explicitly load that DBX file (for example, using AcRxSynamicLinker::loadModule()) before attempting to call any of the raster APIs."

So, my first question is how to link to the ISM DBX?

I tried the following code to load the module acismobj18.dbx ( Is it the ISM DBX? ) before creating RasterImageDef instance:
Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.LoadModule("acismobj18.dbx", false, true);
and get one error message box and one exception. The exception is:
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Autodesk.AutoCAD.Runtime.Interop.CheckBool(Boolean returnValue)
at Autodesk.AutoCAD.Runtime.DynamicLinker.LoadModule(String fileName, Boolean printIt, Boolean asCmd)
The error message box is: This application has failed to start because ac1st17.dll was not found. Re-installing the application may fix this problem.
Debugging with vs.net will NOT have this error message box, but will have the exception when loading module.

Any help is very appreciated.

Bo
7 REPLIES 7
Message 2 of 8
boyan.au
in reply to: boyan.au

With RealDWG 2009, we use the C# code (new RasterImage()).Dispose() to preload acismobj17.dbx. However, this does not work with RealDWG 2011.
How do I preload acismobj18.dbx in managed code in stand-alone application?

Thanks,
Bo
Message 3 of 8
Anonymous
in reply to: boyan.au

That workaround was necessary because of a bug
in the managed API (the ISM module is supposed
to be loaded by the RasterImage's static constructor,
but the code was mistakenly placed in the instance
constructor instead).

A quick look with Reflector reveals that the bug has
not been fixed. It still loads the ISM from the instance
constructor, so it looks like nothing has changed from
2009.

When you say that it no longer works, what exactly
happens when you use the workaround?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6376061@discussion.autodesk.com...
With RealDWG 2009, we use the C# code (new RasterImage()).Dispose() to preload
acismobj17.dbx. However, this does not work with RealDWG 2011.
How do I preload acismobj18.dbx in managed code in stand-alone application?

Thanks,
Bo
Message 4 of 8
boyan.au
in reply to: boyan.au

Hi Tony,
Thank you for telling me the same trick should apply.
When I created the instance of RasterImage, I got the exception:
System.IO.FileLoadException: acismobj18.dbx
at LoadISM()
at Autodesk.AutoCAD.DatabaseServices.RasterImage..ctor()
This is exactly the same exception as using any other raster image API in RealDWG 2011, and I have confirmed the file acismobj18.dbx is at the same directory as the exe file.

Is there any other way to work around this issue?

Thanks and cheers,
Bo
Message 5 of 8
Anonymous
in reply to: boyan.au

What happens if you read a DWG file that contains
raster images?

Do you get the same exception when you use
Transaction.GetObject() to open an existing
RasterImage entity?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6376093@discussion.autodesk.com...
Hi Tony,
Thank you for telling me the same trick should apply.
When I created the instance of RasterImage, I got the exception:
System.IO.FileLoadException: acismobj18.dbx
at LoadISM()
at Autodesk.AutoCAD.DatabaseServices.RasterImage..ctor()
This is exactly the same exception as using any other raster image API in
RealDWG 2011, and I have confirmed the file acismobj18.dbx is at the same
directory as the exe file.

Is there any other way to work around this issue?

Thanks and cheers,
Bo
Message 6 of 8
boyan.au
in reply to: boyan.au

When I read a DWG file that contains raster image using RealDWG 2011, there is no exception, and no image.
TrueView 2011 confirms that there is a background image in this DWG file.The RasterImage entity should be in a blockreference.
When exploding this block using BlockReferene.Explode method, there is no RasterImage entity in the returned DBObjectCollection, only 1 polyline entity in the collection.

Using DumpDWG sample compiled with RealDWG 2011 to dump this dwg file will show a message box: "ObjectDBX SDK DumpDwg Sample has encountered a user-defined breakpoint.", although I didn't put any breakpoint in the source code.
The last few lines DumpDWG shows are:
BlockTableRecord.UnmanagedObject System.IntPtr=114612032
Autodesk.AutoCAD.DatabaseServices.RasterImage:
- RasterImage.Width System.Double=2481
- RasterImage.ImageTransparency System.Boolean=False
- RasterImage.ShowImage System.Boolean=True
- RasterImage.Rotation System.Double=0
- RasterImage.Position Autodesk.AutoCAD.Geometry.Point3d=(2481,1754,0)
- RasterImage.Path System.String=
- RasterImage.Name System.String=618103 WANG - NUDE
- RasterImage.ImageWidth System.Double=2481
- RasterImage.ImageHeight System.Double=1754
- RasterImage.Height System.Double=1754
- RasterImage.Fade System.Byte=0
- RasterImage.Contrast System.Byte=50
- RasterImage.Brightness System.Byte=50
- RasterImage.DisplayOptions Autodesk.AutoCAD.DatabaseServices.ImageDisplayOptions=Show
- RasterImage.PixelToModelTransform Autodesk.AutoCAD.Geometry.Matrix3d=((1,0,0,0.5),(0,-1,0,1753.5),(0,0,1,0),(0,0,0,1))
- RasterImage.IsClipped System.Boolean=True
- RasterImage.ClipBoundaryType Autodesk.AutoCAD.DatabaseServices.ClipBoundaryType=Rectangle
- RasterImage.Scale Autodesk.AutoCAD.Geometry.Vector2d=(2481,1754)
- RasterImage.Orientation Autodesk.AutoCAD.Geometry.CoordinateSystem3d=((0,0,0),(2481,0,0),(0,1754,0),(0,0,4351674))
- RasterImage.ReactorId Autodesk.AutoCAD.DatabaseServices.ObjectId=(0)
- RasterImage.ImageDefId Autodesk.AutoCAD.DatabaseServices.ObjectId=(2129671240)
Autodesk.AutoCAD.DatabaseServices.RasterImageDef:
- RasterImageDef.ImageModified System.Boolean=False
- RasterImageDef.UndoStoreSize System.Int32=10
- RasterImageDef.FileDescCopy System.IntPtr=0
- RasterImageDef.ResolutionUnits Autodesk.AutoCAD.DatabaseServices.Unit=Inch
- RasterImageDef.ResolutionMMPerPixel Autodesk.AutoCAD.Geometry.Vector2d=(0.169333333333333,0.169333333333333)
- RasterImageDef.FileType System.String=
- RasterImageDef.ColorDepth System.Int32=32
- RasterImageDef.Organization Autodesk.AutoCAD.GraphicsInterface.ImageOrg=RGB
- RasterImageDef.Size Autodesk.AutoCAD.Geometry.Vector2d=(2481,1754)
- RasterImageDef.IsLoaded System.Boolean=False
- RasterImageDef.IsEmbedded System.Boolean=False
Message 7 of 8
Anonymous
in reply to: boyan.au

Well, it looks like there are real problems there, although
the DumpDWG utility must be getting a RasterImage
object, otherwise it couldn't dump its properties. I haven't
checked, but it could be that the RasterImage and/or the
RasterImageDef object have some sort of obscure API
dependence on AutoCAD (or acmdg.dll).

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6377890@discussion.autodesk.com...
When I read a DWG file that contains raster image using RealDWG 2011, there is
no exception, and no image.
TrueView 2011 confirms that there is a background image in this DWG file.The
RasterImage entity should be in a blockreference.
When exploding this block using BlockReferene.Explode method, there is no
RasterImage entity in the returned DBObjectCollection, only 1 polyline entity in
the collection.

Using DumpDWG sample compiled with RealDWG 2011 to dump this dwg file will show
a message box: "ObjectDBX SDK DumpDwg Sample has encountered a user-defined
breakpoint.", although I didn't put any breakpoint in the source code.
The last few lines DumpDWG shows are:
BlockTableRecord.UnmanagedObject System.IntPtr=114612032
Autodesk.AutoCAD.DatabaseServices.RasterImage:
- RasterImage.Width System.Double=2481
- RasterImage.ImageTransparency System.Boolean=False
- RasterImage.ShowImage System.Boolean=True
- RasterImage.Rotation System.Double=0
- RasterImage.Position Autodesk.AutoCAD.Geometry.Point3d=(2481,1754,0)
- RasterImage.Path System.String=
- RasterImage.Name System.String=618103 WANG - NUDE
- RasterImage.ImageWidth System.Double=2481
- RasterImage.ImageHeight System.Double=1754
- RasterImage.Height System.Double=1754
- RasterImage.Fade System.Byte=0
- RasterImage.Contrast System.Byte=50
- RasterImage.Brightness System.Byte=50
- RasterImage.DisplayOptions
Autodesk.AutoCAD.DatabaseServices.ImageDisplayOptions=Show
- RasterImage.PixelToModelTransform
Autodesk.AutoCAD.Geometry.Matrix3d=((1,0,0,0.5),(0,-1,0,1753.5),(0,0,1,0),(0,0,0,1))
- RasterImage.IsClipped System.Boolean=True
- RasterImage.ClipBoundaryType
Autodesk.AutoCAD.DatabaseServices.ClipBoundaryType=Rectangle
- RasterImage.Scale Autodesk.AutoCAD.Geometry.Vector2d=(2481,1754)
- RasterImage.Orientation
Autodesk.AutoCAD.Geometry.CoordinateSystem3d=((0,0,0),(2481,0,0),(0,1754,0),(0,0,4351674))
- RasterImage.ReactorId Autodesk.AutoCAD.DatabaseServices.ObjectId=(0)
- RasterImage.ImageDefId Autodesk.AutoCAD.DatabaseServices.ObjectId=(2129671240)
Autodesk.AutoCAD.DatabaseServices.RasterImageDef:
- RasterImageDef.ImageModified System.Boolean=False
- RasterImageDef.UndoStoreSize System.Int32=10
- RasterImageDef.FileDescCopy System.IntPtr=0
- RasterImageDef.ResolutionUnits Autodesk.AutoCAD.DatabaseServices.Unit=Inch
- RasterImageDef.ResolutionMMPerPixel
Autodesk.AutoCAD.Geometry.Vector2d=(0.169333333333333,0.169333333333333)
- RasterImageDef.FileType System.String=
- RasterImageDef.ColorDepth System.Int32=32
- RasterImageDef.Organization Autodesk.AutoCAD.GraphicsInterface.ImageOrg=RGB
- RasterImageDef.Size Autodesk.AutoCAD.Geometry.Vector2d=(2481,1754)
- RasterImageDef.IsLoaded System.Boolean=False
- RasterImageDef.IsEmbedded System.Boolean=False
Message 8 of 8
anndunbar
in reply to: boyan.au

Using RealDWG 2013, I was having a problem reading a DWG file with Raster Attachments. 

 

RasterImageDef imgDef = Tx.GetObject((ObjectId)imageEntry.Value, OpenMode.ForRead) as RasterImageDef;

was returning null.

 

I used the workaround mentioned here

 new RasterImage().Dispose();

it worked for me.

 

I did not have this problem with RealDwg 2012, so I'm not sure what changed.

 

 

 

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