明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1955|回复: 4

[求助][LISP]請高手看看唷

[复制链接]
发表于 2004-8-21 10:14:00 | 显示全部楼层 |阅读模式
以下是个可将图块改顏色或改成随层的程序,但问题是为何我选择改顏色时可以叫出顏色对话框,而我想改随层时却不能用'_layer叫出图层性质管理员,来设定已有的层叻 ?请高手们帮忙看看 (defun #chg_color (e cnum0 cnum / tf e blkna)
(xdrx_setenttodb e)
(setq tf (xdrx_getentdxf 0))
(cond
((or
(= tf "INSERT")
(= tf "DIMENSION")
)
(setq blkna (xdrx_getentdxf 2))
(setq blkna (tblsearch "block" blkna))
(setq e (cdr (assoc -2 blkna)))
(while e
(xdrx_setenttodb e)
(setq tf (xdrx_getentdxf 0))
(if (or
(= tf "INSERT")
(= tf "DIMENSION")
)
(progn
(#chg_color e cnum0 cnum)
)
(progn
(xdrx_setenttodb e)
(xdrx_modent cnum0 cnum)
)
)
(setq e (entnext e))
)
)
(t
(xdrx_modent cnum0 cnum)
)
)
)
;;步骤二
(defun c:dwgblack (/ ss key num num0 n e)
(setq xp_oer *error*
*error* xp_err)
(xdrx_begin)
(prompt "\n请选取要变色的实体<全选>:")
(if (not (setq ss (ssget)))
(setq ss (ssget "x"))
)
(initget "1 2")
(setq key (getstring "\n[1 改顏色/2 改层]<1>: "))
(if (or (= key "1")
(= key "")
)
(progn
(setq num (acad_colordlg 7))
(setq num0 62)
)
(progn
(setq num (getstring "\n图层名称: "))
(setq num0 8)
)
)
(setq n 0)
(xdrx_setsstodb ss 0)
(xdrx_pbarbegin "已经完成:" (sslength ss))
(while (setq e (xdrx_getentdata 0))
(xdrx_pbarsetpos n)
(setq n (1+ n))
(#chg_color e num0 num)
(entupd e)
)
(xdrx_pbarend)
(setvar "osmode" 4261)
(xdrx_end)
(princ)
)
发表于 2004-8-21 12:05:00 | 显示全部楼层

用下面这个涵数可以的调也选色彩的界面

Displays the standard AutoCAD color selection dialog box

(acad_colordlg colornum [flag])

Arguments

colornum

An integer in the range 0–256 (inclusive), specifying the AutoCAD color number to display as the initial default.

flag

If set to nil, disables the ByLayer and ByBlock buttons. Omitting the flag argument or setting it to a non-nil value enables the ByLayer and ByBlock buttons.

A colornum value of 0 defaults to ByBlock, and a value of 256 defaults to ByLayer.

Return Values

The user-selected color number; otherwise nil, if the user cancels the dialog box.

Examples

Prompt the user to select a color, and default to green if none is selected:

(acad_colordlg 3)
 楼主| 发表于 2004-8-22 21:27:00 | 显示全部楼层
大大!看不懂耶
发表于 2004-8-23 08:38:00 | 显示全部楼层
如果程序不是你自己写的,你对它也不是很了解,最好注明一下,否则,别人一看,至少有一定的水平了,给你的回答就可能会想2楼那样比较专业点了
 楼主| 发表于 2004-8-26 11:41:00 | 显示全部楼层
不好意思,小弟忽略了,请大大辛苦点,帮帮忙吧!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 18:29 , Processed in 0.180589 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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