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

CommandMethod Issues

16 REPLIES 16
Reply
Message 1 of 17
Anonymous
1122 Views, 16 Replies

CommandMethod Issues

I have a library which i have continusouly built up over the last 2 years named MRPTools.dll

the library and it's references are designed to work in 2006. Now i'm having problems debugging, and using commands after i save a drawing.

this seems to have happened after having installed Civil 3D 2008. i have been starting to compile code with the 3D libraries, and ever since i recompiled my original code (still all referencing 2006) any command in my code won't run after saving.

So to try and explain it better. I have my library being demand loaded, it has event handlers which monitor the save/open/close events of a drawing, and write this data to a database. These event handlers continue to work even when the commands registered with CommandMethod don't.

i have the following on my machine, which may or may not be affecting what i'm doing:

Land Development Desktop (LDD) 2006 (primary program for drafting)
LDD 2007
Civil 3D 2008 which includes Land Desktop Companion 2008
all of these include some version of AutoCAD Map 3D
and i have MapGuide Studio 2008

If anyone has any ideas, i would greatly appreciate it.
16 REPLIES 16
Message 2 of 17
Anonymous
in reply to: Anonymous

I edited the LOADCTRLS entry in the registry for every version of AutoCAD i have, setting them to 12, to no avail.
Message 3 of 17
Anonymous
in reply to: Anonymous

Make sure that all of the AutoCAD assemblies
(e.g.,, acdbmgd.dll and acmdg.dll) that are
referenced in your project, have their 'CopyLocal'
property set to false.

--
http://www.caddzone.com

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

wrote in message news:5731614@discussion.autodesk.com...
I have a library which i have continusouly built up over the last 2 years named MRPTools.dll

the library and it's references are designed to work in 2006. Now i'm having problems debugging, and using commands after i save a drawing.

this seems to have happened after having installed Civil 3D 2008. i have been starting to compile code with the 3D libraries, and ever since i recompiled my original code (still all referencing 2006) any command in my code won't run after saving.

So to try and explain it better. I have my library being demand loaded, it has event handlers which monitor the save/open/close events of a drawing, and write this data to a database. These event handlers continue to work even when the commands registered with CommandMethod don't.

i have the following on my machine, which may or may not be affecting what i'm doing:

Land Development Desktop (LDD) 2006 (primary program for drafting)
LDD 2007
Civil 3D 2008 which includes Land Desktop Companion 2008
all of these include some version of AutoCAD Map 3D
and i have MapGuide Studio 2008

If anyone has any ideas, i would greatly appreciate it.
Message 4 of 17
Anonymous
in reply to: Anonymous

yes, i have done this already.

This is just too weird.

When debugging, the DLL is no longer automatically loaded into CAD.
Some commands work, commands that existed before this voodoo started going down. new commands that i have created are not working, even though they use the exact same syntax. to check myself, i even copied a working command and renamed the command, and the sub... nothing.
Message 5 of 17
Anonymous
in reply to: Anonymous

Also make sure that you are referencing the
aformentioned assemblies for the release or
product that your build targets.

If you are targeting multiple products/releases,
you have two options:

1. You need to do some manual manipulation of
the project file, to use build configuration-specific
conditions for project references. If you do that,
then you can have different build configurations
within the same project, with each targeting a
different release/product, and using the targeted
release/product's assemblies.

2 Create multiple projects, one for each targeted
product/release, and add the same source files to
each project (add them as linked files rather than
contained in the project folder), and then just set
each project's references to the assemblies from
the targeted product/release.

--
http://www.caddzone.com

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

"Tony Tanzillo" wrote in message news:5731740@discussion.autodesk.com...
Make sure that all of the AutoCAD assemblies
(e.g.,, acdbmgd.dll and acmdg.dll) that are
referenced in your project, have their 'CopyLocal'
property set to false.

--
http://www.caddzone.com

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

wrote in message news:5731614@discussion.autodesk.com...
I have a library which i have continusouly built up over the last 2 years named MRPTools.dll

the library and it's references are designed to work in 2006. Now i'm having problems debugging, and using commands after i save a drawing.

