Consulting

Results 1 to 3 of 3

Thread: Solved: AUTOCAD - DrawOrder for hatches

  1. #1
    VBAX Mentor ALe's Avatar
    Joined
    Aug 2005
    Location
    Milan
    Posts
    383
    Location

    Solved: AUTOCAD - DrawOrder for hatches

    Hi everybody.

    Is there any way to set via VBA the draworder of a created hatch?

    I have this piece of code that creates a hatch associated to a closed polyline.
    The code works and a hatch is created. The problem is that the hatch covers all other objects...
    I'd like to see them and have the hatch as a background.

    [VBA]
    Sub TestAddHatch(MyPoly As AcadLWPolyline)
    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
    Dim outerloop(0 To 0) As AcadEntity
    'Dim innerloop(0 To 0) As AcadEntity

    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.17")
    ' Define the hatch
    patternName = "SOLID"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch _
    (PatternType, patternName, bAssociativity)

    ' Create the outer boundary for the hatch
    Set outerloop(0) = MyPoly
    hatchObj.AppendOuterLoop (outerloop)

    Call color.SetRGB(255, 255, 205) ' Basso Rischio -> GIALLO
    hatchObj.TrueColor = color

    hatchObj.Evaluate

    ThisDrawing.Regen True
    End Sub
    [/VBA]
    ALe
    Help indigent families: www.bancomadreteresa.org

  2. #2
    VBAX Mentor ALe's Avatar
    Joined
    Aug 2005
    Location
    Milan
    Posts
    383
    Location
    found solution.

    in case you're interested:
    http://www.theswamp.org/index.php?topic=8724.0

    thank you
    ALe
    Help indigent families: www.bancomadreteresa.org

  3. #3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •