How do I find the point on a curve where the tangent vector is equal to my desired vector (which in this case is represented by a line)? I understand that there may be multiple points on the curve where the tangents match, but that is okay.
Maybe orient a new CPlane with one of the axes along your vector, then use the Quad OSnap.
Thanks, your solution seems to work. Is there a way to do this geometrically?
Hi Lawrence - by this do you mean mark all the points automatically, given a vector and a wiggly curve?
-Pascal
Yes, I was hoping that there was some line drawing mode where I could draw a tangent line that was parallel to a tangent on another curve. Sort of like drawing a line that is perpendicular to two curves, but in this case tangent to one curve and parallel to a point on another (desired direction may not always be a line, could be a tangent on another curve)
Hi Lawrence - looks like setting the CPlane to the line and using Quad is the way to locate the points you need to start the line, then with SmartTrack the Tangent guides will kick in and help. The AlongParallel one-shot OSnap will also help.
@lawrenceyy , here is a macro that might do what you need:
! SmartTrack On
CPlane 3Point
Near Pause Near Pause Enter
Line Quad Pause Pause
CPlane Previous
-Pascal
I got the macro to work through the macro editor. This might be a good opportunity for me to learn about macros. How do they differ from aliases? Can they be saved so they become like aliases? I like how seamless aliases work.
Is it correct to say that macros are one level more complex than aliases. And python scripts would be one level more complex than macros?
Hi Lawrence - macros are just a bunch of Rhino commands strung togther with the correct inputs as needed so the user does not need to run the commands individually - Help has good info on how to do this - it’s easy. Aliases are keyboard entries that run commands or aliases - you can define a new alias that has that macro in Options >Aliases. Set whatever name or letter or whatever you want to type (with Enter) on the left and the macro on the right.
Just to muddy the waters a little more, here’s a cheap script that might be a little cleaner to use:
import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
def TanAndParallel():
crntPlane = rs.ViewCPlane()
lineId = rs.GetObject("Select direction line",4,preselect=True)
if lineId is None: return
vecX = rs.CurveEndPoint(lineId) - rs.CurveStartPoint(lineId)
vecY = rs.VectorRotate(vecX, 90, crntPlane.ZAxis)
newPlane = Rhino.Geometry.Plane(rs.CurveStartPoint(lineId), vecX, vecY)
rs.ViewCPlane(plane=newPlane)
crntAng = Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle
Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle = 90
crntOrtho = Rhino.ApplicationSettings.ModelAidSettings.Ortho
Rhino.ApplicationSettings.ModelAidSettings.Ortho = True
while True:
rs.Command("Line Quad")
if rs.LastCommandResult() != 0: break
rs.ViewCPlane( plane = crntPlane)
Rhino.ApplicationSettings.ModelAidSettings.Ortho = True
Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle = crntAng
pass
if __name__ == "__main__":
TanAndParallel()
TanAndParallel.py (1.1 KB)
You can make a macro that runs the script using
! _-RunPythonScript "Full path to script.py file"
And an alias for that!
-Pascal