GregGleason Posted August 5, 2021 Posted August 5, 2021 I am trying to do a lisp routine where I click on two points. The center of the circle is on the first point and has a fixed radius or diameter. The circle has as its axis an imaginary line between the two points. Getting the two points is easy enough, but how do I orient the circle along the imaginary line? The two points will be typically non-orthagonal (I don't know if that makes a difference though). Greg Quote
lrm Posted August 6, 2021 Posted August 6, 2021 7 hours ago, GregGleason said: I am trying to do a lisp routine where I click on two points. The center of the circle is on the first point and has a fixed radius or diameter. The circle has as its axis an imaginary line between the two points. Getting the two points is easy enough, but how do I orient the circle along the imaginary line? The two points will be typically non-orthagonal (I don't know if that makes a difference though). Greg Should "The circle has as its axis an imaginary line between the two points" be interpreted to mean that the circle lies on a plane perpendicular to the line defined by the two points? Quote
GregGleason Posted August 6, 2021 Author Posted August 6, 2021 2 hours ago, lrm said: Should "The circle has as its axis an imaginary line between the two points" be interpreted to mean that the circle lies on a plane perpendicular to the line defined by the two points? Yes. I should have been more clear, but that is it exactly. Greg Quote
GregGleason Posted August 6, 2021 Author Posted August 6, 2021 10 hours ago, ronjonp said: A before and after pic/dwg would help. Here is a 4-view that is an "after". Upper left is top. Upper right is right, lower left is front, and lower right is isometric 1. The green line represents two points. Greg Quote
Jonathan Handojo Posted August 6, 2021 Posted August 6, 2021 (edited) Like this? (defun c:foo ( / nrm p1 p2 rad) (and (setq rad 10) ; Can be modified to getdist if desired, or else this will do (setq p1 (getpoint "\nSpecify first point <exit>: ")) (setq p2 (getpoint p1 "\nSpecify second point <exit>: ")) (progn (setq p1 (trans p1 1 0) p2 (trans p2 1 0) nrm (vx1 (mapcar '- p2 p1)) ) (entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p2) ) ) (entmake (list '(0 . "CIRCLE") (cons 10 (trans p1 0 nrm)) (cons 40 rad) (cons 210 nrm) ) ) ) ) ) ;; Unit Vector - Lee Mac ;; Args: v - vector in R^2 or R^3 (defun vx1 ( v ) ( (lambda ( n ) (if (equal 0.0 n 1e-10) nil (mapcar '/ v (list n n n)))) (distance '(0.0 0.0 0.0) v) ) ) Edited August 7, 2021 by Jonathan Handojo Quote
GregGleason Posted August 6, 2021 Author Posted August 6, 2021 6 hours ago, Jonathan Handojo said: Like this? (defun c:foo ( / nrm p1 p2 rad) (and (setq rad 10) ; Can be modified to getdist if desired, or else this will do (setq p1 (getpoint "\nSpecify first point <exit>: ")) (setq p2 (getpoint p1 "\nSpecify second point <exit>: ")) (progn (setq p1 (trans p1 1 0) p2 (trans p2 1 0) nrm (mapcar '- p2 p1) ) (entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p2) ) ) (entmake (list '(0 . "CIRCLE") (cons 10 (trans p1 '(0.0 0.0 1.0) (vx1 nrm))) (cons 40 rad) (cons 210 nrm) ) ) ) ) ) ;; Unit Vector - Lee Mac ;; Args: v - vector in R^2 or R^3 (defun vx1 ( v ) ( (lambda ( n ) (if (equal 0.0 n 1e-10) nil (mapcar '/ v (list n n n)))) (distance '(0.0 0.0 0.0) v) ) ) Thank you Jonathan Handojo! That is what I was shooting for! I need to study the Unit Vector by Lee Mac to see if I can get an understanding of how this works. Truly amazing solve and I appreciate it! Greg Quote
BIGAL Posted August 6, 2021 Posted August 6, 2021 The Cal function NOR may be useful, "Calculating a Normal Vector", nor(p1,p2) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.