帮助,搜索lisp
你好我正在搜索lisp以绘制垂直线,如照片示例所示。1) 选择点A,然后选择点B
2) 给出第一条垂直线的长度(例如6.10m)
3) 给出第二条垂直线的长度(例如12.00m)
4) 选择要绘制这条线的边
对于我的绘图,我使用这个单位
格式->单位->十进制、梯度、顺时针、米和方向->北
有人能帮忙吗
谢谢
若A到B是100.00,它是什么样子的(输入相同的示例6.10和12.00) 你想要Lisp程序,因为你不能自己画吗?
这似乎是一个特殊的要求,而不是每个人的常规。
有时候,画图可能意味着一点努力,除非你能自己写lisp,否则其他人为什么要这么做?除非他们想找时间填饱肚子。
在本例中,hi HANHPUC tha ab长度为8.24m。长度6.10和12只是一个例子。我想为这条垂直线提供任意长度的选项。
有什么想法吗
谢谢 通常我们会这样做
@距离
Command: LINE
Specify first point:
Specify next point or : @6.1<0
Specify next point or :
Command:
LINE Specify first point:
Specify next point or : @12<90
另一个(与代码无关):理论上,如果手动输入对角线长度,我们无法获得与手动输入值匹配的垂直长度(从B开始的线),因为A到B是固定长度 谢谢hanhphuc 呵呵?
太棒了不客气
If the perpendicular line is fixed by manual input, then the line from A must be diagonal?
This example can draw perpendicular line, but not diagonal
(defun c:test (/ os asin _line p1 p2 d2 l1 ad d ok p ang d3 dir ip ); hanhphuc 25.02.2015 (setq os (getvar 'osmode)asin'((x) (atan (/ x (sqrt (+ 1.0 (* x (- x)))))))_line '((a lst) (foreach x lst (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 x)))))) ;_ end of setq (setvar 'osmode 1) (if (and (setq p1 (getpoint "\nPick point A: ")) (setq p2 (getpoint p1 "\nPick point B: ")) (setq d2 (getdist p2 "\nInput perpendicular length: ")) (setq l1(list p1 p2) ad(mapcar ''((x) (apply x l1)) '(angle distance)) d (cadr ad) ok (< d2 d)) (setq p (getpoint "\nPick side to draw.. ")) ) ;_ end of and (progn (setq ang (asin (/ d2 d)) d3(* d (cos ang)) dir (car ad) ip(apply 'if (vl-list* (minusp (- (* (- (cadr p) (cadr p1)) (cos dir)) (* (- (car p) (car p1)) (sin dir)))) (mapcar ''((f) (polar p1 ((eval f) dir ang) d3)) '(- +)) ) ;_ end of vl-list* ) ;_ end of apply ) ;_ end of setq (_line ip l1) ) ;_ end of progn(if (not ok)(alert "Perpendicular line exceeds length of A to B!") ) ) ;_ end of if (setvar 'osmode os) (princ) ) ;_ end of defun
another (not related to code): by theory if diagonal length by manual input, we can't get perpendicular length (line from B) matched with manual input value due to A to B is fixed length Thank youhanhphuc
页:
[1]
2