AutoCAD顧問
還沒有註冊嗎...即日起免費註冊,所有最完整的AutoCAD討論、教學及資源都在論壇裡喔~

Join the forum, it's quick and easy

AutoCAD顧問
還沒有註冊嗎...即日起免費註冊,所有最完整的AutoCAD討論、教學及資源都在論壇裡喔~
AutoCAD顧問
Would you like to react to this message? Create an account in a few clicks or log in to continue.
標註複線的scale比例 Ioaoe110標註複線的scale比例 2020-310標註複線的scale比例 Oiu15010標註複線的scale比例 2020-211標註複線的scale比例 Ia15010標註複線的scale比例 Aizyao10標註複線的scale比例 Uos15010標註複線的scale比例 BPl3tjj標註複線的scale比例 Ziao1510
標註複線的scale比例 Oo-2-110標註複線的scale比例 Zuoiy_10標註複線的scale比例 Aizyao11標註複線的scale比例 Iyb_1510標註複線的scale比例 Aoe1-111標註複線的scale比例 Uos15011標註複線的scale比例 Aoe2da10標註複線的scale比例 Aoe2da11標註複線的scale比例 Aoe10

標註複線的scale比例

3 posters

向下

標註複線的scale比例 Empty 標註複線的scale比例

發表 由 dog46 2021-10-26, 09:03

