如何不炸开块情况下修改改块内线形改为随块,线形比例改为100?(已经解决))
本帖最后由 9701519 于 2024-11-4 18:34 编辑如何不炸开块情况下修改改块内线形改为随块,线形比例改为100?
(Defun c:tt (/ BLK)
(and
(setq blk (car (entsel "\n Pick Block <exit>:")))
(setq blk (vlax-ename->vla-object blk))
(vlax-property-available-p blk "effectivename")
(= (vlax-for vlo
(vla-item
(vla-get-blocks
(vla-get-activeDocument (vlax-get-acad-object))
)
(vla-get-effectivename blk)
)
(vla-put-Linetype vlo "ByBlock")
(vla-put-LinetypeScale vlo 100.)
(vla-put-Lineweight vlo acLnWtByBlock)
(vla-put-Color vlo 0)
(vla-put-Layer vlo "0")
)
(vla-update blk)
)
)
)
本帖最后由 kozmosovia 于 2024-11-4 14:08 编辑
代码搞复杂了
(Defun c:tt (/ BLK)
(and
(setq blk (car (entsel "\n Pick Block <exit>:")))
(setq blk (vlax-ename->vla-object blk))
(vlax-property-available-p blk "effectivename")
(= (vlax-for vlo
(vla-item
(vla-get-blocks
(vla-get-activeDocument (vlax-get-acad-object))
)
(vla-get-effectivename blk)
)
(vla-put-Linetype vlo "ByBlock")
(vla-put-LinetypeScale vlo 100.)
(vla-put-Lineweight vlo "byblock")
(vla-put-Color vlo 0)
(vla-put-Layer vlo "0")
)
(vla-update blk)
)
)
)
(DEFUN C:TT(/ e *BLCOKS e);;修改所有块内所有对象线型为随块、线型比例100
(vl-load-com)
(setq *blocks(vlax-get-property(vlax-get-property(vlax-get-acad-object)'activedocument)'blocks))
(while(setq e(TblNext "BLOCK"(not e)))
(tt(cdadr e)"byblock" 100))
)
(defun tt(blkname ltpname ltpscale / blk o i);;修改指定块名内所有对象线型、线型比例
(setq blk(vlax-invoke-method *blocks 'item blkname)
i -1)
(repeat(vlax-get-property blk 'count)
(setq i(1+ i)o(vlax-invoke-method blk 'item i))
(vlax-put-property o 'Linetype ltpname)
(vlax-put-property o 'LinetypeScale ltpscale))) kozmosovia 发表于 2024-11-4 12:50
遍历块定义改
在不炸开块的情况下实现以下功能(defun C:tt( )
(setq se1(ssget))
(vl-cmdf "_change" "si" se1 "p" "lt" "byblock" "")
(vl-cmdf "_change" "si" se1 "p" "s" "1" "")
(vl-cmdf "_chprop" se1 "" "la" "0" "C" "byblock" "LW" "byblock" "")
)
遍历块定义改 llsheng_73 发表于 2024-11-4 13:35
如何再加上以下功能:
1.框选选择需要修改的块
2.全部改0层,
3.颜色随块,
4.线宽随块, kozmosovia 发表于 2024-11-4 14:04
代码搞复杂了
命令执行有点问题:
Pick Block <exit>:; 错误: 此类型的 LISP 值不能强制转换成 VARIANT:"byblock" 看这个。
http://bbs.mjtd.com/thread-59143-1-1.html panliang9 发表于 2024-11-4 14:42
看这个。
http://bbs.mjtd.com/thread-59143-1-1.html
为什么块会变大 改线型比例用这个:
http://bbs.mjtd.com/thread-186469-1-1.html
还有发例图才知道为什么块会变大。
页:
[1]
2