明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1014|回复: 4

为什么无法运行?

[复制链接]
发表于 2009-6-18 20:19:00 | 显示全部楼层 |阅读模式

哪里出错了?

(defun c:jc(/ a a1 a2 ang b b1 b2 obm r w)
  (set obm (getvar "blipmode"))
  (initget 7)
  (setq w (getreal "\nwidth of jc:"))
  (setq r (/ w 2))
  (setvar "blipmode" 1)
  (initget 1)
  (setq a (getpoint "\nlocate first center:"))
  (initget 1)
  (setq b (getpoint "\nlocate second center:"))
  (setvar "blipmode" 0)
  (setq ang (angle a b))
  (setq a1 (polar a (- ang (/ pi 2)) r))
  (setq a2 (polar a (+ ang (/ pi 2)) r))
  (setq b1 (polar b (- ang (/ pi 2)) r))
  (setq b2 (polar b (+ ang (/ pi 2)) r))
  (setvar "cmdecho" 0)
  (command "pline" a1 b1 "a" b2 "l" a2 "a" "cl")
  (setvar "cmdecho" 1)
  (setvar "blipmode" obm)
  (princ)
  )

发表于 2009-6-18 21:14:00 | 显示全部楼层

1.(set obm (getvar "blipmode"))->(setq obm (getvar "blipmode"))

2.(setvar "osmode" 0)执行pline命令需要关闭对象捕捉

 楼主| 发表于 2009-6-19 08:25:00 | 显示全部楼层

谢谢版主我的问题已解决,第二点没有想到.现在的程序如下:

(defun c:jc(/ a a1 a2 ang b b1 b2 obm r w oom)
  (setq obm (getvar "blipmode"))
  (setq oom (getvar "osmode"))
  (initget 7)
  (setq w (getreal "\nwidth of jc:"))
  (setq r (/ w 2))
  (setvar "blipmode" 1)
  (initget 1)
  (setq a (getpoint "\nlocate first center:"))
  (initget 1)
  (setq b (getpoint a "\nlocate second center:"))
  (setvar "blipmode" 0)
  (setq ang (angle a b))
  (setq a1 (polar a (- ang (/ pi 2)) r))
  (setq a2 (polar a (+ ang (/ pi 2)) r))
  (setq b1 (polar b (- ang (/ pi 2)) r))
  (setq b2 (polar b (+ ang (/ pi 2)) r))
  (setvar "cmdecho" 0)
  (setvar "osmode" 0)
  (command "pline" a1 b1 "a" b2 "l" a2 "a" "cl")
  (setvar "cmdecho" 1)
  (setvar "blipmode" obm)
  (setvar "osmode" oom)
  (princ)
  )

 楼主| 发表于 2009-6-19 08:38:00 | 显示全部楼层

现在还有一个问题就是如何加中心线?中心线在AM-7图层上?

发表于 2009-6-19 12:35:00 | 显示全部楼层

加载线型可直接用命令加载

(command "_.LINETYPE" ...)

(command "_.layer" "_ltype" ...)

也可以用vla-load加载

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-2-24 20:31 , Processed in 0.170371 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表