ObjectDBX: ActiveLayout equivalent

Discussion in 'AutoCAD' started by spanqy, Aug 26, 2004.

  1. spanqy

    spanqy Guest

    I'm trying to count the number of entites in each Paper Space layout of a drawing using ObjectDBX in 2004. With non-DBX code, I could set the ThisDrawing.ActiveLayout value then call a For Each loop on ThisDrawing.Paperspace. That way each entity count, via the PaperSpace object, reflects the entities on each individual layout. Here's whatt I do when NOT using ObjectDBX:

    Dim iEntCount As Integer
    Dim objLay As AcadLayout, objEnt As AcadEntity

    iEntCount = 0

    For Each objLay In ThisDrawing.Layouts
    iEntCount = 0
    If objLay.Name <> "Model" Then
    'Trouble w/ DBX HERE
    ' How do you set the Active Layout...
    ThisDrawing.ActiveLayout = ThisDrawing.Layouts(i)
    '''So that ThisDrawing.PaperSpace refers to each individual layout
    For Each objEnt In ThisDrawing.PaperSpace
    iEntCount = iEntCount + 1
    Next
    Debug.Print objLay.Name & " - " & iEntCount
    End If
    Next
     
    spanqy, Aug 26, 2004
    #1
  2. spanqy

    Jeff Mishler Guest

    Here's how I'd do it.

    Dim dbxLayout As AcadLayout
    Dim dbxDoc As AcadDocument
    Dim eEnts() As Long
    Dim I As Integer

    ReDim eEnts(0 To 1, 0 To dbxDoc.Layouts.Count - 2)
    For Each dbxLayout In dbxDoc
    If dbxLayout.Name <> "Model" Then
    eEnts(0, I) = dbxLayout.Name
    eEnts(1, I) = dbxLayout.Block.Count
    I = 1 + I
    Next

    Good Luck,
    --
    Jeff
    check out www.cadvault.com
    drawing using ObjectDBX in 2004. With non-DBX code, I could set the
    ThisDrawing.ActiveLayout value then call a For Each loop on
    ThisDrawing.Paperspace. That way each entity count, via the PaperSpace
    object, reflects the entities on each individual layout. Here's whatt I do
    when NOT using ObjectDBX:
     
    Jeff Mishler, Aug 26, 2004
    #2
  3. spanqy

    spanqy Guest

    Thanks Jeff! That was just what I needed.
     
    spanqy, Aug 26, 2004
    #3
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.