Associative Hatch

Discussion in 'AutoCAD' started by tacito, Jul 23, 2003.

  1. tacito

    tacito Guest

    I am creting a circle element and an associative hatch.
    However when this circle is moved by the VBA app, the associative hatch doesn´t move with it.
    The associative attribute is set to TRUE and I run a REGEN and REDRAW command in the end of command.

    What is necessary to do for all the associative hatches follow their element transformations ?

    Obs:If I open the PROPERTIES WINDOW for this hatch element and simply close this windows, the hatch begins to move with the element - I can´t understand this !!!

    thanks,
    Tacito M Fieker
     
    tacito, Jul 23, 2003
    #1
  2. Something *is* odd. The Regen method doesn't update the display, but a
    command-pipeline Regen *does*.

    Public Sub Test()
    Dim pt1(0 To 2) As Double
    pt1(0) = 0#: pt1(1) = 0#: pt1(2) = 0#

    Dim pt2(0 To 2) As Double
    pt2(0) = 2#: pt2(1) = 2#: pt2(2) = 0#

    With ThisDrawing.ModelSpace
    Dim myCircle As AcadCircle
    Set myCircle = .AddCircle(pt1, 1#)

    Dim myLoops(0) As AcadEntity
    Set myLoops(0) = myCircle

    Dim myHatch As AcadHatch
    Set myHatch = .AddHatch(acHatchPatternTypePreDefined, "Solid", True,
    acHatchObject)
    End With

    myHatch.AppendOuterLoop myLoops
    myHatch.Evaluate
    myHatch.Update

    myCircle.Move pt1, pt2
    myCircle.Update
    SendCommand "Regen "

    End Sub


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | I am creting a circle element and an associative hatch.
    | However when this circle is moved by the VBA app, the associative hatch
    doesn´t move with it.
    | The associative attribute is set to TRUE and I run a REGEN and REDRAW
    command in the end of command.
    | What is necessary to do for all the associative hatches follow their
    element transformations ?
    |
    | Obs:If I open the PROPERTIES WINDOW for this hatch element and simply
    close this windows, the hatch begins to move with the element - I can´t
    understand this !!!
    |
    | thanks,
    | Tacito M Fieker
    |
    |
     
    R. Robert Bell, Jul 23, 2003
    #2
  3. Many folks fall into the trap of assuming that code
    executed directly from the IDE behaves the same
    as code executed in response to a user-action.

    Unfortunately, that's not always the case.

    If you're using VBA, then try running your code from
    the IDE and from the command line (using -VBARUN) and
    see if it behaves the same.

    --
    http://www.acadxtabs.com


    with the element - I can´t understand this !!!
     
    Tony Tanzillo, Jul 24, 2003
    #3
  4. tacito

    tacito Guest

    Robert, the given code doesn´t work well for me. When the circle is moved, the hatch isn´t. However if you OPEN the properties window in ACAD, only click in the Associative (YES), close this window, and move the circle; the problem disappear. If you exit ACAD and start again the problem return.
       My application is in a DLL app and it is called by a VBA Form. I use "sendcommand REGEN " and doesn´t work. I tryed with ACAD 2002 and 2004... I don´t know how to solve this.
      Thanks, Tacito.
     
    tacito, Jul 24, 2003
    #4
  5. Tony, you are correct. If I comment out the regen, and run the test
    procedure with vbarun, the hatch does update to the correct position.


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    "Tony Tanzillo" <tony.tanzillo at caddzone dot com> wrote in message
    | Many folks fall into the trap of assuming that code
    | executed directly from the IDE behaves the same
    | as code executed in response to a user-action.
    |
    | Unfortunately, that's not always the case.
    |
    | If you're using VBA, then try running your code from
    | the IDE and from the command line (using -VBARUN) and
    | see if it behaves the same.
    |
    | --
    | http://www.acadxtabs.com
    |
    |
    | > I am creting a circle element and an associative hatch.
    | > However when this circle is moved by the VBA app, the associative hatch
    doesn´t move with it.
    | > The associative attribute is set to TRUE and I run a REGEN and REDRAW
    command in the end of command.
    | > What is necessary to do for all the associative hatches follow their
    element transformations ?
    | >
    | > Obs:If I open the PROPERTIES WINDOW for this hatch element and simply
    close this windows, the hatch begins to move
    | with the element - I can´t understand this !!!
    | >
    | > thanks,
    | > Tacito M Fieker
    | >
    | >
    |
    |
     
    R. Robert Bell, Jul 24, 2003
    #5
  6. I tested under TuFer and it worked. As Tony brought out, if you comment out
    the SendCommand, and run the test procedure using -vbarun, it works as
    expected.

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Robert, the given code doesn´t work well for me. When the circle is moved,
    the hatch isn´t. However if you OPEN the properties window in ACAD, only
    click in the Associative (YES), close this window, and move the circle; the
    problem disappear. If you exit ACAD and start again the problem return.
    | My application is in a DLL app and it is called by a VBA Form. I use
    "sendcommand REGEN " and doesn´t work. I tryed with ACAD 2002 and 2004... I
    don´t know how to solve this.
    | Thanks, Tacito.
     
    R. Robert Bell, Jul 24, 2003
    #6
  7. tacito

    tacito Guest

    Tony, you are right. The code above run from IDE doesn´t move the hatch. When it is run from "-vbarun " the hatch is moved together. But my app was built as a DLL, called by a VBA form and in this case it doesn´t move the hatch. The only way to move is what I mentioned above. In ACAD, selecet the hatch, open the properties windows, click in the associative (YES), close this window and move the circle manually. After doing this my app works fine. After exits ACAD the problem return and it is necessary repeat this procedure.
     
    tacito, Jul 24, 2003
    #7
  8. tacito

    tacito Guest

    Robert, when I try to get the attachment, the page return an error: "No attachments". Could you send me by email ? Thanks.
     
    tacito, Jul 24, 2003
    #8
  9. Sending... (I forgot you were on the web-side.)

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Robert, when I try to get the attachment, the page return an error: "No
    attachments". Could you send me by email ? Thanks.
     
    R. Robert Bell, Jul 24, 2003
    #9
  10. tacito

    tacito Guest

    After testing many alternatives, the only condition the problem occurs is when the ACFOCUSCTRL.DLL is used in a form. In this case the hatch doesn´t move with the associative element.
    If you don´t use this component and run the app using -VBARUN, the associative hatch moves together.
     
    tacito, Jul 28, 2003
    #10
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.