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.
[發問]SSGET 相關問題 Ioaoe110[發問]SSGET 相關問題 2020-310[發問]SSGET 相關問題 Oiu15010[發問]SSGET 相關問題 2020-211[發問]SSGET 相關問題 Ia15010[發問]SSGET 相關問題 Aizyao10[發問]SSGET 相關問題 Uos15010[發問]SSGET 相關問題 BPl3tjj[發問]SSGET 相關問題 Ziao1510
[發問]SSGET 相關問題 Oo-2-110[發問]SSGET 相關問題 Zuoiy_10[發問]SSGET 相關問題 Aizyao11[發問]SSGET 相關問題 Iyb_1510[發問]SSGET 相關問題 Aoe1-111[發問]SSGET 相關問題 Uos15011[發問]SSGET 相關問題 Aoe2da10[發問]SSGET 相關問題 Aoe2da11[發問]SSGET 相關問題 Aoe10

[發問]SSGET 相關問題

2 posters

向下

[發問]SSGET 相關問題 Empty [發問]SSGET 相關問題

發表 由 as920029as 周二 13 4月 - 7:04

我是會一點點lsi的程式菜雞 來問版上大大一些問題
下面是我的程式 想修改 卻摸不著頭緒 也不太會用ssget
下面程式簡單說 點取一點 然後輸入我要的內容 在那點產生一個單行文字
然後在點擊產生出來的文字 讓他改變旋轉角度跟斜度 有1~6模式
我想把程式改良成 直接用 (ssget "L") 之類的方式 直接讀取到我要的資料
省去(setq en2 (entsel "文字")) 還需要去點擊那個文字的時間
但我用(setq en2 (entsel (ssget "L")))  行不通 是否有其他手段 還是我的方式錯誤?


(defun c:CC1()
(setvar "cmdecho" 0)
(SETQ RR1 (getpoint "起點"))
(SETQ RR11(getstring "內容"))
(command "TEXT" RR1 "2" "" RR11)
(SETQ INTXT2 (GETSTRING "(1)(2)(3)(4)(5)(6)"))

(if (= INTXT2 "1")
(progn
(setq en2 (entsel "文字"))
(setq en2_data (entget (car en2)))
(setq en2_txt (cdr (assoc 50 en2_data)))
(setq newt (cons 50 en2_txt))
(setq old 5.75959)
(setq oldt  (cons 50 old))
(setq en2_data (subst oldt newt en2_data))
(entmod en2_data)

(setq en3_data (entget (car en2)))
(setq en3_txt (cdr (assoc 51 en2_data)))
(setq newt3 (cons 51 en3_txt))
(setq old3 0.523599)
(setq oldt3  (cons 51 old3))
(setq en3_data (subst oldt3 newt3 en3_data))
(entmod en3_data)
)
)


(if (= INTXT2 "2")
(progn
(setq en2 (entsel "文字"))
(setq en2_data (entget (car en2)))
(setq en2_txt (cdr (assoc 50 en2_data)))
(setq newt (cons 50 en2_txt))
(setq old 0.523599)
(setq oldt  (cons 50 old))
(setq en2_data (subst oldt newt en2_data))
(entmod en2_data)

(setq en3_data (entget (car en2)))
(setq en3_txt (cdr (assoc 51 en2_data)))
(setq newt3 (cons 51 en3_txt))
(setq old3 5.75959)
(setq oldt3  (cons 51 old3))
(setq en3_data (subst oldt3 newt3 en3_data))
(entmod en3_data)
)
)

(if (= INTXT2 "3")
(progn
(setq en2 (entsel "文字"))
(setq en2_data (entget (car en2)))
(setq en2_txt (cdr (assoc 50 en2_data)))
(setq newt (cons 50 en2_txt))
(setq old 5.75959)
(setq oldt  (cons 50 old))
(setq en2_data (subst oldt newt en2_data))
(entmod en2_data)

(setq en3_data (entget (car en2)))
(setq en3_txt (cdr (assoc 51 en2_data)))
(setq newt3 (cons 51 en3_txt))
(setq old3 5.75959)
(setq oldt3  (cons 51 old3))
(setq en3_data (subst oldt3 newt3 en3_data))
(entmod en3_data)
)
)

(if (= INTXT2 "4")
(progn
(setq en2 (entsel "文字"))
(setq en2_data (entget (car en2)))
(setq en2_txt (cdr (assoc 50 en2_data)))
(setq newt (cons 50 en2_txt))
(setq old 0.523599)
(setq oldt  (cons 50 old))
(setq en2_data (subst oldt newt en2_data))
(entmod en2_data)

(setq en3_data (entget (car en2)))
(setq en3_txt (cdr (assoc 51 en2_data)))
(setq newt3 (cons 51 en3_txt))
(setq old3 0.523599)
(setq oldt3  (cons 51 old3))
(setq en3_data (subst oldt3 newt3 en3_data))
(entmod en3_data)
)
)

(if (= INTXT2 "5")
(progn
(setq en2 (entsel "文字"))
(setq en2_data (entget (car en2)))
(setq en2_txt (cdr (assoc 50 en2_data)))
(setq newt (cons 50 en2_txt))
(setq old 1.5708)
(setq oldt  (cons 50 old))
(setq en2_data (subst oldt newt en2_data))
(entmod en2_data)

(setq en3_data (entget (car en2)))
(setq en3_txt (cdr (assoc 51 en2_data)))
(setq newt3 (cons 51 en3_txt))
(setq old3 0.523599)
(setq oldt3  (cons 51 old3))
(setq en3_data (subst oldt3 newt3 en3_data))
(entmod en3_data)
)
)

(if (= INTXT2 "6")
(progn
(setq en2 (entsel "文字"))
(setq en2_data (entget (car en2)))
(setq en2_txt (cdr (assoc 50 en2_data)))
(setq newt (cons 50 en2_txt))
(setq old 1.5708)
(setq oldt  (cons 50 old))
(setq en2_data (subst oldt newt en2_data))
(entmod en2_data)

(setq en3_data (entget (car en2)))
(setq en3_txt (cdr (assoc 51 en2_data)))
(setq newt3 (cons 51 en3_txt))
(setq old3 5.75959)
(setq oldt3  (cons 51 old3))
(setq en3_data (subst oldt3 newt3 en3_data))
(entmod en3_data)
)
)
(prin1)
)
as920029as
as920029as
一般會員
一般會員

