Results 1 to 4 of 4

Thread: ACA 2013 LayerKeyStyle

  1. #1
    Active Member
    Join Date
    2004-08
    Posts
    50
    Login to Give a bone
    0

    Default ACA 2013 LayerKeyStyle

    I am getting an "Active X can't create Object" error with this code. It is VBA with ACA2013. I have the enabler installed. I am building a routine that will ultimately be in VB.net but I can't get off the starting block. I must be missing something.
    References:
    AECXUiArchBase
    AECXArchBase
    AECXUiBase
    AECXBase
    AutoCad2013 Type Library
    Visual Basic for Applications
    OLE automation

    My code (with the line with the error marked.:

    Code:
    Public Sub CreateLayers()
    Dim oDoc As AecArchBaseDocument
    Dim o_dbPref As AecArchBaseDatabasePreferences
    Dim cLayerKeyStyles As AecLayerKeyStyles
    Dim oLayerKeyStyle As AecLayerKeyStyle
    Dim cLayerKeys As AecLayerKeys
    Dim oLayerKey As AecLayerKey
    Dim oLayer As AcadLayer
    'Activate the AEC Document using the AecArchBaseApplication
    Set oDoc = AecArchBaseApplication.ActiveDocument '------>>>ActiveX Can't create Object<<<<<<----------
    'Activate the AEC Preferences Collection
    Set oPref = oDoc.Preferences
    'Activate the LayerKeyStyles collection
    Set cLayerKeyStyles = oDoc.LayerKeyStyles
    'Sets the layer key style to the current layer standard
    Set oLayerKeyStyle = cLayerKeyStyles.Item(oPref.LayerStandard)
    'Message for verification
    MsgBox "The current Layer Key Style is: " & o_dbPref.LayerStandard, _
    vbInformation, "Current Layer Key Style"
    'Activate the Keys collection of the current layer standard
    Set cLayerKeys = oLayerKeyStyle.Keys
    'Message for varification
    MsgBox "The current number of layer keys is: " & o_cLayerKeys.Count, _
    vbInformation, "Current Layer Key Count"
    'Clean up all your declared objects
    Set oLayer = Nothing
    Set cLayerKeys = Nothing
    Set oLayerKeyStyle = Nothing
    Set cLayerKeyStyles = Nothing
    Set oPref = Nothing
    Set oDoc = Nothing
    End Sub
    Last edited by Ed Jobe; 2012-05-17 at 09:27 PM. Reason: Added code tags

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: ACA 2013 LayerKeyStyle

    You aren't creating the base app, so it can't create the ActiveDocument. I found the following code on the net.
    Code:
    Function getAecArchBaseApp() As AecArchBaseApplication
      Dim aecABApp As New AecArchBaseApplication
      aecABApp.Init Application
      Set getAecArchBaseApp = aecABApp
    End Function
    
    'Once the AecArchBaseApplication Object has been exposed, the Preferences
    'object must be also exposed
    'to allow the drawing properties to be modified and extracted.
    
    Function getAecArchDbPref() As AecArchBaseDatabasePreferences
      Set getAecArchDbPref = getAecArchBaseApp.ActiveDocument.Preferences
      End Function
    Also, if you are using a profile that doesn't actually load the dll's, you'll get the same error. For example, using the shortcut to run ACA as plain acad.
    C:> ED WORKING....


    LinkedIn

  3. #3
    Active Member
    Join Date
    2004-08
    Posts
    50
    Login to Give a bone
    0

    Default Re: ACA 2013 LayerKeyStyle

    Excellent theory. I thought it must have something to do with that pesky Init function. But it didn't work! Same error at the line "aecABApp.Init Application". i checked and my profile is "AutoCad Architecture US Imperial". Right out of the box. I CAN run a basic "Hello world" routine so it seems that VBA is functioning.

  4. #4
    Active Member
    Join Date
    2004-08
    Posts
    50
    Login to Give a bone
    0

    Default Re: ACA 2013 LayerKeyStyle

    I think i'm off the starting block. I found this:

    Code:
    VBA
    The VBA application object is not supported on 64-bit operating systems. As a result the following code fragments will not work, even though they do on 32-bit installations: 
    'Case 1: Built-in app object
    MsgBox AecArchBaseApplication.Caption 
    
    'Case 2: New app object
    Dim acaApp As New AecArchBaseApplication
    acaApp.Init ThisDrawing.Application
    MsgBox acaApp.Caption
    
    Instead, instantiate the application object as follows: 
    Dim acaApp As AecArchBaseApplication
    Set acaApp = ThisDrawing.Application.GetInterfaceObject("AecX.AecArchBaseApplication.5.7")
    acaApp.Init ThisDrawing.Application
    MsgBox acaApp.Caption
    So I think 64 bit is the issue.

Similar Threads

  1. Exportar Revit 2012-2013 a 3ds Max Design 2013...
    By magdagarciavinuesa in forum Revit Architecture - General
    Replies: 2
    Last Post: 2015-02-04, 10:34 PM
  2. 2013 Objects From Revit MEP 2013 Missing in Navis Manage 2013
    By MetalliCAD in forum NavisWorks - General
    Replies: 5
    Last Post: 2013-03-05, 08:52 PM
  3. Revit 2013 Detail Views Showing up in Navisworks 2013
    By tfullerpipes in forum NavisWorks - General
    Replies: 3
    Last Post: 2013-01-30, 07:37 AM
  4. 2013 Revit 2013 to navisworks Manage 2013
    By markclarenzze in forum NavisWorks - General
    Replies: 9
    Last Post: 2013-01-14, 10:02 AM
  5. Revit DB Link 2013 and Access 2013?
    By KELLI in forum Revit Architecture - General
    Replies: 0
    Last Post: 2012-11-20, 04:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •