将所有图层的线宽一键改为0.00mm
本帖最后由 crtrccrt 于 2016-6-15 18:10 编辑
(defun c:cxk0 ( / first lay name )
(vl-load-com)
(setq first t)
(while (setq lay (tblnext "layer" first))
(setq first nil)
(setq name (cdr (assoc 2 lay)))
(vla-put-lineweight (vlax-ename->vla-object (tblobjname "layer" name)) acLnWt000)
)
(princ)
)
(princ "\n命令是 CXK0 ")(princ)
;|线宽例子;;
acLnWtByLayer
acLnWtByBlock
acLnWtByLwDefault
acLnWt000
acLnWt005
acLnWt009
acLnWt013
acLnWt015
acLnWt018
acLnWt020
acLnWt025
acLnWt030
acLnWt035
acLnWt040
acLnWt050
acLnWt053
acLnWt060
acLnWt070
acLnWt080
acLnWt090
acLnWt100
acLnWt106
acLnWt120
acLnWt140
acLnWt158
acLnWt200
acLnWt211
|; public void SetAllLayerWidth()
{
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
using (Transaction tr = db.TransactionManager.StartOpenCloseTransaction())
{
try
{
//打开层表
LayerTable lt = (LayerTable)tr.GetObject(db.LayerTableId,OpenMode.ForWrite);
foreach (ObjectId id in lt)//遍历层表
{
//打开层表记录
LayerTableRecord ltr = (LayerTableRecord)tr.GetObject(id, OpenMode.ForWrite);
//设置图层线宽为0
ltr.LineWeight = 0;
ltr.DowngradeOpen();
}
lt.DowngradeOpen();
tr.Commit();
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
Application.ShowAlertDialog(ex.Message);
}
}
}
SurveyCAD 发表于 2016-6-9 22:25 static/image/common/back.gif
public void SetAllLayerWidth()
{
var doc = Application.DocumentManager.MdiActi ...
先谢谢阁下 请问如何使用? 有啥意义? ;;;成功返回 T
(defun c:tt (/ d r)
(mapcar
'(lambda (x / la)
(setq la (tblobjname "Layer" x))
(not (vla-put-lineweight (vlax-ename->vla-object la) 0.00))
)
(while (setq d (tblnext "Layer" (null d)))
(setq r (cons (cdr (assoc 2 d)) r))
)
)
) 图层线宽全部改到0 maiko 发表于 2016-6-12 22:20 static/image/common/back.gif
图层线宽全部改到0
一句话的事情居然收两个币。。。命令: -LAYER
当前图层:Q-DIM.
输入选项 [?/生成(M)/设置(S)/新建(N)/重命名(R)/开(ON)/关(OFF)/颜色(C)/线型(L)/线宽(LW)/透明度(TR)/材质(MAT)/打印(P)/冻结(F)/解冻(T)/锁定(LO)/解锁(U)/状态(A)/说明(D)/协调(E)]: LW
输入线宽 (0.0mm - 2.11mm): 0
输入图层名列表,这些图层使用线宽 0.00mm <Q-DIM.>: *
输入选项 [?/生成(M)/设置(S)/新建(N)/重命名(R)/开(ON)/关(OFF)/颜色(C)/线型(L)/线宽(LW)/透明度(TR)/材质(MAT)/打印(P)/冻结(F)/解冻(T)/锁定(LO)/解锁(U)(DEFUN C:00 ()
(setvar "cmdecho" 0)
(command "-layer" "LW" "0" "*" "")
(princ)
) ㄘ丶转裑ㄧ灬 发表于 2016-6-13 17:05 static/image/common/back.gif
一句话的事情居然收两个币。。。
收几个b是小事,我好不容易写出来.当然要收辛苦费了.况且我用的是纯vlisp写法,没用到COMMAND,愿者上钩....... maiko 发表于 2016-6-13 19:01 static/image/common/back.gif
收几个b是小事,我好不容易写出来.当然要收辛苦费了.况且我用的是纯vlisp写法,没用到COMMAND,愿者上 ...
好吧,我错了。。。
页:
[1]
2