this seems to have happened after having installed Civil 3D 2008. i have been starting to compile code with the 3D libraries, and ever since i recompiled my original code (still all referencing 2006) any command in my code won't run after saving.

So to try and explain it better. I have my library being demand loaded, it has event handlers which monitor the save/open/close events of a drawing, and write this data to a database. These event handlers continue to work even when the commands registered with CommandMethod don't.

i have the following on my machine, which may or may not be affecting what i'm doing:

Land Development Desktop (LDD) 2006 (primary program for drafting)
LDD 2007
Civil 3D 2008 which includes Land Desktop Companion 2008
all of these include some version of AutoCAD Map 3D
and i have MapGuide Studio 2008

If anyone has any ideas, i would greatly appreciate it.
Message 6 of 17
Anonymous
in reply to: Anonymous

I am using separate projects for different releases. My 2006 version has been screwy ever since i started a completely different project for 2008.

the correct libraries are referenced for 2006.
Message 7 of 17
Anonymous
in reply to: Anonymous

Are you using the C# Autodesk Wizard ?

Are you sure that your 2006 project references
the managed assemblies from AutoCAD 2006,
and not from AutoCAD 2008?

Is your application using AutoCAD ActiveX ?

If so, that is most likely the problem, because
the COM interop assemblies are in the GAC, which
if you ask me, is very close to outright sabotage.

If you are using multiple releases of AutoCAD and
are using ActiveX, you are going to have problems,
and there is no easy way around that, short of
building your own interop assemblies from the
ActiveX dlls located in the AutoCAD folder (the IDE
interop wrapper generator uses the .TLB files in the
Autodesk Shared folder, which is always from the
latest release installed on the system).

It was Autodesk's choice (no ActiveX support for
multiple releases), and they're fully aware of the
level of grief it has caused developers (interestingly,
it doesn't harm end users as much, because they
typically do not have to deal with/target multiple
AutoCAD releases).

--
http://www.caddzone.com

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

wrote in message news:5731792@discussion.autodesk.com...
I am using separate projects for different releases. My 2006 version has been screwy ever since i started a completely different project for 2008.

the correct libraries are referenced for 2006.
Message 8 of 17
Anonymous
in reply to: Anonymous

Yes i am using ActiveX.... it's the only way i could figure out how to regen my drawing when required. So, it seems weird that the whole time i had 2007 on my machine it didn't seem to affect things.... but now that i think about it, when i built a project for 2007, i had issues with it. i was never able to add the COM reference, so i just gave up on it.

i will look into this further. Thanks for the heads up.
Message 9 of 17
Anonymous
in reply to: Anonymous

I removed every reference to the COM assembiles, removed the references themselves, and re-built my DLL.

Same thing, commands work, then they stop working after a save. some commands don't work at all unless i put them into the main class. (i have 2 class libraries in my solution, one is MRP and one is Testing)
some commands don't work in the Testing class at all.

i'm not using the C# Autodesk wizard, and i'm sure that the 2006 references are correct. i added them through the add reference dialog, using the browse tab, and then browsing to the libraries in the AutoDesk Land Desktop 2006 directory. i then set the copylocal property to false, and tried the versionspecific property as true and false.
Message 10 of 17
Anonymous
in reply to: Anonymous

Can't really tell you what it could be (there's plenty
of possible causes), without seeing the code.

--
http://www.caddzone.com

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

wrote in message news:5734187@discussion.autodesk.com...
I removed every reference to the COM assembiles, removed the references themselves, and re-built my DLL.

Same thing, commands work, then they stop working after a save. some commands don't work at all unless i put them into the main class. (i have 2 class libraries in my solution, one is MRP and one is Testing)
some commands don't work in the Testing class at all.

i'm not using the C# Autodesk wizard, and i'm sure that the 2006 references are correct. i added them through the add reference dialog, using the browse tab, and then browsing to the libraries in the AutoDesk Land Desktop 2006 directory. i then set the copylocal property to false, and tried the versionspecific property as true and false.
Message 11 of 17
Anonymous
in reply to: Anonymous

tony,
maybe you can shine some light on this.

I'm finding out now that only subs in certain classes are working.
My DLL is arranged like so:

