.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get current LayerKeyStyle setting with VB.NET

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ejdavis
650 Views, 2 Replies

Get current LayerKeyStyle setting with VB.NET

I'm converting my VBA over to VB.net and I'm getting stuck on this procedure.

 

Function CurrentLayerKeyStyle() As String
'returns the current Layer Key Style name
    On Error Resume Next
    Dim objDoc As AecArchBaseDocument
    Dim objLKS As AecLayerKeyStyle
    Set objDoc = AecArchBaseApplication.ActiveDocument
    Set objLKS = objDoc.LayerKeyStyles(objDoc.Preferences.LayerStandard)
    CurrentLayerKeyStyle = objLKS.Name
End Function

 trying to use Autodesk.Aec.ApplicationServices.DrawingSetupVariables.LayerStandard, but I'm not even sure if I'm barking up the right tree.

2 REPLIES 2
Message 2 of 3
Jeffrey_H
in reply to: ejdavis

This will write the current layer standard in the commad line hope it helps
Imports Autodesk.AutoCAD.ApplicationServices.Application
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Imports AecAppServies = Autodesk.Aec.ApplicationServices
Public Class Examples
    <CommandMethod("CurrentLayerKeyStyle")> _
  Public Sub CurrentLayerKeyStyle()
        Dim db As Database = HostApplicationServices.WorkingDatabase
        Dim ed As Editor = DocumentManager.MdiActiveDocument.Editor
        Using tr As Transaction = db.TransactionManager.StartTransaction
            Dim objID As ObjectId = AecAppServies.DrawingSetupVariables.GetInstance(db, False)
            Dim dsv As AecAppServies.DrawingSetupVariables = tr.GetObject(objID, OpenMode.ForRead)
            Dim ls As String = dsv.LayerStandard
            ed.WriteMessage(vbCrLf & ls)
        End Using
    End Sub

 

You can also find your answers @ TheSwamp
Message 3 of 3
ejdavis
in reply to: ejdavis

Thanks.  That was what I needed.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost