AVAX-software.com Forums: Select a previously drawn entity - AVAX-software.com Forums

Jump to content

Page 1 of 1

Select a previously drawn entity would like to select an entity previously drawn in a coded routine

#1 User is offline   timpittser Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 13
  • Joined: 27-August 08

Posted 04 August 2009 - 05:37 PM

I'm drawing lines on the screen based on coords. from a database, embedded in the code, I would like to automatically select those lines, maybe by their handles. I can't seem to find any examples to do this. Can you tell me the command to select an entity based on it's handle in VB6.
Thanks

#2 User is offline   Athanasios Gardos Icon

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

Posted 10 August 2009 - 08:20 AM

Here it is an example on how to select lines from their database id:
Private Sub Form_Load()
    Dim h() As Long, DatabaseID As String
    Dim Handles() As Long, DatabaseIDToSelect As String
    Call cAvax1.StartAvax
    ReDim h(2) As Long
    h(1) = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
    DatabaseID = "1"
    Call cAvax1.SetHandleKey(h(1), DatabaseID)
    h(2) = cAvax1.Add_Line(15, 0, 0, 15, 10, 0)
    DatabaseID = "2"
    Call cAvax1.SetHandleKey(h(2), DatabaseID)
    DatabaseIDToSelect = "1"
    If cAvax1.GetHandlesByKey(DatabaseIDToSelect, Handles()) <> 0 Then
       Call cAvax1.SelectItems(Handles())
    End If
End Sub

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

Athanasios Gardos
Avax-Software.com

#3 User is offline   timpittser Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 13
  • Joined: 27-August 08

Posted 30 August 2009 - 06:05 PM

Thank you very much, it was very helpful. But can i pick multiple lines with this function?

#4 User is offline   timpittser Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 13
  • Joined: 27-August 08

Posted 30 August 2009 - 07:01 PM

and can i set it to rotate these items with a predetermined base point. Thanks

#5 User is offline   hermes Icon

  • Advanced Member
  • Icon
  • Group: Support
  • Posts: 54
  • Joined: 11-June 09

Posted 31 August 2009 - 10:53 AM

Have a look at this example and if you have any question please let me know.

Private Sub Form_Load()
    Dim h() As Long, DatabaseID As String
    Dim Handles() As Long, DatabaseIDToSelect As String
    Call cAvax1.StartAvax
    ReDim h(2) As Long
    h(1) = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
    DatabaseID = "1"
    Call cAvax1.SetHandleKey(h(1), DatabaseID)
    h(2) = cAvax1.Add_Line(15, 0, 0, 15, 10, 0)
    DatabaseID = "2"
    Call cAvax1.SetHandleKey(h(2), DatabaseID)
End Sub

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

Private Sub Command1_Click()
    Dim lHandles() As Long
    Dim i As Long
    Dim RotX As Single, RotY As Single, Theta As Single
    
    RotX = 3.2
    RotY = 2
    Theta = 30
    
    If cAvax1.GetAllHandlesArr(lHandles()) <> 0 Then
        Call cAvax1.SelectItems(lHandles())
        Call cAvax1.RotateItems(lHandles(), RotX, RotY, Theta)
     End If
End Sub


#6 User is offline   timpittser Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 13
  • Joined: 27-August 08

Posted 02 September 2009 - 01:40 AM

View Posthermes, on 31 August 2009 - 05:53 AM, said:

Have a look at this example and if you have any question please let me know.

Private Sub Form_Load()
    Dim h() As Long, DatabaseID As String
    Dim Handles() As Long, DatabaseIDToSelect As String
    Call cAvax1.StartAvax
    ReDim h(2) As Long
    h(1) = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
    DatabaseID = "1"
    Call cAvax1.SetHandleKey(h(1), DatabaseID)
    h(2) = cAvax1.Add_Line(15, 0, 0, 15, 10, 0)
    DatabaseID = "2"
    Call cAvax1.SetHandleKey(h(2), DatabaseID)
End Sub

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

Private Sub Command1_Click()
    Dim lHandles() As Long
    Dim i As Long
    Dim RotX As Single, RotY As Single, Theta As Single
    
    RotX = 3.2
    RotY = 2
    Theta = 30
    
    If cAvax1.GetAllHandlesArr(lHandles()) <> 0 Then
        Call cAvax1.SelectItems(lHandles())
        Call cAvax1.RotateItems(lHandles(), RotX, RotY, Theta)
     End If
End Sub


Hermes,
Thanks for the example. I had already found RotateItem andfigured that was the direction I needed to go, you confirmed that forme. I would like to be able to determine to rotation angle on thescreen with the mouse, is that possible?
Thank You,
Tim

#7 User is offline   Athanasios Gardos Icon

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

Posted 03 September 2009 - 01:21 PM

You can select the objects:
Call cAvax1.SelectItems(lHandles())
and call the rotate command:
cAvax1.Command=rotate_c
Athanasios Gardos
Avax-Software.com

Page 1 of 1


Fast Reply

  

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