I’m trying to draw a line with a specified angle and a specified length along x axis.
As you can see here it’s not psosible to force both the angle and the x coordinate of the second point.

All other solutions I can think of require to add the point at (5,0), or construction lines, or guides… Or draw a longer line and split it… So yes there are many solutions but is there a way with a single Line command ?

Hi Teddy,
I had encountered this same issue.
There you go

#.X param and ANGLE value line
import Rhino
import math
import rhinoscriptsyntax as rs
start_point = rs.GetPoint("Please choose the start point")
x_end = float(input("Please enter the X coordinate for the end point: "))
angle_degrees = float(input("Please enter the starting angle in degrees: "))
angle_radians = math.radians(angle_degrees)
length = x_end / math.cos(angle_radians)
y_end = math.sin(angle_radians) * length
end_point = Rhino.Geometry.Point3d(x_end, y_end, 0)
line = Rhino.Geometry.Line(start_point, end_point)
Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(line)
Rhino.RhinoDoc.ActiveDoc.Views.Redraw()

Hi @magicteddy
It’s a bit of a hack, and there might be a cleaner way of doing it, but here’s one way. It does require you to “manually” delete the typed in x-value/length in the prompt after you set the smart-track marker. So basically you start PolyLine and type in your x-value. Now hold down Shift for ortho and tap Ctrl to set a SmartTrack marker. Use Delete to clear the x-value in the prompt and <“Desired Angle” to lock in the angle of the line. Now use SmartTrack to complete the line. The “correct” angles will show up as “Int” osnaps (intersection), so that needs to be turned on.

Yep, I thought of that, but I don’t see myself explaining this tricky SmartTrack move to beginners

Same for @farouk.serragedine script, clever solution but having to tell beginners they need to save this script and add a button for it to do a simple line is a bit disappointing.

This is starting to ressemble more and more like an enhancement wish for .x command.

Ha ! It doesn’t work with 20 degrees. The polar constraint is applied to both the origin and the marked point making it impossible to select the intersection along the vertical axis.