Incompatibility between polar coordinates and .x

Hi,

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()

Hope this helps

1 Like

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.


I see @farouk.serragedine had a script… Both easier and faster :joy:
-Jakob

2 Likes

I am genuinely impressed by your creative thinking nonetheless.

1 Like

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

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.

_line 0 20,sin(10degree)*20
:nerd_face:

and with less magic combine:
_line
and
_shear

1 Like

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.

you could shave some keystrokes: _line 0 20,sin(10d)*20

But I like your _line and _shear better because it works regardless of orientation whereas the sin solution only works relative to the x-axis.

1 Like

@pascal
This request showed up again in a training today.
I guess this is now too late… Is this something than can be put on the wish pile for 9 ?