明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1252|回复: 6

[提问] 打开和关闭图层

[复制链接]
发表于 2015-12-28 17:19:07 | 显示全部楼层 |阅读模式

(command "layoff" "5" "")   ;关闭蓝色图层
(command "layon" "")   ;打开蓝色图层

     请教各位,哪里不对?
发表于 2015-12-28 22:32:24 | 显示全部楼层
最基本的东西,自己输入命令看看就知道了,跟着提示一步一步走下去!
  1. (if (= (getvar "CLAYER") "1")
  2.   (command "-LAYER" "off" "1" "y" "")
  3.   (command "-LAYER" "off" "1" "")
  4. )
  5. (command "-LAYER" "on" "1" "")
发表于 2015-12-29 04:10:10 | 显示全部楼层
学习了,谢谢
 楼主| 发表于 2015-12-29 13:37:07 | 显示全部楼层
谢谢!!!
 楼主| 发表于 2015-12-29 14:14:38 | 显示全部楼层
(defun c:h60()
(princ "\n##LZ 6点+RP\n")
(setvar "CMDECHO" 0)    ;关闭AutoCAD提示和输入
(setq oldos (getvar "OSMODE"))    ;关闭对象捕捉
(if (= (getvar "CLAYER") "1")
  (command "-LAYER" "off" "5" "y" "")
  (command "-LAYER" "off" "5" "")
)    ;关闭蓝色图层
(setq x0 139.3 y0 82.5)
(setq p0 (list x0 y0))
(setq ar (getangle p0 "\n输入角度ar="))
(setq a1 (getangle p0 "\n输入角度a1="))
(setq a2 (getangle p0 "\n输入角度a2="))
(setq a3 (getangle p0 "\n输入角度a3="))
(setq a4 (getangle p0 "\n输入角度a4="))
(setq a5 (getangle p0 "\n输入角度a5="))
(setq a6 (getangle p0 "\n输入角度a6="))
(setq pr (polar p0 ar 87) pr1 (polar p0 ar 75))
(setq p1 (polar p0 a1 87) p11 (polar p0 a1 75))
(setq p2 (polar p0 a2 87) p21 (polar p0 a2 75))
(setq p3 (polar p0 a3 87) p31 (polar p0 a3 75))
(setq p4 (polar p0 a4 87) p41 (polar p0 a4 75))
(setq p5 (polar p0 a5 87) p51 (polar p0 a5 75))
(setq p6 (polar p0 a6 87) p61 (polar p0 a6 75))
(setvar "OSMODE" 0)    ; ;关闭AutoCAD提示和输入
(command "line" pr1 pr "")
(command "line" p11 p1 "")
(command "line" p21 p2 "")
(command "line" p31 p3 "")
(command "line" p41 p4 "")
(command "line" p51 p5 "")
(command "line" p61 p6 "")
(setq f1 (getint "\n输入分格数f1="))
(setq f2 (getint "\n输入分格数f2="))
(setq f3 (getint "\n输入分格数f3="))
(setq f4 (getint "\n输入分格数f4="))
(setq f5 (getint "\n输入分格数f5="))
(command "LINE" p11 (polar p11 a1 6) "" "array" "L" "" "p" p0 (+ f1 1) (/ (* (- a2 a1) 180) pi) "y" "ERASE" "P" "")  ; "y"是命令要求Yes之意。"ERASE" "P" ""是删除前一选择集
(command "LINE" p21 (polar p21 a2 6) "" "array" "L" "" "p" p0 (+ f2 1) (/ (* (- a3 a2) 180) pi) "y" "ERASE" "P" "")
(command "LINE" p31 (polar p31 a3 6) "" "array" "L" "" "p" p0 (+ f3 1) (/ (* (- a4 a3) 180) pi) "y" "ERASE" "P" "")
(command "LINE" p41 (polar p41 a4 6) "" "array" "L" "" "p" p0 (+ f4 1) (/ (* (- a5 a4) 180) pi) "y" "ERASE" "P" "")
(command "LINE" p51 (polar p51 a5 6) "" "array" "L" "" "p" p0 (+ f5 1) (/ (* (- a6 a5) 180) pi) "y" "ERASE" "P" "")
(setq dr (polar pr ar 2))   
(setq d1 (polar p1 a1 2))    ;数字和p1间距
(setq d2 (polar p2 a2 2))
(setq d3 (polar p3 a3 2))
(setq d4 (polar p4 a4 2))
(setq d5 (polar p5 a5 2))
(setq d6 (polar p6 a6 2))
(command "dtext" "s" "hz0.75" "j" "mr" dr 5 0)  ;样式hz0.75,对正右中,字高5,旋转0度
(command "dtext" "s" "hz0.75" "j" "mr" d1 5 0)
(command "dtext" "s" "hz0.75" "j" "mr" d2 5 0)
(command "dtext" "s" "hz0.75" "j" "mr" d3 5 0)
(command "dtext" "s" "hz0.75" "j" "mr" d4 5 0)
(command "dtext" "s" "hz0.75" "j" "mr" d5 5 0)
(command "dtext" "s" "hz0.75" "j" "mr" d6 5 0)
(command "-LAYER" "on" "5" "")  ;打开蓝色图层

(setvar "OSMODE" oldos)    ;打开对象捕捉
(setvar "CMDECHO" 1)     ;打开AutoCAD提示和输入
(princ)
)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2015-12-29 15:21:05 | 显示全部楼层
本人菜鸟,请教2楼,关闭和打开蓝色图层(名称“YIN”),错在哪里?
 楼主| 发表于 2015-12-29 17:47:23 | 显示全部楼层
已解决,感谢2楼的指教!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-21 03:33 , Processed in 0.179112 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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