PDA

View Full Version : GetObject



rad.77676
2004-12-31, 12:12 AM
Ok,
I have tried to find out if it would be possible to open LDD and check to see if user has autocad open and minimized.
I have heard yes, I have heard no, so lets start with this.

Is it possible to open LDD and run a VBA routine that would perform the following.
Mind you these are only bits and pieces, and I know it is not complete I am just fishing!

Code:

Dim appAcad As Object
Dim ldd As Object

'On Error Resume Next
Set appAcad = GetObject(, "AutoCAD.Application") ;check for autocad
If Err Then
Err.Clear ;if no acad
Set ldd = appAcad.GetInterfaceObject("Aecc.Application") ;open LDD

If autocad is open then alert user before LDD loads profile;;;;;;;;;;;;;;

MsgBox "Autocad is open, Do you wish to save", vbOKOnly

If true, save acadapplication and exit
If false, exit acadapplication
Load LDD profile

RobertB
2004-12-31, 12:37 AM
By the time LDD can run VBA, it is too late, the profile has loaded. I agree with the posts over at Autodesk, you need to determine why the profile munching is occurring, not trying to band-aid a solution. The other posts suggested using VB Scripting to run a custom icon for LDD. You will not be able to do what you want within LDD normal launch.

rad.77676
2004-12-31, 06:22 AM
If you've read the other post then perhaps you might like to venture a guess as to why the profile is overwriting.
My guess is that it has something to do with the way we install acad and LDD but autodesk's tech support isn't sure, so where does one turn?
Perhaps this is one reason that autodesk no longer supports this type of install?

Any ideas appreciated!

Thank you for clearing up the whole VBA idea, it's not always clear when you're just learning and you've got people sharing their different opinions about what might or might not work.

RobertB
2004-12-31, 09:27 PM
You might find better non-programming answers for LDD in those newsgroups, but I'll offer what I can. So you have two separate installs, LDD and then vanilla AutoCAD? Why? Isn't LDD based on AutoCAD, and if so, why not use a profile that doesn't load the LDD arx files?
When I have Building Systems installed I can simply load vanilla AutoCAD just by using the /P switch in my vanilla icon without installing a vanilla AutoCAD package.

rad.77676
2005-01-04, 04:51 PM
Robert,
That is correct, we install LDD which includes civil design, and acad map.
We run two seperate profiles one for acad and the other for LDD.
They are both launched from seperate custom icon's.
Thanx

RobertB
2005-01-04, 11:19 PM
What part of the profile gets munched when LDD is run parallel to vanilla AutoCAD?

rad.77676
2005-01-05, 06:51 PM
Robert,
I'm not sure about your question, but I'll try.
When I state that the profile is overwritten, I mean that autocad becomes LDD.
So I'm not sure which part of the profile that would be, it was my understanding that acad and LDD share some areas of the registry. That being said, it was my belief that LDD upon opening was changing the registry and therefore when acad looked to the registry it was changed and acad inherited those changes.
I may be way off base, but not sure!
Thanx - Rob

rad.77676
2005-01-06, 12:19 AM
Robert,
Just wanted to run something by you maybe you could lend me some advice.

I am able through DOS to do what I need, short of setting up a VBA routine that would load an LDD profile from a specific location.

any suggestions?

RobertB
2005-01-06, 12:44 AM
Robert,
I'm not sure about your question, but I'll try.
When I state that the profile is overwritten, I mean that autocad becomes LDD.
So I'm not sure which part of the profile that would be, it was my understanding that acad and LDD share some areas of the registry. That being said, it was my belief that LDD upon opening was changing the registry and therefore when acad looked to the registry it was changed and acad inherited those changes.
I may be way off base, but not sure!
Thanx - Rob
The problem here is that LDD only works in SDI-mode. So let me work thru the "AutoCAD thinking" here.

You start AutoCAD with the desktop icon, which loads AutoCAD in MDI-mode and without the LDD arx files. You merrily go on with your work.

Now you start LDD with the desktop icon, which starts AutoCAD in SDI-mode with the LDD arx files.

At this point there cannot be two different applications of AutoCAD, one in MDI-mode and the other in SDI-mode. The MDI-mode AutoCAD is changed to SDI-mode immediately.

Now my question to you is: If you close both instances of AutoCAD (remember, LDD is just a form of AutoCAD) and start vanilla AutoCAD from the desktop icon, does AutoCAD start up "normally" in MDI-mode?

RobertB
2005-01-06, 12:44 AM
I am able through DOS to do what I need, short of setting up a VBA routine that would load an LDD profile from a specific location.
Nothing can be done, to my knowledge.

