AutoLISP绘制矩形和五个圆在其内部相切

AutoLISP绘制矩形和五个圆在其内部相切,代码如下。

(defun c:test()
  (setvar "cmdecho" 0)
  (setq oldlay (getvar "clayer"))
  (setq os (getvar "osmode"))
  (setvar "osmode" 0)
  (setq w (getreal "输入底部宽度<100>:"))
  (setq rp1 (getpoint "\n输入左下角点:"))
  (if (null w) (setq w 100))
  (setq r (/ w 2 (1+ (sqrt 3))))
  (setq cp1 (polar rp1 (/ pi 4) (* r (sqrt 2))))
  (setq cp2 (polar cp1 (/ pi 6) (* r 2)))
  (setq rp2 (polar rp1 0 w))
  (setq rp3 (polar rp2 (/ pi 2) (* 4 r)))
  (setq gap (* 2 (sqrt 3) r))
  (command "-layer" "m" "str" "c" 4 "" "")
  (command "rectang" rp1 rp3)
  (command "circle" cp1 r)
  (command "array" (entlast) "" "r" 2 2 (* r 2) gap)
  (command "circle" cp2 r)
  (command "-layer" "m" "dim" "c" 1 "" "")
  (command "dim1" "hor" rp1 rp2 (polar rp1 (* pi 1.5) 10) "")
  (setvar "osmode" os)
  (setvar "clayer" oldlay)
  (prin1)
  )

代码完。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值