Exploding Wipeouts

Discussion in 'AutoCAD' started by Jim, Dec 26, 2006.

  1. Jim

    Jim Guest

    Hi,

    'Exploding Wipeouts' is fun to say, but that's not the only reason for
    this post. In a program I am writing, I want to explode a 'wipeout'
    entity that exists in model space. Then I want to collect up the
    resulting individual lines and turn them into a lightweightpolyline
    object and eventually into an autocad 'region'. Can't seem to explode
    the wipeout though. I tried doing it in LISP instead but wanted to try
    to keep the project in VBA as much as possible. Below is my code. Is
    there a way to make it work in VBA?

    Sub Wipe2Region()
    'This routine is to convert a polygon as defined by a Wipeout into a
    region

    ' ss1 is the collection of all wipeout objects on the zone layer
    Dim ss1 As AcadSelectionSet
    Set ss1 = ssAdd("ssName")

    Dim codes(1) As Integer
    Dim values(1)

    codes(0) = 0: values(0) = "wipeout"
    codes(1) = 8: values(1) = "zones"
    ss1.Select acSelectionSetAll, , , codes, values


    Dim Pt As Variant

    PICKWIPEOUT:
    On Error Resume Next
    Dim wipeObj As AcadEntity
    ThisDrawing.Utility.GetEntity wipeObj, Pt, "Select a wipeout
    object"
    If Err Then GoTo BAIL
    ' RemoveItems method requires an array for its argument, so we
    ' must encapsulate tubeSeed in an array
    Dim thisWipeout(0) As AcadEntity
    Set thisWipeout(0) = wipeObj

    On Error Resume Next
    ' wipeout item selected by user must exist in ss1 or it is invalid
    ss1.RemoveItems thisWipeout
    If Err Then
    MsgBox "That Entity is not a valid wipeout object", , "Wipeout
    Conversion"
    GoTo PICKWIPEOUT
    End If

    'Determine how many mspace entities to start with
    Dim stEntCnt As Integer
    stEntCnt = ThisDrawing.ModelSpace.Count

    'Now explode the selected wipeout
    wipeObj.Explode

    MsgBox "The wipeout had " & ThisDrawing.ModelSpace.Count - stEntCnt
    + 1 & "vertices"

    BAIL:
    End Sub
     
    Jim, Dec 26, 2006
    #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.