Excuse my ignorance here in VBA but his code aint working in ADT3 at home
I have both aEc object 3.0 libraries checked
it says Object required runtime error 424 at..
Set doc = AecArchBaseApplication.ActiveDocument
, I am in ADT3 right now (at home)
and what is the difference between this
Dim aecDb As New AecArchBaseDatabase
' Dim doc As AecArchBaseDocument
Set dbPref = doc.Preferences
Set dbPref = aecDb.Preferences
cause if I do it the other way , i.e. aecDb way it says IAecLayerKeyStyles
failed.
I think I first need to really understand the Dim As New xxxx
dim doc as etc..
as I right now have not clue what they mean and why etc...
btw my solution is posted below (in Lisp of course)
Public Sub Dump_Keys()
Dim aecDb As New AecArchBaseDatabase
' Dim doc As AecArchBaseDocument
aecDb.Init ThisDrawing.Database
Dim dbPref As AecArchBaseDatabasePreferences
Dim cLayerKeyStyles As AecLayerKeyStyles
Dim layerKeyStyle As AecLayerKeyStyle
Dim cLayerKeys As AecLayerKeys
Dim layerKey As AecLayerKey
Set doc = AecArchBaseApplication.ActiveDocument
Set cLayerKeyStyles = doc.LayerKeyStyles
Set dbPref = aecDb.Preferences
(setq currentstyle (getaecvar 9))
(if (eq (getaecvar 9) "
");; if the lyrstd is Default then find
the info in the reg...
(progn
(if (or
;;imperial
(eq (getaecvar 71) 30) ;Feet
(eq (getaecvar 71) 31) ;Inches
)
(setq currentstyle (vl-registry-read
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Autodesk\\ObjectDBX\\R15.0\\AEC\\3.0\\AecBase
\\Defaults\\DwgSetup\\Imperial" "LayerStandard"))
)
);progn
;otherwise it is a metric drawing
(setq currentstyle (vl-registry-read
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Autodesk\\ObjectDBX\\R15.0\\AEC\\3.0\\AecBase
\\Defaults\\DwgSetup\\Metric" "LayerStandard"))
)
"Peter Funk - Autodesk, Inc" wrote in message
news:76DE55CDAE9F99C9076528C4A1B37A4D@in.WebX.maYIadrTaRb...
> Nauman,
>
> I'm thinking that you are getting that "default" because the layer
standard
> isn't set? Here is the code from the help file that will list all the
layers
> to the "Immediate" window inside of the IDE. (FYI you should always have
> that turn on, as well as "Locals") Also, under "Tools" -> "Options" I feel
> that the default checks are in the wrong place for the "Editor" I have
mine
> set to NO Auto Syntax Check (avoids the annoying dialog box) and YES to
> "Require Variable Declaration". This places "Option Explicit" at the top
of
> all your code, and forces you to "Dim" your variables before you use them.
> Not only is this good programming, but it also allows VBA to provide you
> with Intellisense as your go.
>
> Cheers,
>
> Peter Funk
> API Product Manager
> Building Industry Division
> Autodesk, Inc.
>
>
> Public Sub Dump_Keys
> Dim doc As AecArchBaseDocument
> Dim dbPref As AecArchBaseDatabasePreferences
> Dim cLayerKeyStyles As AecLayerKeyStyles
> Dim layerKeyStyle As AecLayerKeyStyle
> Dim cLayerKeys As AecLayerKeys
> Dim layerKey As AecLayerKey
>
> Set doc = AecArchBaseApplication.ActiveDocument
> Set cLayerKeyStyles = doc.LayerKeyStyles
> Set dbPref = doc.Preferences
> ' Sets the layer key style to the current layer standard
> Set layerKeyStyle = cLayerKeyStyles.Item(dbPref.LayerStandard)
> Set cLayerKeys = layerKeyStyle.Keys
>
> For Each layerKey In cLayerKeys
> Debug.Print layerKey.Name
> Debug.Print " Color - " & layerKey.Color
> Debug.Print " Layer - " & layerKey.Layer
> Debug.Print " LineType - " & layerKey.Linetype
> Debug.Print " Lineweight - " & layerKey.Lineweight
> Debug.Print " Plotstyle - " & layerKey.PlotStyleName
> Debug.Print " Plottable - " & layerKey.Plottable
> Debug.Print " Removable - " & layerKey.Removeable
> Next
> End Sub
>
>