count all dimension object on a given layer

Discussion in 'AutoCAD' started by me, Apr 1, 2005.

  1. me

    me Guest

    Hi, is there somebody out there who can tell me how I can count the number of
    dimension objects on a specific layer.
    I'm using the following SW, AutoCAD 14, visual basic 6.0. the idea is that I
    create an executable which launches AutoCAD, counts the objects on the
    specific layer.
    I do have the following (among other).

    Set sset = acadDoc.SelectionSets.Add("NEWSS")
    'set reference to selection set
    'sset.Select acSelectionSetAll
    'select the whole drawing
    entityCount = sset.Count

    but entityCount always returns null

    Thanks in advance.
     
    me, Apr 1, 2005
    #1
  2. me

    R.K. McSwain Guest

    This may help:

    Public Function GetDimCount(layer As String) As Integer

    Dim fType(1) As Integer
    Dim fData(1) As Variant
    Dim ss As AcadSelectionSet

    Set ss = ThisDrawing.PickfirstSelectionSet
    fType(0) = 0
    fData(0) = "DIMENSION"
    fType(1) = 8
    fData(1) = layer
    ss.Select acSelectionSetAll, , , fType, fData

    GetDimCount = ss.Count
    End Function
     
    R.K. McSwain, Apr 2, 2005
    #2
  3. me

    me Guest

    Hi, I have tried the given sample (see below), but it seems that I'm missing
    something or so. I get a compile error which says "User-defined type not
    defined" and compiling stops at "Dim ss As AcadSelectionSet".
    To me it seems that there are some specific AutoCAD function not available.
    Is it required to load them, and if required, how can I do so, can this
    function beeing used from VB at all.?

    Just as a reminder, I want to create add the functionality to a standalone VB
    (6) application, which starts AutoCAD (14), and retrieves some information.

    Thanks in advance.
     
    me, Apr 2, 2005
    #3
  4. me

    me Guest

    I was expection that the concept is more or less the same, but unfortunatelly
    I wasn't able to get it to work yet, I know it is because I'm new to the whole
    AutoCAD - VB stuff :(.
    Do you have or know a location where to find some good information regarding
    AutoCAD - VB programming, or even a certain book.

    Is the ThisDrawing variable some kind of a special one? Currently I'm creating
    a connetion to the drawing as following:

    Set acadApp = GetObject(, "AutoCAD.Application")
    Set acadDoc = acadApp.ActiveDocument

    Thanks in advance.
    Ronnie
     
    me, Apr 4, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.