RobertB
2005-01-06, 03:17 AM
Why don't you give the attached a try? Donations are gratefully accepted. ;)

rad.77676
2005-01-10, 05:12 PM
Robert,
Thanks for all your help!
After searching acad discussions I was able to find a post that clarified the error of my ways.
I was not aware of the differences between setting a profile current and launching a profile from the icon.

I still am not sure what to do about this problem since our acad profile forces SDI mode for our techs.
After further testing of this problem on my system, I realize that this problem only occurs after opening drawings in both acad and LDD and saving work.

The profile only overwrites after reopening acad.

RobertB
2005-01-10, 05:45 PM
I still am not sure what to do about this problem since our acad profile forces SDI mode for our techs.
After further testing of this problem on my system, I realize that this problem only occurs after opening drawings in both acad and LDD and saving work.

The profile only overwrites after reopening acad.
Did you try the script/icon I posted in this thread?

rad.77676
2005-01-10, 07:36 PM
Robert,
Thanks for the script, I'll give it a go.
I'm guessing I will have to tweak it a bit for acad version and file location?

rad.77676
2005-01-10, 08:17 PM
Robert,
This works if acad is open, but get an error if not.

These are the changes I made.

' Change the location below as needed for the correct location of Acad.exe
aShell.CurrentDirectory = "\\Vncvr1\D\Ldd\"

' Change the profile location/filename as required
aShell.Run ("\\vncvr1\d\ldd\acad.exe /p \\Vncvr2\e\cadd\system\ldd3_van.arg")

C:\WINDOWS\system32\wscript.exe "F:\users\rad\Downloads\LaunchAutoCAD.vbs"

I cannot saveas a .vbs, only .dvb any suggestions?

Thanx for all your help!
Rob

RobertB
2005-01-10, 10:26 PM
What is the error? I don't get one here in that circumstance.

.VBS files can be edited in Notepad; they are plain text files.

Is the Acad.exe truely located on the server?! You don't have the .exe local on each computer?

rad.77676
2005-01-10, 11:13 PM
Robert,
I reset paths and run script, autocad opens, profile tries to load but with the following errors. It looks like LDD has loaded, but only a partial load.

The following is from textscreen after startup:
AutoCAD Express Tools Copyright © 2000 Autodesk, Inc.

AutoCAD menu utilities loaded.
Loading AecBase...
Loading AecUiBase...
Loading AecUtilities...
Loading AecCivilBase...
Loading AecDraft...
Loading AecLS...
Error opening PP message file!
Error opening ZQ message file!
Loading AecCivilApp...
Unable to load message files.
Initializing...; error: ADS request error

RobertB
2005-01-11, 03:21 AM
I reset paths and run script, autocad opens, profile tries to load but with the following errors. It looks like LDD has loaded, but only a partial load.
...
Error opening PP message file!
Error opening ZQ message file!
Loading AecCivilApp...
Unable to load message files.
Initializing...; error: ADS request error
Thanks for the added info. That helps, in a way. At least we know the script isn't really at fault. Once again, I don't have LDD, so I'm limited in the advice I can offer.

Look at the properties of your LDD icon. Where is the Startup Location? Are there any other parameters other than the profile switch (/P)?

rad.77676
2005-01-11, 04:03 PM
Robert,
The icon is pathed as follows:

\\Vncvr1\d\ldd\acad.exe /p "Vncvr2\e\cadd\system\ldd3_van.arg"

In order for it to work in the script I had to change it to:

"\\Vncvr1\d\ldd\acad.exe /p \\Vncvr2\e\cadd\system\ldd3_van.arg"

I put together a DOS batch file prior to your script and this is the same problem that I ran into with trying to use the /p switch in DOS. I have since read in acad disc. group that loading the profile is not the same as launching from an icon.

Could it be that the aShell.Run portion of the script is simply loading the profile, therefore we still have the same problem???

Thanx,
Rob

RobertB
2005-01-13, 04:21 PM
If you modify a copy of the icon to do the same thing as the script modification, what happens?

rad.77676
2005-01-13, 05:33 PM
Robert,
Same problem, only a partial load of LDD.

RobertB
2005-01-14, 06:39 AM
So you copied the normal LDD icon, used the profile switch from the original icon, and still had trouble?

rad.77676
2005-01-14, 04:44 PM
Yes, Same problem

RobertB
2005-01-14, 06:39 PM
I would ask why that happens over in the LDD forum.

rad.77676
2005-01-14, 10:07 PM
Thanx for all your help, much appreciated!
Rob