Public Class MRP1
-Public Class LayStateManager
sub1
sub2
etc.
-End Class 'LayStateManager
-Public Class BlockUtilities
sub1
sub2
etc.
-End Class 'BlockUtilities
-Public Class SurveyUtilities
sub1
sub2
etc.
-End Class 'SurveyUtilities
End Class

Public Class Testing
- etc. etc.
- etc. etc.
End Class

now, subs in the LayerStateManager and BlockUtilities are working, but they aren't working in the SurveyUtilities
i have 7 classes under the initial MRP1 and only 2 of them are working.

I am beginning to think that my demand loading is screwed up, or that something in the layout of my programs is no longer working with AutoCAD.

I only have one command registered in the COMMANDS key in the registry.
untill now this has worked fine. The one command that is registered is the first one... LM with a value of LSMan.
do i need to have every custom command listed here? or perhaps have my commands entered in differenlty (i.e. LM w/ value of MRP1.LayStatesManager.LSMan)

i have attached my code. Thanks for the help, i really appreciate it.
Message 12 of 17
Anonymous
in reply to: Anonymous

>> I only have one command registered in the COMMANDS
>> key in the registry.

Then, only that command is going to load your assembly,
if you're not explicitly loading it some other way.

If the assembly is demand-loaded (e.g., when one of its
commands is invoked), then every command must be in
the Commands key, or only those that are there will be
recognized as commands.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
Message 13 of 17
Anonymous
in reply to: Anonymous

What exactly is the syntax involved in that?
also, i noticed some of the other AutoDesk keys have an additional key GROUPS.
i couldn't find out the function of this key in the ARX documentation.

i have tried adding one command for every Public Class in my program. but those commands have not been running.

Even when i use NETLOAD, the same subs are not working.
Message 14 of 17
Anonymous
in reply to: Anonymous

Have a look at the ObjectARX documentation for
what groups are. You don't need them, as long as
your command names are unique.

As far as your commands not working, you need
to run your app in the debugger, to see if there
is any exception being thrown in your Initialize()
method (of IExtensionApplication).

The managed runtime hide exceptions thrown in
Initialize(), and that makes it hard to find them.

--
http://www.caddzone.com

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

wrote in message news:5743671@discussion.autodesk.com...
What exactly is the syntax involved in that?
also, i noticed some of the other AutoDesk keys have an additional key GROUPS.
i couldn't find out the function of this key in the ARX documentation.

i have tried adding one command for every Public Class in my program. but those commands have not been running.

Even when i use NETLOAD, the same subs are not working.
Message 15 of 17
Anonymous
in reply to: Anonymous

is there something special I need to do to debug?
I debug my code through VS 2005 all the time, and it doesn't show any exceptions.
as a quick side question? when you debug, does your library automatically attach itself to the AutoCAD session you started? meaning, that i don't have to NETLOAD my DLL when i debug. it just automatically loads it.
Message 16 of 17
Anonymous
in reply to: Anonymous

You want to debug the Initialize() method, so AutoCAD
has to be running in the debugger before your assembly
loads. You can either specify AutoCAD as the program to
start in the debug options, or you can attach to it before
your assembly loads.

--
http://www.caddzone.com

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

wrote in message news:5743717@discussion.autodesk.com...
is there something special I need to do to debug?
I debug my code through VS 2005 all the time, and it doesn't show any exceptions.
as a quick side question? when you debug, does your library automatically attach itself to the AutoCAD session you started? meaning, that i don't have to NETLOAD my DLL when i debug. it just automatically loads it.
Message 17 of 17
Anonymous
in reply to: Anonymous

I have been debugging using this method. Still... No errors.

I put all of my code into a new solution, and removed all the classes except for the Main one (MRP1)
Almost all of my commands started working right after this except for a few at the end. After moving a working command to the bottom (below a few commands that weren't working) they all started to work.

Okay, so now i'm still trying to figure this all out.
I am trying to write a quick utility that will tell me what commands are loaded from what modules inside autocad.

so far i am using AppDomain.Currentdomain.GetAssemblies().
this appears to be listing the currently loaded DLL files.
I'm not sure how to go about getting the individual commands being loaded though

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