hatch 2 region

Discussion in 'AutoCAD' started by fora, Dec 22, 2003.

  1. fora

    fora Guest

    I want to create a REGION from a hatch whose entities that created it has
    been erased. Is there already a vba script that does this?



    If there is no.

    I tried to make my own. When I tested the script it worked fine as far as
    the hatch was associative, and the lines (or other entities) where present.
    When I erased the lines (or made the hatch non-associative), the region
    could not be created. any ideas?



    Thank you in advanced





    Sub reg()



    Dim fcode(0) As Integer

    Dim fvalue(0) As Variant

    fcode(0) = 0

    fvalue(0) = "Hatch"

    Dim hatchobj As AcadHatch

    Dim loopObjs As Variant

    Dim ln As AcadLine



    Dim sset_all As AcadSelectionSet



    On Error Resume Next





    Set sset_all = ThisDrawing.SelectionSets.Add("AC_sset_all")



    sset_all.SelectOnScreen fcode, fvalue





    Set hatchobj = sset_all.Item(0)





    For c1 = 0 To hatchobj.NumberOfLoops - 1





    hatchobj.GetLoopAt 0, loopObjs

    Set region = ThisDrawing.ModelSpace.AddRegion(loopObjs)



    Next



    ThisDrawing.SelectionSets.Item("AC_sset_all").Delete



    End Sub
     
    fora, Dec 22, 2003
    #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.