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

SymbolUtilityServices Version Change?

3 REPLIES 3
Reply
Message 1 of 4
Techno Destructo
453 Views, 3 Replies

SymbolUtilityServices Version Change?

When I need to find the space I was in for 2006 in wrote this
SymbolUtilityServices service = new SymbolUtilityServices();
currentSpaceId = service.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase)

This worked just fine


Now when I try this using the acdbmgd and acmgd references from AutoCAD 2008 the project compiles but when I run the app I get this error:
--> System.MissingMethodException: Method not found: 'Autodesk.AutoCAD.DatabaseServices.ObjectId Autodesk.AutoCAD.DatabaseServices.SymbolUtilityServices.GetBlockModelSpaceId(Autodesk.AutoCAD.DatabaseServices.Database)'.

To make it work I have to now use:
currentSpaceId = SymbolUtilityServices.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase)

am I doing something wrong? Or has something changed
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Techno Destructo

Your code was wrong to start with. You
shoudn't create instances of that class.

The method you're calling is static.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5570207@discussion.autodesk.com...
When I need to find the space I was in for 2006 in wrote this
SymbolUtilityServices service = new SymbolUtilityServices();
currentSpaceId = service.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase)

This worked just fine


Now when I try this using the acdbmgd and acmgd references from AutoCAD 2008 the project compiles but when I run the app I get this error:
--> System.MissingMethodException: Method not found: 'Autodesk.AutoCAD.DatabaseServices.ObjectId Autodesk.AutoCAD.DatabaseServices.SymbolUtilityServices.GetBlockModelSpaceId(Autodesk.AutoCAD.DatabaseServices.Database)'.

To make it work I have to now use:
currentSpaceId = SymbolUtilityServices.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase)

am I doing something wrong? Or has something changed
Message 3 of 4

Yes, I see that now but if I try
currentSpaceId = SymbolUtilityServices.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase);

using references to autocad 2006 the compiler gives me this error:

An object reference is required for the nonstatic field, method, or property 'Autodesk.AutoCAD.DatabaseServices.SymbolUtilityServices.GetBlockModelSpaceId(Autodesk.AutoCAD.DatabaseServices.Database)' (CS0120)
Message 4 of 4

For anyone interested, changes have been made.
By Reflecting both 2006 and 2008 acdbmgd.dll and looking at
GetBlockModelSpaceId we find these differences:

2007: public static unsafe ObjectId GetBlockModelSpaceId(Database databasePointer)


2006: public unsafe ObjectId GetBlockModelSpaceId(Database databasePointer)

So it has been changed to a static method in 2008.
I guess my code wasn't wrong for the 2006 version.

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