Edit a Wall Object (AecDbWall) in AutoCAD using VBA?

Discussion in 'AutoCAD' started by Jim Cheng, Feb 10, 2004.

  1. Jim Cheng

    Jim Cheng Guest

    I am using AutoCAD Architectural Desktop 3.3, and I am wondering how
    to edit wall objects in CAD drawings through VBA. The wall object is
    created in the Architectural Desktop through the menu item
    "Design/Walls/Add Wall..." .

    Currently, I use the following subroutine to iterate all wall objects
    in the CAD drawing. However, it seems to me that I could not change
    the height of those wall objects.

    Could anyone help me in this matter?

    Thanks!
    Jim


    Sub Edit_Walls()
    Dim count As Integer
    count = ThisDrawing.ModelSpace.count

    ReDim newObjs(count) As Object

    Dim wallObj As Acad3DSolid

    Dim index As Integer
    For index = 0 To count - 1
    Set newObjs(index) = ThisDrawing.ModelSpace.Item(index)
    Debug.Print newObjs(index).ObjectID,
    newObjs(index).ObjectName, newObjs(index).Handle
    If StrComp(newObjs(index).ObjectName, "AecDbWall") = 0 Then
    Debug.Print "This is a wall..."

    newObjs(index).Color = RED
    '' OK but the actual color is not changed

    ''newObjs(index).Height = 15
    '' error here since Height is not supported

    newObjs(index).Update
    End If

    Next



    End Sub
     
    Jim Cheng, Feb 10, 2004
    #1
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.