AVAX-software.com Forums: DoAvaxAction - AVAX-software.com Forums

Jump to content

Page 1 of 1

DoAvaxAction Get new handles

#1 User is offline   Rplp4 Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 21-May 08

Posted 25 September 2009 - 09:51 PM

I am using DoAvaxAction to Mirror a set of objects. How do I get the handles of the mirrored objects? I expected OutHandles to have the new handles, but it is OutHandles is always equal to Nothing.

#2 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 328
  • Joined: 21-March 05
  • Gender:Male

Posted 28 September 2009 - 08:50 AM

You can use the following VB6 code:
Private Sub Form_Load()
    Dim vIn As Variant
    Dim myAction As AvaxCommand
    Dim fNewHandles As Boolean
    Dim InHandles() As Long
    Dim OutHandles() As Long
    Dim vOut As Variant
    Dim errCode As Long
    Dim Answer As Boolean
    Dim myMirror As AvaxMirror_t
    Dim LastHandle As Long
    Dim lCount As Long
    ReDim InHandles(1) As Long
    
    Call cAvax1.StartAvax
    
    InHandles(1) = cAvax1.Add_Line(0, 10, 0, 5, 10, 0)
    
    myAction = Mirror_c
    myMirror.mirX1 = 0
    myMirror.mirY1 = 0
    myMirror.mirX2 = 10
    myMirror.mirY2 = 10
    vIn = myMirror
    LastHandle = cAvax1.LastHandle
    Answer = cAvax1.DoAvaxAction(InHandles, vIn, myAction, fNewHandles, OutHandles, vOut, errCode)
    If Answer = True Then
       If fNewHandles = False Then
          If LastHandle < cAvax1.LastHandle Then
             ReDim OutHandles(cAvax1.LastHandle - LastHandle) As Long
             For lCount = 1 To cAvax1.LastHandle - LastHandle
                 OutHandles(lCount) = LastHandle + lCount
                 SwapLong OutHandles(lCount), InHandles(lCount)
             Next lCount
          End If
       End If
    End If
End Sub

Private Sub SwapLong(a As Long, B As Long)
    Dim c As Long
    c = B
    B = a
    a = c
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call cAvax1.EndAvax
End Sub

Athanasios Gardos
Avax-Software.com

#3 User is offline   Rplp4 Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 21-May 08

Posted 29 September 2009 - 12:29 PM

Thank you this will work but. I am using .net 2008 and
Answer = cAvax1.DoAvaxAction(InHandles, vIn, myAction, fNewHandles, OutHandles, vOut, errCode)

Always returns false.

#4 User is offline   elias Icon

  • Newbie
  • Icon
  • Group: Support
  • Posts: 18
  • Joined: 24-October 08
  • Gender:Male

Posted 01 October 2009 - 08:42 AM

This is the .net 2008 code example. We have tried it and it works fine.

    Dim InHandles(2) As Integer

    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Dim vIn As Object
        Dim myAction As Avax.AvaxCommand
        Dim fNewHandles As Boolean
        Dim InHandles() As Integer
        Dim OutHandles() As Integer
        Dim vOut As Object
        Dim errCode As Integer
        Dim Answer As Boolean
        Dim myMirror As Avax.AvaxMirror_t
        Dim LastHandle As Integer
        Dim lCount As Integer
        ReDim InHandles(1)

        Call CAvax1.StartAvax()

        InHandles(1) = CAvax1.Add_Line(0, 10, 0, 5, 10, 0)

        myAction = Avax.AvaxCommand.Mirror_c
        myMirror.mirX1 = 0
        myMirror.mirY1 = 0
        myMirror.mirX2 = 10
        myMirror.mirY2 = 10
        vIn = myMirror
        LastHandle = CAvax1.LastHandle
        Answer = CAvax1.DoAvaxAction(InHandles, vIn, myAction, fNewHandles, OutHandles, vOut, errCode)
        If Answer = True Then
            If fNewHandles = False Then
                If LastHandle < CAvax1.LastHandle Then
                    ReDim OutHandles(CAvax1.LastHandle - LastHandle)
                    For lCount = 1 To CAvax1.LastHandle - LastHandle
                        OutHandles(lCount) = LastHandle + lCount
                        SwapLong(OutHandles(lCount), InHandles(lCount))
                    Next lCount
                End If
            End If
        End If

    End Sub

    Private Sub SwapLong(ByRef a As Integer, ByRef B As Integer)
        Dim c As Integer
        c = B
        B = a
        a = c
    End Sub


    Private Sub Form1_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        CAvax1.EndAvax()
    End Sub


Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users