Author Topic: Layer Key Overrides - Not a ?, just sharing.  (Read 1953 times)

0 Members and 1 Guest are viewing this topic.

BAshworth

  • Guest
Layer Key Overrides - Not a ?, just sharing.
« on: June 21, 2006, 06:53:08 PM »
Thought that while I was here, might as well share a little sumfin sumfin I had to build for a program I'm working on.

Took a hell of a long time to find any info on this that was useable, so thought it might be useful for someone else too.

So, ya want to set a layer key override in ADT?  (If you have to ask what a layer key override is, you don't want to know, trust me.)

Here's a little sub I wrote for setting it.

Code: [Select]
Sub SetLayerKeyOverride(LayerStateToUse As String)

    Dim app As New AecBaseApplication
    Dim doc As AecBaseDocument
    Dim dbPref As AecBaseDatabasePreferences
    Dim cLayerKeyStyles As AecLayerKeyStyles
    Dim layerKeyStyle As AecLayerKeyStyle
   
    app.Init ThisDrawing.Application
    Set doc = app.ActiveDocument
   
    Set cLayerKeyStyles = doc.LayerKeyStyles

    Set dbPref = doc.Preferences
   
    Set layerKeyStyle = cLayerKeyStyles.Item(dbPref.LayerStandard)
   
    layerKeyStyle.OverrideSettings.Item(0).Value = LayerStateToUse
    layerKeyStyle.OverrideSettings.Item(5).Value = " "
   
End Sub

Then just call it within another routine by using

Code: [Select]
Call SetLayerKeyOverride("Name of layer key override you want")

Like I said, just a little helper I was unable to find anything on in my own searching.
You need to add in references to the AEC Base 4.0 Application Library, and the AEC Base 4.0 Object Library to your project for this to work.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: Layer Key Overrides - Not a ?, just sharing.
« Reply #1 on: December 12, 2006, 11:59:27 AM »
Oh boy! Jackpot!! Thank you CSO! (A little late with the Thanx but i now know what a layer key is and your right, i didnt want to know.)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Guest

  • Guest
Re: Layer Key Overrides - Not a ?, just sharing.
« Reply #2 on: December 12, 2006, 12:13:25 PM »
Hmmmm.... I just might have a use for this.  *bookmarked*