TheSwamp
Code Red => VB(A) => Topic started by: Matersammichman on September 16, 2008, 01:55:29 PM
-
I'm using Getpoint to ID an x,y,z position in space.
I want to be able to draw a Pline at a user-define distance and angle relative to my selected point (as in "@23<45).
Anyone know a way to do this?
-
sin and cos should get you there
-
Sub plineinput()
Dim p As AcadLWPolyline
Dim p1, pts(3) As Double
Dim dist As Double, ang As Double
Dim util As AcadUtility
Dim x As Double, y As Double
Set util = ThisDrawing.Utility
p1 = util.GetPoint(, "Pick")
dist = util.GetReal("Length")
ang = util.GetReal("Angle")
ang = ang * Pi / 180 'degrees TO RADIANS
x = Cos(ang) * dist
y = Sin(ang) * dist
pts(0) = p1(0): pts(1) = p1(1)
pts(2) = p1(0) + x: pts(3) = p1(1) + y
Set p = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts)
End Sub
To use "@23<45" you need to parse a string return
-
Thanks Bryco!
-
You are welcome.
-
ThisDrawing.Utility.PolarPoint might be an option too, if I understand the problem correctly