想請問版上的高手,我想要有自動標註複線比例的功能,目前code(下方)只能單一選取一個複線,我想要能夠選取多個複線,參考之前用的快速標記的code,應該可以用
(setq dpss (ssget "_:L" '((0 . "*MLINE"))))  這行達到,可是其他部分不太清楚要怎麼修改。想請大家幫忙把code更改成能夠選取多個複線嗎?

(defun c:mldim ( / olsnap dic obj xyz mlsty mlsc pt1 pt2 ang mp mp2 ent dic dict tot)

(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)

(setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))

(setq obj (vlax-ename->vla-object (car (entsel "\nSelect mline"))))
(setq xyz (vlax-get obj 'Coordinates))
(setq mlsty (vlax-get obj 'StyleName))
(setq mlsc (vlax-get obj 'MLineScale))

(setq pt1 (list (nth 0 xyz)(nth 1 xyz)))
(setq pt2 (list (nth 3 xyz)(nth 4 xyz)))
(setq ang (- (angle pt1 pt2)(/ pi 2.0)))
(setq mp (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5)))


(setq dict (dictsearch (setq dic (cdr (assoc -1 dic))) mlsty ))
(setq tot 0.0)
(foreach ent dict
(if (= (car ent) 49)
(setq tot (+ tot (abs (cdr ent))))
)
)
(setq tot (* mlsc tot))

(setq mp2 (polar mp ang tot))

(command "dimaligned" mp mp2 mp)

(princ)
)

(c:mldim)
dog46
dog46
一般會員
一般會員

文章總數 : 6
年齡 : 28
來自 : 台中市
職業 : 土木
愛好 : 美食遊戲
個性 : 普通
使用年資 : 1
使用版本 : 2019
經驗值 : 954
威望值 : 0
注冊日期 : 2021-10-21
男 白羊座 鼠

回頂端 向下

標註複線的scale比例 Empty [問題]請問複線標註如何鎖定兩條線的中點?對正方式分為底部,頂部,零等位置

發表 由 Cher 2023-10-29, 18:03

dog46 寫到:想請問版上的高手,我想要有自動標註複線比例的功能,目前code(下方)只能單一選取一個複線,我想要能夠選取多個複線,參考之前用的快速標記的code,應該可以用
(setq dpss (ssget "_:L" '((0 . "*MLINE"))))  這行達到,可是其他部分不太清楚要怎麼修改。想請大家幫忙把code更改成能夠選取多個複線嗎?

(defun c:mldim ( / olsnap dic obj xyz mlsty mlsc pt1 pt2 ang mp mp2 ent dic dict tot)

(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)

(setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))

(setq obj (vlax-ename->vla-object (car (entsel "\nSelect mline"))))
(setq xyz (vlax-get obj 'Coordinates))
(setq mlsty (vlax-get obj 'StyleName))
(setq mlsc (vlax-get obj 'MLineScale))

(setq pt1 (list (nth 0 xyz)(nth 1 xyz)))
(setq pt2 (list (nth 3 xyz)(nth 4 xyz)))
(setq ang (- (angle pt1 pt2)(/ pi 2.0)))
(setq mp (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5)))


(setq dict (dictsearch (setq dic (cdr (assoc -1 dic))) mlsty ))
(setq tot 0.0)
(foreach ent dict
(if (= (car ent) 49)
(setq tot (+ tot (abs (cdr ent))))
)
)
(setq tot (* mlsc tot))

(setq mp2 (polar mp ang tot))

(command "dimaligned" mp mp2 mp)

(princ)
)

(c:mldim)




TO Dog46:
程式很好用,可惜的是位置偏位了,請問後來有對正到的標註的比例寬度嗎?想請教一下複線標註如何鎖定兩條線的中點?對正方式分為底部,頂部,零等位置.還有我想知道快速選取多個複線.謝謝! 頭暈目眩  頭暈目眩


附圖
附件
標註複線的scale比例 Attachment
標註複線比例寬度 (1).png 您無權下載這里的附件。(7 Kb) 下載 6 次
Cher
Cher
專屬會員
專屬會員

文章總數 : 98
年齡 : 46
來自 : 新竹
職業 : 建築工程
愛好 : 畫畫
個性 : 沈默寡言
使用年資 : 新手初學
使用版本 : Auto CAD 2022
經驗值 : 1050
威望值 : 24
注冊日期 : 2022-11-04
女 天蝎座 蛇

回頂端 向下

標註複線的scale比例 Empty 回復: 標註複線的scale比例

發表 由 masao_8 2023-11-04, 15:28

有其他想增加的再自行修改

代碼:
(defun c:mldim ( / olsnap dic dpss i ssn obj xyz mlsty mlsc pt1 pt2 ang mp mp2 ent dic dict tot)

(vl-load-com)

(setq oldsnap (getvar 'osmode))

(setvar 'osmode 0)

(vl-cmdf "_.ucs" "_world")

(princ "\n->Select mline:")

(setq dpss (ssget "_:S" '((0 . "*MLINE"))))

(while (null dpss)

(princ "\n->Select mline:")

(setq dpss (ssget "_:S" '((0 . "*MLINE"))))

)

(setq i 0)

(repeat (sslength dpss)

(setq ssn (ssname dpss i))

(setq obj (vlax-ename->vla-object ssn))
(setq xyz (vlax-get obj 'Coordinates))
(setq mlsty (vlax-get obj 'StyleName))
(setq mlsc (vlax-get obj 'MLineScale))

(setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))

(setq pt1 (list (nth 0 xyz)(nth 1 xyz)))
(setq pt2 (list (nth 3 xyz)(nth 4 xyz)))
(setq ang (- (angle pt1 pt2)(/ pi 2.0)))
(setq mp (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5)))


(setq dict (dictsearch (setq dic (cdr (assoc -1 dic))) mlsty ))
(setq tot 0.0)
(foreach ent dict
(if (= (car ent) 49)
(setq tot (+ tot (abs (cdr ent))))
)
)
(setq tot (* mlsc tot))

(setq mp2 (polar mp ang tot))

(vl-cmdf "dimaligned" mp mp2 mp)

(setq i (1+ i))

)

(vl-cmdf "_.ucs" "_p")

(princ)
)
masao_8
masao_8
一般會員
一般會員

文章總數 : 46
年齡 : 31
來自 : 台中
職業 : 製圖
愛好 : 動漫
個性 : 內向
使用年資 : 4年
使用版本 : 2012
經驗值 : 1012
威望值 : 84
注冊日期 : 2022-06-03
男 水瓶座 雞

回頂端 向下

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章
標註複線的scale比例 Ioaoe110標註複線的scale比例 2020-310標註複線的scale比例 Oiu15010標註複線的scale比例 2020-211標註複線的scale比例 Ia15010標註複線的scale比例 Aizyao10標註複線的scale比例 Uos15010標註複線的scale比例 BPl3tjj標註複線的scale比例 Ziao1510
標註複線的scale比例 Oo-2-110標註複線的scale比例 Zuoiy_10標註複線的scale比例 Aizyao11標註複線的scale比例 Iyb_1510標註複線的scale比例 Aoe1-111標註複線的scale比例 Uos15011標註複線的scale比例 Aoe2da10標註複線的scale比例 Aoe2da11標註複線的scale比例 Aoe10