Author Topic: Utility.GetPoint problem  (Read 3374 times)

0 Members and 1 Guest are viewing this topic.

DaveW

  • Guest
Utility.GetPoint problem
« on: July 18, 2006, 12:00:14 PM »
I hav a form I present to the user. On the form, the user is asked if he wishes to get the distance between the 2 points or to specify the length. I then draw the wall.

If the user specifies the length, then I use the second point only for the rotation angle.

If the user says get the distance from the 2 points, and then chooses them, it works fine too.

However, there are times when the user would like to specify the first point and input the second point at the command line.

Example:
The user chooses first point, then when prompted, "Select second point of wall:", the user types @48,0, then enter

Or

The user chooses first point, then when prompted, "Select second point of wall:", the user types 48,0, then enter.

No matter which why the user types this, the value returned is always wrong in reference to the first point.

I have tried thisdrawing.Utility.TranslateCoordinates(Point2, acWorld, acUCS, False), but it still gives me the wrong number.

Anyone have any ideas or suggestions? I do not want to have to specify a third option on the form and present different prompts. This way the user can deal with different situations after he has selected the first point.

Thanks,

Dave

Code: [Select]

    Point1 = thisdrawing.Utility.GetPoint(, "Select first point of wall: ")
    Point2 = thisdrawing.Utility.GetPoint(, "Select second point of wall: ")
   
    Point2(2) = Point1(2)
 
    retAngle = thisdrawing.Utility.AngleFromXAxis(Point1, Point2)
   
   
   
    If Check1.value = vbChecked Then
        WallWidth = CDbl(Text4.Text)
    Else
        xx = Point1(0) - Point2(0)
        yy = Point1(1) - Point2(1)
        zz = Point1(2) - Point2(2)
        WallWidth = Round(Sqr((Sqr((xx ^ 2) + (yy ^ 2)) ^ 2) + (zz ^ 2)), 5)
    End If

« Last Edit: July 18, 2006, 12:05:33 PM by DaveW »

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Utility.GetPoint problem
« Reply #1 on: July 18, 2006, 12:32:55 PM »
I'm not sure why it wouldn't be working for you, are you using the relative variable on the second getpoint function?

This might help you debug some..

Public Sub Test()
Dim OnePoint As Variant
Dim TwoPoint As Variant

OnePoint = ThisDrawing.Utility.GetPoint(, "Pick 1st point:")
TwoPoint = ThisDrawing.Utility.GetPoint(OnePoint, "And the second?")
MsgBox "Distance" & Str(Distance(OnePoint, TwoPoint)) & " X:" & OnePoint(0) - TwoPoint(0) & _
" Y:" & OnePoint(1) - TwoPoint(1), , "One Fish Two Fish"


End Sub

DaveW

  • Guest
Re: Utility.GetPoint problem
« Reply #2 on: July 18, 2006, 12:47:22 PM »
Works great!

Thank you very much.

I thought there was something important i was missing.

Dave
« Last Edit: July 18, 2006, 12:58:23 PM by DaveW »