TheSwamp
Code Red => VB(A) => Topic started by: DaveW 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
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
-
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
-
Works great!
Thank you very much.
I thought there was something important i was missing.
Dave