Hatch problem

Hatch problem

Anonymous
Not applicable
208 Views
1 Reply
Message 1 of 2

Hatch problem

Anonymous
Not applicable
I got the problem from using hatch method. It's indicated "Invalid input". Here is the source code
Dim objHatch As AcadHatch
Dim varOuter() As AcadEntity
ReDim varOuter(2)
Set varOuter(0) = objLine1
Set varOuter(1) = objCircleF
Set varOuter(2) = objSectionF ' Acadregion
' create the hatch object
Set objHatch = ThisDrawing.ModelSpace.AddHatch(acHatchPatternTypePreDefined, _
"ANSI37", True)
' append boundaries to the hatch
objHatch.AppendOuterLoop varOuter
' evaluate and display hatched boundaries
objHatch.Evaluate
objHatch.Update
0 Likes
209 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
I have been using/working on this method intensivly for the past few months. Here are my comments:

Sometimes, a valid hatch boundary will simply not work. For one, VBA discards the GAPTOL thingy, meaning that it needs a perfect boundary to work (unlike the Hatch command in AutoCAD).

Also, Arcs and Elliptical Arcs are the hardest to hatch with VBA. if you can, change the arcs in your drawing to equivalent polylines, at it may help make the procedure work.

You can also play around with the coordinates of the boundaries to fix any irregularities in them.

But as I mentionned, sometimes, they just dont work.

What I attempted to fix all these dumb problems is this :
I extract the Hacth section in the DXF file of the drawing, and I created a method to Read all these DXF codes and recreate the boundary objects around the hatch. Then I recreate the same hatch in VBA using the created (and assurly valid) boundaries, and it actualy fails some of the times!!!! Just to show you not to spen time I have waisted to make this work, since it just doesn't. But I did try........ real hard!
0 Likes