3DSolid data in vba atd3.3

Discussion in 'AutoCAD' started by Paul Richardson, Jun 14, 2004.

  1. Hi all,
    Could someone Please tell me how to access data for a solid object in VBA.
    ie. length, width, height and such for a Box object.

    Thank You,

    Paul
     
    Paul Richardson, Jun 14, 2004
    #1
  2. Paul,
    I don't know if ADT installs any of the Mechanical libraries, or if you have
    Mechanical available, but it looks to me like functions in the libraries
    BRepAuto and GEAuto allow you to get information about a solid such as its
    faces and vertices. From the vertices you could calculate distances of LWH,
    assuming you only had vertices at the four corners.

    Look in Tools...References to see if you have these available.
    Unfortunately it seems like the documentation on these is lacking.

    Hope this gets you a start.

    James
     
    James Belshan, Jun 15, 2004
    #2
  3. Thanks James,

    I do have MDT and will check. Got a work around for now. I let you know it
    the MDT libraries work

    Paul
     
    Paul Richardson, Jun 15, 2004
    #3
  4. Paul Richardson

    wivory Guest

    I'd be pleased to hear your workaround Paul.

    Regards

    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Jun 16, 2004
    #4
  5. Wayne,

    Nothing to exciting. I create the boxes based on all
    AecWindows(doors,openings) in the drawing. PolarPoint, window.Length and
    window.Height gets the data I need from the window. When I create the box I
    also create a layer with the Window's handle appended to "win". Now I have a
    bunch of layers that end in "win" and start with the handle of the window
    who's data created each box. Low rent Pointer.

    boxLayer = entWindow.Handle + "win" 'create Layer for each box
    boxParentHandle = Left(boxLayer, Len(boxLayer) - 3)' extracts just the
    handle

    I will need something much more sophticated for the main program but this
    works for now. I have a lot of itterating throught solids to do 700+ in each
    drawing created. I will let you know when I find the solution.

    Paul
     
    Paul Richardson, Jun 16, 2004
    #5
  6. Paul Richardson

    Dave Guest

    Paul,

    Give me a call. My phone number is at the website below. I may be able to
    provide you a module to handle this.

    --
    David Wishengrad
    President & CTO
    MillLister, Inc.
    Software for BOM, measuring, stretching and controlling visibility of
    multiple 3D solids.
    Http://Construction3D.com
     
    Dave, Jun 16, 2004
    #6
  7. Paul Richardson

    cascadtx Guest

    I can probably offer you a 'you scratch my back, I'll scratch yours' situation if you're interested.
     
    cascadtx, Jun 21, 2004
    #7
  8. This will create a selection set of your windows(modify for all openings)
    and find their centroid. You need polarpoint to find the WCS

    Paul

    ''''''''''''START'''''''''''''''
    Dim entWinObj As Object
    Dim eWindow As AecWindow
    Dim aecAnch As AecAnchorOpeningBaseToWall
    Dim winCentPt(0 To 2) As Double'window centroid
    Dim winWCSPt As Variant'window start, with zero Z coordinate
    Dim ssWindow As AcadSelectionSet
    Dim wallGPCode(0) As Integer
    Dim wallGPData(0) As Variant
    Dim groupCode As Variant
    Dim dataCode As Variant

    For Each entWinObj In ssWindow 'selection set of windows
    Set eWindow = entWinObj
    Set aecAnch = entWindow.GetAnchor 'parent wall

    Select Case entWindow.Location(0)'distance from start or end of
    wall

    Case Is < 0 'distance from wallend
    winWCSPt =
    ThisDrawing.Utility.polarPoint(aecAnch.Reference.Location, _
    aecAnch.Reference.Rotation,
    aecAnch.Reference.length + _
    entWindow.Location(0))

    Case Is > 0'distance from wallstart
    winWCSPt =
    ThisDrawing.Utility.polarPoint(aecAnch.Reference.Location, _
    aecAnch.Reference.Rotation,
    entWindow.Location(0))

    End Select

    '''''This will find the WCS based centriod of the window in a 5.5" thick
    wall
    winCentPt(0) = ((winWCSPt(0) + (entWindow.width / 2)))
    winCentPt(1) = (winWCSPt(1) - 2.75) 'wall is 5.5" thick
    winCentPt(2) = (winWCSPt(2) + entWindow.SillHeight +
    (entWindow.height / 2))

    Next entWinObj
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''END

    situation if you're interested.
     
    Paul Richardson, Jun 22, 2004
    #8
  9. Sorry here is the code to create the selection set.
    pr
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''''
    Set ssWall = ThisDrawing.SelectionSets.Add("WALL")

    wallGPCode(0) = 0
    wallGPData(0) = "Aec_Window"

    groupCode = wallGPCode
    dataCode = wallGPData

    ssWall.Select acSelectionSetAll, , , groupCode, dataCode
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''
     
    Paul Richardson, Jun 22, 2004
    #9
  10. sorry again,

    "Dim eWindows As AecWindow" is referenced in my code in some places
    as "entWindows" change one or the other. ie "entWindow.location" should be
    "eWindows.Location".
     
    Paul Richardson, Jun 22, 2004
    #10
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.