Author Topic: Hatch  (Read 3635 times)

0 Members and 1 Guest are viewing this topic.

Humbertogo

  • Guest
Hatch
« on: March 16, 2006, 07:25:55 AM »
I use this function to create Arc.
I draw 3 arc an look fin but when i AppendOuterLoop the array  i get err.

Can someone tell my what i do wrong..?


Function addArc(center() As Double, dRadius As Double, _
                               startAngle As Double, _
                               endAngle As Double, _
                               Group As String, _
                               strlayer As String, _
                               Pattern As String, _
                               Color As Integer, Optional blnHatch As Boolean = False)

    Dim outerLoop() As AcadEntity
    Dim Objhatch As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
   
    ' Define the hatch
    patternName = "ANSI32"
    PatternType = 0
    bAssociativity = True
   

ReDim Preserve outerLoop(0 To Count) As AcadEntity
'Set objArc = ThisDrawing.ModelSpace.addArc(center, dRadius, startAngle, endAngle)
Set outerLoop(Count) = ThisDrawing.ModelSpace.addArc(center, dRadius, startAngle, endAngle)
   
     outerLoop(Count).Color = Color
     outerLoop(Count).layer = CheckLayer(strlayer)
     outerLoop(Count).Linetype = CheckLineType(Pattern)
     outerLoop(Count).Update
   
   
    If Group <> "" Then Call Add2Group(Group, outerLoop(Count))
   
   
    If blnHatch Then
        ' Create the associative Hatch object
    Set Objhatch = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)
   
   ' Append the outer loop to the hatch object, and display the hatch
         Objhatch.AppendOuterLoop (outerLoop)
         Objhatch.Evaluate
    End If
        Count = Count + 1

End Function

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Hatch
« Reply #1 on: March 16, 2006, 10:18:40 AM »
Try  Dim outerLoop() As AcadEntity at the modular level, like you have done with the count. It is getting redimmed and therefore empty each time.

Humbertogo

  • Guest
Re: Hatch
« Reply #2 on: March 16, 2006, 12:21:28 PM »
Still have the err

Bob Wahr

  • Guest
Re: Hatch
« Reply #3 on: March 16, 2006, 12:36:34 PM »
What error are you getting?

What line are you getting the error on?

Where/when/how is Count being Dimmed?

Is Count being assigned an initial value of 0 before this function is run?

Humbertogo

  • Guest
Re: Hatch
« Reply #4 on: March 16, 2006, 12:56:07 PM »
I get the err at line  Objhatch.AppendOuterLoop (outerLoop)
eer. run time err '-2145386493 (80200003)';
invalid input
The couter is working ok (Dim Count As Long)

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Hatch
« Reply #5 on: March 16, 2006, 01:21:05 PM »
The outer loop must be closed .
Objhatch.AppendOuterLoop (outerLoop) should be in the calling sub or a flag should be created when the outerloop is closed then do Objhatch.AppendOuterLoop (outerLoop)

dim isClosed as boolean
if isClosed then Objhatch.AppendOuterLoop (outerLoop)

Humbertogo

  • Guest
Re: Hatch
« Reply #6 on: March 16, 2006, 01:40:44 PM »
At the end of the last arc i close the loop (Optional blnHatch As Boolean = False)

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Hatch
« Reply #7 on: March 16, 2006, 04:02:20 PM »
Oh yeah.
With
Private Count As Integer
Private outerLoop() As AcadEntity
at the modular level and a valid hatch pattern the funtion works for me. acad2006