print1985
发表于 2012-6-11 09:47:19
把这句加上(vl-load-com)
亲 以后遇见VL函数都要加哦
ptime
发表于 2012-6-11 10:25:38
谢谢楼主分享,支持源码。
smartstar
发表于 2012-6-11 12:34:59
本帖最后由 smartstar 于 2012-6-11 13:01 编辑
图层锁定没有褪色效果,可否添加此效果。另外可否添加选择图层解除锁定功能。
可扩展功能图片:
xiaolong1487
发表于 2012-6-11 12:58:08
太感谢了,很好的资料,而且是免费的,谢谢!
print1985
发表于 2012-6-11 14:20:36
smartstar 发表于 2012-6-11 12:34 static/image/common/back.gif
图层锁定没有褪色效果,可否添加此效果。另外可否添加选择图层解除锁定功能。
可扩展功能图片:
谢谢,功能会慢慢添加的,因为我自己也要用
褪色你是指的高版本的LAYLOCKFADECTL参数控制的褪色,还是直接改变锁定图层的颜色?
高版本的那个褪色很鸡肋,锁层与解锁切换很慢,有时图纸太大要等半天
直接改变图层颜色也只能改变颜色随层的物体,如果图层多图纸大也慢,因为都需要刷新,只要刷新就慢
smartstar
发表于 2012-6-11 14:24:15
本帖最后由 smartstar 于 2012-6-11 14:25 编辑
我指的是LAYLOCKFADECTL参数控制的褪色,锁定褪色可以很直观判断那些图层已经被锁定。
print1985
发表于 2012-6-11 16:16:26
smartstar 发表于 2012-6-11 14:24 static/image/common/back.gif
我指的是LAYLOCKFADECTL参数控制的褪色,锁定褪色可以很直观判断那些图层已经被锁定。
先试试;自定义命令
(defun c:vs () (tcsd));图层锁定
(defun c:vjs () (tcjs));选择解锁
(defun c:vjq () (tcqbjs));全部解锁
(defun c:vsf () (tcsdf));锁定(反)
;[图层锁定]
(defun tcsd (/ AcadObject AcadDocument LayersObj ss n i ent ob lay vlay tuise)
(setq AcadObject (vlax-get-acad-object)
AcadDocument (vla-get-ActiveDocument AcadObject)
LayersObj (vla-get-layers AcadDocument)
);end setq
(princ "\n请选择需要锁定的图层" )
(if (setq ss (ssget))
(progn
(setq n (sslength ss))
(setq i (- n 1))
(repeat n
(setq ent (ssname ss i)
ob (vlax-ename->vla-object ent)
lay (vla-get-layer ob)
vlay (vla-item LayersObj lay)
);end setq
(vla-put-lock vlay :vlax-true)
(setq i (1- i))
);end repeat
(setq tuise (getvar "LAYLOCKFADECTL"))
(setvar "LAYLOCKFADECTL" (* tuise -1))
(setvar "LAYLOCKFADECTL" tuise)
(princ "\n已锁定选择图层" )
));end if
(princ)
);end defun
;[图层全部解锁]
(defun tcqbjs (/ AcadObject AcadDocument LayersObj vlay tuise)
(setq AcadObject (vlax-get-acad-object)
AcadDocument (vla-get-ActiveDocument AcadObject)
LayersObj (vla-get-layers AcadDocument)
);end setq
(vlax-for vlay LayersObj
(vla-put-lock vlay :vlax-false)
);end vlax-for
(setq tuise (getvar "LAYLOCKFADECTL"))
(setvar "LAYLOCKFADECTL" (* tuise -1))
(vla-regen AcadDocument AcAllViewPorts)
(setvar "LAYLOCKFADECTL" tuise)
(princ "\n已解锁全部图层" )
(princ)
);end defun
;[图层解锁(反)]
(defun tcsdf (/ AcadObject AcadDocument LayersObj ss n i ent ob lay vlay tuise)
(setq AcadObject (vlax-get-acad-object)
AcadDocument (vla-get-ActiveDocument AcadObject)
LayersObj (vla-get-layers AcadDocument)
);end setq
(princ "\n请选择不需要锁定的图层" )
(if (setq ss (ssget))
(progn
(vlax-for vlay LayersObj
(vla-put-lock vlay :vlax-true)
);end vlax-for
(setq n (sslength ss))
(setq i (- n 1))
(repeat n
(setq ent (ssname ss i)
ob (vlax-ename->vla-object ent)
lay (vla-get-layer ob)
vlay (vla-item LayersObj lay)
);end setq
(vla-put-lock vlay :vlax-false)
(setq i (1- i))
);end repeat
(setq tuise (getvar "LAYLOCKFADECTL"))
(setvar "LAYLOCKFADECTL" (* tuise -1))
(setvar "LAYLOCKFADECTL" tuise)
(princ "\n已锁定除选择图层外的其余图层" )
));end if
(princ)
);end defun
;[选择解锁]
(defun tcjs (/ AcadObject AcadDocument LayersObj ss n i ent ob lay vlay tuise lay-tn)
(setq AcadObject (vlax-get-acad-object)
AcadDocument (vla-get-ActiveDocument AcadObject)
LayersObj (vla-get-layers AcadDocument)
);end setq
(princ "\n请选择需要解锁的图层" )
(if (setq ss (ssget))
(progn
(setq n (sslength ss))
(setq i (- n 1))
(repeat n
(setq ent (ssname ss i)
ob (vlax-ename->vla-object ent)
lay (vla-get-layer ob)
vlay (vla-item LayersObj lay)
);end setq
(if (= (vla-get-lock vlay) :vlax-true)
(progn
(vla-put-lock vlay :vlax-false)
(setq lay-tn T)
))
(setq i (1- i))
);end repeat
(if lay-tn
(progn
(setq tuise (getvar "LAYLOCKFADECTL"))
(setvar "LAYLOCKFADECTL" (* tuise -1))
(vla-regen AcadDocument AcAllViewPorts)
(setvar "LAYLOCKFADECTL" tuise)
))
(princ "\n已解锁选择图层" )
));end if
(princ)
);end defun
gzxl
发表于 2012-6-11 17:28:25
关于隐藏物体的代码论坛已经比较多了,但有个缺点就是对隐藏物体的显示都是全显。。。
如果可以预览所隐藏的物体是不是更简便易用,更加人性化呢?希望楼主能先搞出来
我想应该是这样的个思路
xiaoquansb
发表于 2012-6-11 17:58:18
支持楼主开源
zyhandw
发表于 2012-6-11 18:00:26
下了,学习学习!
页:
1
2
[3]
4
5
6
7
8
9
10