AVAX-software.com Forums: Select Points - AVAX-software.com Forums

Jump to content

Page 1 of 1

Select Points

#1 Guest_Terry_*

  • Group: Guests

Post icon  Posted 07 June 2005 - 06:12 PM

Hi,

I am having a bit of confusion with the Select Points command. I want the user to select a point, then insert an object at that point. Additionally, if the user inserts an object and 2 points were selected, the objects is inserted at the first point and fit into the window created by the 2 selected points.

Also, if the user picks 2 points, how do I extract the coordinates of the two points selected. The docs spell it out ok, but I cannot seem to get working properly.

Here is the some code which selects the two points, but the image never is inserted. (I am using VB.Net which uses 0 for the first uitem in an array, not 1). Could you let me know what I am doing wrong.

Dim iProp As Avax.AvaxProp
Dim sMask As String
Dim sExpFile As String
Dim sExpExt As String
Dim aWidth As Single
Dim aHeight As Single
Dim PictureFiles() As String

Dim sSelectID As String
Dim lPointsToSelect As Long
Dim x() As Single
Dim y() As Single
Dim z() As Single
Dim Answer As Boolean
Dim fBoxOn As Boolean = True
Dim fNoSnapAndOrtho As Boolean = True

sMask = "MS Windows Bitmap (*.BMP)|*.BMP|"
sMask = sMask & "JPEG File Interchange (*.JPG)|*.JPG|"
sMask = sMask & "Graphics Interchnage Format (*.GIF)|*.GIF"

With DrawingForm.OpenFileDialog1
.FileName = ""
.RestoreDirectory = True
.Title = "Insert Raster Image..."
.CheckFileExists = True
.CheckPathExists = True
.Filter = sMask
.ShowDialog()
End With

If DrawingForm.OpenFileDialog1.FileName <> "" Then

sExpFile = DrawingForm.OpenFileDialog1.FileName
sExpExt = System.IO.Path.GetExtension(sExpFile)

ReDim PictureFiles(0)
PictureFiles(0) = sExpFile

DrawingForm.drawingscreen.Command = Avax.AvaxCommand.AutoLimits_c

sSelectID = "Select 2 points"
lPointsToSelect = 2

ReDim x(1)
ReDim y(1)
ReDim z(1)

Answer = DrawingForm.drawingscreen.SelectPoints(sSelectID, lPointsToSelect, x, y, z, fBoxOn, fNoSnapAndOrtho)

DrawingForm.drawingscreen.GetSelectedPoints(x, y, z)

DrawingForm.drawingscreen.GetPictureSize(sExpFile, aWidth, aHeight)

DrawingForm.drawingscreen.Add_Picture(PictureFiles, x(0), x(0), aWidth, aHeight, CLng(0))

DrawingForm.drawingscreen.CtlRefresh()

End If

#2 Guest_Terry_*

  • Group: Guests

Posted 07 June 2005 - 08:27 PM

I have figured this one out. In VB.Net the SelectedPoints appears as:


Private Sub drawingscreen_SelectedPoints(ByVal sender As Object, ByVal e As AxAvax.__cAvax_SelectedPointsEvent) Handles drawingscreen.SelectedPoints

Select Case e.selectId

Case "2 points"

If e.lPointNumber = 2 Then

MsgBox(e.x1(1))
MsgBox(e.y1(1))
MsgBox(e.z1(1))
MsgBox(e.x1(2))
MsgBox(e.y1(2))
MsgBox(e.z1(2))

End If

Case "3 points"

If e.lPointNumber = 3 Then

MsgBox(e.x1(1))
MsgBox(e.y1(1))
MsgBox(e.z1(1))
MsgBox(e.x1(2))
MsgBox(e.y1(2))
MsgBox(e.z1(2))
MsgBox(e.x1(3))
MsgBox(e.y1(3))
MsgBox(e.z1(3))

End Select

End Sub

#3 User is offline   Athanasios Gardos Icon

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

Posted 07 June 2005 - 09:50 PM

That's right.

GetSelectedPoints:
Is a function that returns the points that the end user has already pick.
You can use it any time you want.

SelectedPoints:
Is an event that occurs when the end user selects (picks) a point.
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