View Full Version : AeccDatabasePreferences, DatabaseScale
rkmcswain
2005-01-31, 01:56 PM
LDT 2005
If I open LandEnabledMap first, then open LDT and run the code at the bottom of this post, the code fails with the following error: [Method 'DatabaseScale' of object 'IAeccDatabasePreferences' failed]
If LDT is open and LandEnabledMap is not open -or- if LDT is opened *before* LandEnabledMap, then the code works fine without an error.
Why?
***********************************************************
Dim prefs As AeccDatabasePreferences
Set prefs = AeccApplication.ActiveDocument.Preferences
proHscale = prefs.DatabaseScale
***********************************************************
TIA
jwanstaett
2005-01-31, 06:30 PM
I do not have LDT or LandEnabledMap but the same thing go on in ADT
The AEC database preferences object extends the AutoCAD database preferences object with additional AEC functionality
This is done in both LDT and LandEnabledMap
In LandEnabledMap AeccDatabasePreferences.DatabaseScale in not define
but in LDT AeccDatabasePreferences.DatabaseScale is define
fix
change
Dim prefs As AeccDatabasePreferences
Dim prefs As xxx.AeccDatabasePreferences
where xxx = the references to the LDT Library
rkmcswain
2005-02-01, 12:43 PM
Dim prefs As AeccDatabasePreferences
Dim prefs As xxx.AeccDatabasePreferences
where xxx = the references to the LDT Library
What is "xxx" in your example?
I realize that there is no DatabasePreferences in LandEnabledMap, but how does the code running in a separate session (LDT) even know Map is running, much less try to access this propery from it?
TIA
jwanstaett
2005-02-01, 01:56 PM
use the Object Browser in VBA
AeccDatabasePreferences Classes should show 2 time in the list of Classes
if both LDT and LandEnabledMap are References
select one and see if DatabaseScale is in the members of list
with AeccDatabasePreferences selected in the classes check to see what
AeccDatabasePreferences is a member of this is what xxxx=
note: the LDT libraries need to be References to show in the object browser
if you do not know how to open the object browser
in Microsoft Visuals Basic editor menu View-> Object Browser
or F2 will open the Object Browser
rkmcswain
2005-02-01, 02:23 PM
use the Object Browser in VBA
AeccDatabasePreferences Classes should show 2 time in the list of Classes
No. The classes [DatabasePreferences] and [DatabaseScale] are each referenced only ONCE - each by the "AutoCAD Land" library (landauto.tlb)
Thanks again.
Jeff_M
2005-02-02, 12:57 AM
Well, this raises some issues that the old advice, regarding LDD, addresses......Don't have more than one LDD session open at a time.
I say this because after some testing for the past hour, it appears that the AeccApplication will ALWAYS attach itself to the FIRST ACAD.EXE loaded into the application heirarchy. Which results in the error you are recieving but even more importantly, it results in the Databasescale for the first drawing being read if you execute that code in the second (or third, fourth, etc.) instance of LDD. I didn't check what other properties/methods may be affected by this, but to me it just doesn't matter......don't expect anything written through the Land ActiveX interface to work on anything other than when LDD is the first instance of ACAD.EXE AND that first instance is the one you are using the ActiveX interface with.
An easy way to check this is to check the ActiveDocument.Name property once you have the AeccApplication object. In all of my tests it is always the first drawing I opened......
HTH, I know it has me,
Jeff
rkmcswain
2005-02-02, 01:03 AM
Well, this raises some issues that the old advice, regarding LDD, addresses......Don't have more than one LDD session open at a time.
I say this because after some testing for the past hour, it appears that the AeccApplication will ALWAYS attach itself to the FIRST ACAD.EXE loaded into the application.
Jeff
Ok, I'll buy that, but then your second sentence is not accurate. Did you mean "Don't have more that one [AutoCAD] session open at a time" ?
...because we are not running more than one session of LDT. In the OP - I said this problem occurs when LDT and Map were open (when Map is opened first - which fits your second paragraph statements) - there was nothing about running two sessions of LDT.
If you are correct, then the whole thing stinks - It's bad enough that LDT is SDI, but now you can't even run two sessions of "Acad.exe" or the API gets confused....
Thanks.
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.