是的,你有4个坐标
可以绘制矩形(命令“rectang”coordinate1“r”0 coordinate2)
只要更换这一行
((=(car inp)3)(pass_数据))
更换此线路
((=(car inp)3)(pass\U数据)(命令“rectang”p11“r”0 p13))
然后
更换此线路
(setq p1(列表(-car pnt)(/dx 2.0))((cadr pnt)(/dy 2.0)))
p2(极性p1(/pi 2.0)dy)p3(极性p2 0 dx)p4(极性p1 0 dx))
更换此线路
(setq p1(列表(-car pnt)(/dx 2.0))((cadr pnt)(/dy 2.0)))
p2(极性p1(/pi 2.0)dy)p3(极性p2 0 dx)p4(极性p1 0 dx)p11 p1 p13 p3) 好东西Rlx!
由于你的创造性,我总是尽量不忽视你的建议。
Thanx Grrr状态线并不完全是我第一次想到的,但现在它必须这样做。但出于实用目的,它是完全功能性的
gr.Rlx 仔细阅读你的代码,进行一些日常练习:
(defun C:test ( / mysc GetISOpsizes shiftL msgf _getrec LWPoly *error* psL scL orn s g k r rec )
'(87 114 105 116 116 101 110 32 98 121 32 71 114 114 114)
(setq mysc 0.1) ; scale factor for the units, to readjust the rectangle's size of (_getrec) and the console prompts, can be leaved nil.
; ("A4" "210.00" "297.00")
(defun GetISOpsizes ( / L r )
(defun splitstr (s d / p L) (while (setq p (vl-string-search d s)) (setq L (cons (substr s 1 p) L)) (setq s (substr s (+ p 2)))) (reverse (cons s L)))
(defun GetCanonicalMediaNames ( / acDoc layObj )
(setq layObj (vla-get-ActiveLayout (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))))
(vla-put-ConfigName layObj "DWG To PDF.pc3")
(vla-RefreshPlotDeviceInfo layObj)
(vlax-invoke (vla-item (vla-get-layouts acDoc) "Model") 'GetCanonicalMediaNames)
)
(and
(setq L (apply 'append (mapcar ''((x)(if (wcmatch x "ISO_*") (list (splitstr x "_")))) (GetCanonicalMediaNames))))
(setq L (vl-remove-if-not ''((x) (= 6 (length x))) L))
(setq L (mapcar ''((x) (apply ''((a b c d e f) (list b (vl-string-left-trim "(" c) e)) x)) L))
(setq r L)
); and
r
); defun GetISOpsizes
; _$ (shiftL '(a b c d e) t) -> (B C D E A)
; _$ (shiftL '(a b c d e) nil) -> (E A B C D)
(setq shiftL '(( L f ) (if f (append (cdr L) (list (car L))) (cons (last L) (reverse (cdr (reverse L)))))))
(setq msgf
'((x psL scL orn / ps sc ori )
((eval x)
(strcat "\n"
" Paper size: " (apply '(lambda (a b c) (strcat a " " b "x" c)) (setq ps (car psL))) " | "
"[-/+] Scale: " (strcat "1:" (setq sc (car scL))) " | "
" Orientation: " (setq ori (car orn))
); strcat
); x
(list ps sc ori)
)
); setq msgf
(setq _getrec
(lambda ( c sc / tmp tmpr )
(redraw)
(setq tmp (mapcar 'atof (cdar r)))
(if (/= "Landscape" (car orn)) (setq tmp (reverse tmp)))
(setq tmp (mapcar ''((x) (* (cond (sc) (1.)) (read (cadr r)) (/ x 2.))) tmp))
(apply ''((a b c d) (grdraw a b 2 1) (grdraw b c 2 1) (grdraw c d 2 1) (grdraw d a 2 1))
(setq tmpr
(list
(mapcar '+ c tmp)
(mapcar '+ c (list (- (car tmp)) (cadr tmp)))
(mapcar '+ c (mapcar '- tmp))
(mapcar '+ c (list (car tmp) (- (cadr tmp))))
); list
); setq tmpr
); mapcar
tmpr
)
); setq _getrec
(defun LWPoly (lst cls) ; Lee Mac
(entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))
)
(defun *error* ( m )
(redraw)
(and m (princ m)) (princ)
); defun *error*
(setq psL ((lambda (L / nL) (foreach x L (cond ( (assoc (car x) nL) ) ( (setq nL (cons x nL)) ) )) (reverse nL)) (GetISOpsizes)))
(setq scL (apply 'append (mapcar ''((a) (mapcar ''((b)(strcat (itoa b) a)) '(1 2 5))) '("" "0" "00" "000"))))
(setq orn '("Landscape" "Portrait"))
(setq r (msgf 'princ psL scL orn))
(while (not s) (setq g (grread t))
(and (or (equal g '(2 13)) (= (car g) 25)) (setq s T))
(cond
(
(and (= (car g) 2)
(cond
( (member g '((2 97)(2 65))) (setq psL (shiftL psL nil)) )
( (member g '((2 100)(2 68))) (setq psL (shiftL psL t)) )
( (equal g '(2 45)) (setq scL (shiftL scL nil)) )
( (equal g '(2 43)) (setq scL (shiftL scL t)) )
( (member g '((2 9)(2 32))) (setq orn (reverse orn)) )
); cond
(setq r (msgf 'princ psL scL orn))
)
)
( (= (car g) 5) (_getrec (cadr g) mysc) )
( (= (car g) 3) (setq rec (_getrec (cadr g) mysc)) (setq s t) )
); cond
); while
; (apply 'msgf (cons 'alert (mapcar 'list r)))
(and rec (LWPoly rec 1))
(*error* nil) (princ)
); defun
我总是被grread的使用和列表操作所吸引。
你把它压实得很好。我确实觉得边界很小,但对我来说又是早上六点,所以我现在也感觉很小。。。(你可能用英寸而不是毫米来计算)
gr.Rlx
工作完美。
谢谢
谢谢,您可能会在那里找到一些有用的编码技巧——尽管当我开始添加子函数时它有点复杂。
我的单位设置为毫米,但我以厘米为单位工作(考虑到1个单位=1厘米)。
然而,我已经有了一个动态块,我用它来绘制标题栏(它有动态属性表,在那里我可以调整它的大小和比例)。
因此,在编写它的时候,我刚刚对例程输出的矩形大小与我的块进行了视觉比较。
这就是为什么我在开头添加了一个变量,您可以在其中调整正确的结果:
(setq mysc 0.1)
(setq mysc nil)
(setq mysc 10.)
但是如果没有“DWG-To-PDF.pc3”绘图仪,整个代码可能会失败。
总是很乐意学习,尤其是关于“微小的lisp工具”(或一行程序),它们在您的代码中非常丰富。
由于我们的传统,这里不能有动态标题栏或边框,所以虽然我的大多数应用程序都能很好地使用较新的边框,但可以说,它们总是有“DOS支持”的负担。一些图纸仍然只能在tif或pdf上找到,所以想想我的生活有时有多可怕吧,哈哈
无论如何,谢谢你的意见。希望OP也喜欢。
gr.Rlx
页:
1
[2]