创建的有效方法
我想知道如何在lisp中最好、最有效地创建此多段线。我通过绘制一些线,然后使用FILLET命令实现了这一点,但结果可能有点不稳定,所以我相信有更好的方法来实现这一点。此外,我需要这是一个多段线,或至少分组,当它这样做时,它可以我镜像,复制,等在图纸的其他部分。这就引出了一个问题,是否最好将is创建为一个块,然后在需要时使用它。这又是一个完全自动化的过程的一部分,我已经在这个过程中工作了几个世纪了,所以它必须完全通过代码来完成。不允许用户输入或选择。
为什么不把你画的画成一块,然后用代码插入呢? 或者只需命令polyline、LL、UL、UR、LR,然后(setvar“FILLETRAD”您的半径),最后使用fillet命令中的polyline选项和(entlast) 汤布。在整个绘图过程中会有各种尺寸的,所以我正在制作一个defun,它可以在任何地方绘制任何尺寸。这是我的工作,它是准确的,但我想可能有一个更好的方法来做到这一点。我用8个不同的点将物体分割成几段,一个在每条线段的末端,另一个在弧的每条中心线上
;;; NOTCHES
(setq notchcenterline 6
notchwidth 3.25
notchdepth 0.5625
ledgerwidth 0.5
notchrad 0.25
)
(setq np1 (polar (polar pt1 0 (- notchcenterline (/ notchwidth 2.))) a270 ledgerwidth)
np2 (polar np1 a90 (+ (- notchdepth notchrad) ledgerwidth))
np3 (polar np2 0 notchrad)
np4 (polar np3 a90 notchrad)
np5 (polar np4 0 (- notchwidth (* notchrad 2)))
np6 (polar np5 a270 notchrad)
np7 (polar np6 0 notchrad)
np8 (polar np1 0 notchwidth)
)
(command "._LINE" np1 np2 "")
(setq l1 (entlast))
(command "._LINE" np4 np5 "")
(setq l2 (entlast))
(command "._LINE" np7 np8 "")
(setq l3 (entlast))
(command "._ARC" "c" np3 np4 np2)
(setq a1 (entlast))
(command "._ARC" "c" np6 np7 np5)
(setq a2 (entlast))
(command "._PEDIT" l1 "Y" "J" l2 l3 a1 a2 "" "") 然后我只做一个动态块。 也许是这样?
福比尔。图纸
Lotsa在CAD中做事情的方法。
干杯 您需要添加基点值:
(defun make_lwpline (x y r)
(entmake (list (cons 0 "LWPOLYLINE")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 410 "Model")
(cons 8 "0")
(cons 100 "AcDbPolyline")
(cons 90 6)
(cons 70 0)
(cons 43 0)
(cons 38 0)
(cons 39 0)
(cons 10 (list 0 0))
(cons 42 0)
(cons 10 (list 0 (- y r)))
(cons 42 -0.414214)
(cons 10 (list r y))
(cons 42 0)
(cons 10 (list (- x r) y))
(cons 42 -0.414214)
(cons 10 (list x (- y r)))
(cons 42 0)
(cons 10 (list x 0))
(cons 42 0)
(cons 210 (list 0 0 1)))))
(initget 7)
(setq x (getdist "\nX Axis: "))
(initget 7)
(setq y (getdist "\nY Axis: "))
(initget 7)
(setq r (getdist "\nFillet Radius Axis: "))
(make_lwpline x y r)
我的0.05美元,您可以绘制任意多条腿的样条线,然后使用全局圆角所有顶点对样条线进行二次排序。Lisp程序在这里的某个地方。
对于使用lisp的各种半径,第1个rad、第1行、第2行使用Accept next line或new rad绘制rad提示符。
大卫给你一个前端
(if (not AH:getval3)(load "getvals"))
(ah:getval3 "Enter height" 5 4 "Enter width" 5 4 "Enter rad" 5 4)
; returns as string val1 val2 val3
GETVALS。拉链
很酷! 下面是我将如何添加基点:
(defun make_lwpline (x y r b / bx by bz)
(setq bx (car b)
by (cadr b)
bz (caddr b))
(entmake (list (cons 0 "LWPOLYLINE")
(cons 100 "AcDbEntity")
(cons 410 "Model")
(cons 100 "AcDbPolyline")
(cons 90 6)
(cons 70 0)
(cons 43 0)
(cons 38 bz)
(cons 39 0)
(cons 10 (list bx by))
(cons 10 (list bx (+ by (- y r))))
(cons 42 -0.414214)
(cons 10 (list (+ bx r) (+ by y)))
(cons 10 (list (+ bx (- x r)) (+ by y)))
(cons 42 -0.414214)
(cons 10 (list (+ bx x) (+ by (- y r))))
(cons 10 (list (+ bx x) by))
(cons 210 (list 0 0 1)))))
(initget 7)
(setq x (getdist "\nX Axis: "))
(initget 7)
(setq y (getdist "\nY Axis: "))
(initget 7)
(setq r (getdist "\nFillet Radius Axis: "))
(initget 1)
(setq b (getpoint "\nBase Point: "))
(make_lwpline x y r b)
页:
[1]