文章總數 : 110
年齡 : 33
來自 : 台南市
職業 : 繪圖員
愛好 : 電腦遊戲
個性 : 開朗
使用年資 : 3年
使用版本 : 2010
經驗值 : 5016
威望值 : 47
注冊日期 : 2012-05-05
男 白羊座 羊

回頂端 向下

[發問]SSGET 相關問題 Empty 回復: [發問]SSGET 相關問題

發表 由 naruto018 周三 14 4月 - 3:26

as920029as 寫到:
我想把程式改良成 直接用 (ssget "L") 之類的方式 直接讀取到我要的資料
省去(setq en2 (entsel "文字")) 還需要去點擊那個文字的時間
但我用(setq en2 (entsel (ssget "L")))  行不通 是否有其他手段 還是我的方式錯誤?

將(setq en2 (entsel "文字"))
改成(setq en2 (ssname (ssget "L") 0))
因為ssget得到的是選擇集,並非物件
需要用ssname 從選擇集取出物件
另外entsel 也不能這樣用
下一行(setq en2_data (entget (car en2)))
要改成(setq en2_data (entget en2))
naruto018
naruto018
中級會員
中級會員

文章總數 : 207
年齡 : 32
來自 : 高雄
職業 : 學習中(CAD,Revit,Excel VBA)
愛好 : 當個懶熊
個性 : 內向
使用年資 : 新手
使用版本 : 2015
AutoCAD基礎篇等級 : 10星級
積分 : 5
經驗值 : 4233
威望值 : 558
注冊日期 : 2016-11-29
藍鵲726號
男 摩羯座 羊

Tiger&蘋果爸 likes this post

回頂端 向下

[發問]SSGET 相關問題 Empty 回復: [發問]SSGET 相關問題

發表 由 as920029as 周三 14 4月 - 4:58

naruto018 寫到:
as920029as 寫到:
我想把程式改良成 直接用 (ssget "L") 之類的方式 直接讀取到我要的資料
省去(setq en2 (entsel "文字")) 還需要去點擊那個文字的時間
但我用(setq en2 (entsel (ssget "L")))  行不通 是否有其他手段 還是我的方式錯誤?

將(setq en2 (entsel "文字"))
改成(setq en2 (ssname (ssget "L") 0))
因為ssget得到的是選擇集,並非物件
需要用ssname 從選擇集取出物件
另外entsel 也不能這樣用
下一行(setq en2_data (entget (car en2)))
要改成(setq en2_data (entget en2))
原來如此 感謝大大 完美解決了我的問題
as920029as
as920029as
一般會員
一般會員

文章總數 : 110
年齡 : 33
來自 : 台南市
職業 : 繪圖員
愛好 : 電腦遊戲
個性 : 開朗
使用年資 : 3年
使用版本 : 2010
經驗值 : 5016
威望值 : 47
注冊日期 : 2012-05-05
男 白羊座 羊

回頂端 向下

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章
[發問]SSGET 相關問題 Ioaoe110[發問]SSGET 相關問題 2020-310[發問]SSGET 相關問題 Oiu15010[發問]SSGET 相關問題 2020-211[發問]SSGET 相關問題 Ia15010[發問]SSGET 相關問題 Aizyao10[發問]SSGET 相關問題 Uos15010[發問]SSGET 相關問題 BPl3tjj[發問]SSGET 相關問題 Ziao1510
[發問]SSGET 相關問題 Oo-2-110[發問]SSGET 相關問題 Zuoiy_10[發問]SSGET 相關問題 Aizyao11[發問]SSGET 相關問題 Iyb_1510[發問]SSGET 相關問題 Aoe1-111[發問]SSGET 相關問題 Uos15011[發問]SSGET 相關問題 Aoe2da10[發問]SSGET 相關問題 Aoe2da11[發問]SSGET 相關問題 Aoe10