AutoCAD Land Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Project Preferences Settings

1 REPLY 1
Reply
Message 1 of 2
Anonymous
192 Views, 1 Reply

Project Preferences Settings

Hi,

Has anyone tried to toggle on/off any of the project preferences settings in
VBA?
They are controlled through normal Settings functions and some just have a
On/Off state.

They are declared as enumerated "eAeccPref... " types and usually hold a
list of constants with preset values for every switch.

I have used the following list from eAeccPrefParcelInt:

kIncludeParcelLines
kNumberLabelsOn

Using those, I was only able to toggle Off. Repeated use would leave the
toggle Off.
NB: There are no constants named "kNumberLabelsOff"

How to read a current state of the setting, toggle it On or Off as needed
and reset to original state?

Any advise is welcome.

TIA

Rad
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Ha, ha,

Of course, the standard 1 and 0 worked like a charm!
But what confused me when I tried them at first was that when you query any
of the "kNumberLabelsOn" etc. at runtime, they return values of 5, 6, 11...

Obviously, this was misleading (in my case, anyway...).
So, the right way to do it is:

...snip code

Set parcelPref = AeccApplication.ActiveProject.Preferences.parcel
Dim ti(12) As Long
ti(0) = parcelPref.GetInteger(kAreaUnitLabelsOn)
ti(1) = parcelPref.GetInteger(kAreaUnitPrecision)
ti(2) = parcelPref.GetInteger(kAutoLabelPlacement)

...snip

parcelPref.SetInteger kAreaUnitLabelsOn, 0
parcelPref.SetInteger kAreaUnitPrecision, 1
parcelPref.SetInteger kAutoLabelPlacement, 1

...snip

parcelPref.SetInteger kAreaUnitLabelsOn, ti(0)
parcelPref.SetInteger kAreaUnitPrecision, ti(1)
parcelPref.SetInteger kAutoLabelPlacement, ti(2)

etc...

Thanks for everyone's support (or patience...)

Regards,
Rad

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report