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.
[已解決]lisp 圖層框選凍結問題 Ioaoe110[已解決]lisp 圖層框選凍結問題 2020-310[已解決]lisp 圖層框選凍結問題 Oiu15010[已解決]lisp 圖層框選凍結問題 2020-211[已解決]lisp 圖層框選凍結問題 Ia15010[已解決]lisp 圖層框選凍結問題 Aizyao10[已解決]lisp 圖層框選凍結問題 Uos15010[已解決]lisp 圖層框選凍結問題 BPl3tjj[已解決]lisp 圖層框選凍結問題 Ziao1510
[已解決]lisp 圖層框選凍結問題 Oo-2-110[已解決]lisp 圖層框選凍結問題 Zuoiy_10[已解決]lisp 圖層框選凍結問題 Aizyao11[已解決]lisp 圖層框選凍結問題 Iyb_1510[已解決]lisp 圖層框選凍結問題 Aoe1-111[已解決]lisp 圖層框選凍結問題 Uos15011[已解決]lisp 圖層框選凍結問題 Aoe2da10[已解決]lisp 圖層框選凍結問題 Aoe2da11[已解決]lisp 圖層框選凍結問題 Aoe10

[已解決]lisp 圖層框選凍結問題

4 posters

向下

[已解決]lisp 圖層框選凍結問題 Empty [已解決]lisp 圖層框選凍結問題

發表 由 adslwang 2011-07-13, 21:38

各路高手請問我利用chprop指令執行圖層凍結
我使用(setq en (entsel "\n 選取"))來搭配物件資料選取是可以凍結物件的...
可是當我使用ssget的方式如下來框選物件確發生了問題,我想我應該是缺少某一些要素,可是我想不出來,可是當我單純執行chprop確可以使用框選的方法來凍結圖層........
(setq en (ssget))
(command "-layer" "F" en "")

請問要怎麼解決這一個問題呢?


Tiger&蘋果爸 在 2011-07-18, 12:28 作了第 2 次修改
adslwang
adslwang
高級會員
高級會員

文章總數 : 376
年齡 : 45
來自 : 台南
職業 : 自由業
愛好 : 電腦、旅行
個性 : 樂觀
使用年資 : 1年
使用版本 : 2009
積分 : 17
經驗值 : 6994
威望值 : 356
回帖精華 : 1
注冊日期 : 2008-10-02
藍鵲88號
男 處女座 馬

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 pizg 2011-07-14, 13:33

(setq en (ssget))
(command "-layer" "F" en "")
無法正常執行應該是AutoCAD本身的問題!!

山不轉路轉, 建議你用下列方法:

(setq en (ssget))
;;從en中取得所有物件的圖層名稱作成清單, 例如 "0,圖層1,圖層2,圖層3"
(setq i 0)
(repeat (sslength en)
(setq layName (cdr (assoc 8 (entget (ssname sl i)))))
...
(setq i (1+ i))
)
(command "-layer" "f" 圖層清單 "")

另外你必須注意, 關閉或凍結目前層時AutoCAD會詢問「是否確定?」,
在程式中也必須把這個考慮進去才行!!

Tiger&蘋果爸 寫到:讚啦!! 謝謝熱心回覆~< 積分 +1>
[公告]關於團隊成員的回文及貢獻


Tiger&蘋果爸 在 2011-07-15, 16:16 作了第 1 次修改 (原因 : 非常專業喔~)
pizg
pizg
高級會員
高級會員

文章總數 : 258
年齡 : 59
來自 : 桃園縣
職業 : 建築設計;程式設計
愛好 : 音樂;攝影;繪畫;棋奕;電子;機器人
個性 : 隨和
使用年資 : 30↑
使用版本 : 2015
積分 : 10
經驗值 : 6480
威望值 : 320
發帖精華 : 1
注冊日期 : 2010-04-16
串連貼紙成功 男 摩羯座 龍

https://pizgchen.blogspot.com/

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 adslwang 2011-07-14, 23:23

前輩,我試一下再上來報告,我只怕我功力還沒有到那邊....
謝謝指導.....

感謝啦
adslwang
adslwang
高級會員
高級會員

文章總數 : 376
年齡 : 45
來自 : 台南
職業 : 自由業
愛好 : 電腦、旅行
個性 : 樂觀
使用年資 : 1年
使用版本 : 2009
積分 : 17
經驗值 : 6994
威望值 : 356
回帖精華 : 1
注冊日期 : 2008-10-02
藍鵲88號
男 處女座 馬

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 adslwang 2011-07-15, 21:33

還是超過我的能力範圍,畢竟我還是新手,我只能用前輩的東西改,還是解決不了,目前的狀況是可以框選到物件,且只能選到第一個物件能做凍,之後的就不能作凍,另外也嘗試使用ssadd代入可是也是失敗,是否可以請前輩再指點......
(defun c:ppoo()
(setq en (ssget)) (setq i 0) (repeat (sslength en)
(setq layName (cdr (assoc 8 (entget (ssname en i)))))
(setq i (1+ i)))
(command "-layer" "f" layname "") (princ))

以下是我參考其它例子再加入一些東西供參考目前我也只能做到這樣.....
當不再凍結圖層時只要按下sec便可。
(defun c:AFk()
(SETVAR "CMDECHO" 0)
(while t
(setq en (entsel "\n 選取凍結圖層"))
(cond((= en nil)(alert (strcat "\n 沒有選中物件,再選一次"))(prin1))
(t(setq endata (entget (car en)))
(setq dd (assoc 8 endata))(setq dd2 (cdr dd))(command "-layer" "F" dd2 "")
(princ "\n 凍結單一圖層,這一個圖層名是[ ") (princ dd2) (princ " ]"))
(prin1))))

我在練基本功,希望可以找到真正的解答......我有點睏了 悶啊
adslwang
adslwang
高級會員
高級會員

文章總數 : 376
年齡 : 45
來自 : 台南
職業 : 自由業
愛好 : 電腦、旅行
個性 : 樂觀
使用年資 : 1年
使用版本 : 2009
積分 : 17
經驗值 : 6994
威望值 : 356
回帖精華 : 1
注冊日期 : 2008-10-02
藍鵲88號
男 處女座 馬

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 pizg 2011-07-16, 08:38

雖然你的程式有點小瑕疵,但基本上程式已可以運作,我將你的程式稍作修改如下:
(defun c:AFk()
(SETVAR "CMDECHO" 0)
(while t
(setq en (entsel "\n 選取凍結圖層"))
(cond
((= en nil)
(alert (strcat "\n 沒有選中物件,再選一次"))
)
(t
(setq endata (entget (car en)))
(setq dd (assoc 8 endata))
(setq dd2 (cdr dd))
(command "-layer" "F" dd2 "")
(princ "\n 凍結單一圖層,這一個圖層名是[ ") (princ dd2) (princ " ]")
)
)
)
(prin1)
)

這裏要提醒你一點,如果要讓使用者按下鍵才能結束程式的運作,則最好要做「錯誤處置(*error)」,細節請參考AutoLISP說明文件。

pizg
pizg
高級會員
高級會員

文章總數 : 258
年齡 : 59
來自 : 桃園縣
職業 : 建築設計;程式設計
愛好 : 音樂;攝影;繪畫;棋奕;電子;機器人
個性 : 隨和
使用年資 : 30↑
使用版本 : 2015
積分 : 10
經驗值 : 6480
威望值 : 320
發帖精華 : 1
注冊日期 : 2010-04-16
串連貼紙成功 男 摩羯座 龍

https://pizgchen.blogspot.com/

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 adslwang 2011-07-16, 08:54

前輩,我可以再問你一下嗎
http://autocad.bestoforum.net/t6619-topic

(while (/= (getvar "ERRNO") 52)
(command "_dimlinear" pause pause pause)
)
while 後面 那一排紅色的東西指的是什麼 我有去查它的變數 可是變數沒有值 52? 而且 /=的關系我稿不太懂,可以指點一下嘛
adslwang
adslwang
高級會員
高級會員

文章總數 : 376
年齡 : 45
來自 : 台南
職業 : 自由業
愛好 : 電腦、旅行
個性 : 樂觀
使用年資 : 1年
使用版本 : 2009
積分 : 17
經驗值 : 6994
威望值 : 356
回帖精華 : 1
注冊日期 : 2008-10-02
藍鵲88號
男 處女座 馬

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 pizg 2011-07-16, 09:03

ERROR CODE=52 表沒有選到物件(Entity selection: null response)
這 (/= (getvar "ERRNO") 52) 表有選到物件

不過個人覺得程式這樣寫並不是很妥當
>>>
(while (/= (getvar "ERRNO") 52)
(command "_dimlinear" pause pause pause)
)
因為ERRNO有可能是其它值, 不一定是52

Value
Meaning

代碼:
0
 No error
 
1
 Invalid symbol table name
 
2
 Invalid entity or selection set name
 
3
 Exceeded maximum number of selection sets
 
4
 Invalid selection set
 
5
 Improper use of block definition
 
6
 Improper use of xref
 
7
 Object selection: pick failed
 
8
 End of entity file
 
9
 End of block definition file
 
10
 Failed to find last entity
 
11
 Illegal attempt to delete viewport object
 
12
 Operation not allowed during PLINE
 
13
 Invalid handle
 
14
 Handles not enabled
 
15
 Invalid arguments in coordinate transform request
 
16
 Invalid space in coordinate transform request
 
17
 Invalid use of deleted entity
 
18
 Invalid table name
 
19
 Invalid table function argument
 
20
 Attempt to set a read-only variable
 
21
 Zero value not allowed
 
22
 Value out of range
 
23
 Complex REGEN in progress
 
24
 Attempt to change entity type
 
25
 Bad layer name
 
26
 Bad linetype name
 
27
 Bad color name
 
28
 Bad text style name
 
29
 Bad shape name
 
30
 Bad field for entity type
 
31
 Attempt to modify deleted entity
 
32
 Attempt to modify seqend subentity
 
33
 Attempt to change handle
 
34
 Attempt to modify viewport visibility
 
35
 Entity on locked layer
 
36
 Bad entity type
 
37
 Bad polyline entity
 
38
 Incomplete complex entity in block
 
39
 Invalid block name field
 
40
 Duplicate block flag fields
 
41
 Duplicate block name fields
 
42
 Bad normal vector
 
43
 Missing block name
 
44
 Missing block flags
 
45
 Invalid anonymous block
 
46
 Invalid block definition
 
47
 Mandatory field missing
 
48
 Unrecognized extended data (XDATA) type
 
49
 Improper nesting of list in XDATA
 
50
 Improper location of APPID field
 
51
 Exceeded maximum XDATA size
 
52
 Entity selection: null response
 
53
 Duplicate APPID
 
54
 Attempt to make or modify viewport entity
 
55
 Attempt to make or modify an xref, xdef, or xdep
 
56
 ssget filter: unexpected end of list
 
57
 ssget filter: missing test operand
 
58
 ssget filter: invalid opcode (-4) string
 
59
 ssget filter: improper nesting or empty conditional clause
 
60
 ssget filter: mismatched begin and end of conditional clause
 
61
 ssget filter: wrong number of arguments in conditional clause (for NOT or XOR)
 
62
 ssget filter: exceeded maximum nesting limit
 
63
 ssget filter: invalid group code
 
64
 ssget filter: invalid string test
 
65
 ssget filter: invalid vector test
 
66
 ssget filter: invalid real test
 
67
 ssget filter: invalid integer test
 
68
 Digitizer is not a tablet
 
69
 Tablet is not calibrated
 
70
 Invalid tablet arguments
 
71
 ADS error: Unable to allocate new result buffer
 
72
 ADS error: Null pointer detected
 
73
 Cannot open executable file
 
74
 Application is already loaded
 
75
 Maximum number of applications already loaded
 
76
 Unable to execute application
 
77
 Incompatible version number
 
78
 Unable to unload nested application
 
79
 Application refused to unload
 
80
 Application is not currently loaded
 
81
 Not enough memory to load application
 
82
 ADS error: Invalid transformation matrix
 
83
 ADS error: Invalid symbol name
 
84
 ADS error: Invalid symbol value
 
85
 AutoLISP/ADS operation prohibited while a dialog box was displayed
 


pizg 在 2011-07-16, 21:55 作了第 1 次修改
pizg
pizg
高級會員
高級會員

文章總數 : 258
年齡 : 59
來自 : 桃園縣
職業 : 建築設計;程式設計
愛好 : 音樂;攝影;繪畫;棋奕;電子;機器人
個性 : 隨和
使用年資 : 30↑
使用版本 : 2015
積分 : 10
經驗值 : 6480
威望值 : 320
發帖精華 : 1
注冊日期 : 2010-04-16
串連貼紙成功 男 摩羯座 龍

https://pizgchen.blogspot.com/

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 Tiger&蘋果爸 2011-07-16, 11:51

pizg 寫到:ERROR CODE=52 表沒有選到物件(Entity selection: null response)
這 (/= (getvar "ERRNO") 52) 表有選到物件
Spoiler(用來隱藏帖子內容):

學習了~
真的是獲益良多~
感謝pizg分享說明!
竊喜

____________________________________________________________________________________
👉[好康]🎁加入專屬B取得大補帖及看2D+3D影片(點我)👈
[已解決]lisp 圖層框選凍結問題 Sesa2011 [已解決]lisp 圖層框選凍結問題 Youtub11 [已解決]lisp 圖層框選凍結問題 Oiea2011 [已解決]lisp 圖層框選凍結問題 Oe20011 [已解決]lisp 圖層框選凍結問題 Fbi20011 [已解決]lisp 圖層框選凍結問題 Line2011
Tiger&蘋果爸
Tiger&蘋果爸
系統管理員
系統管理員

文章總數 : 21110
年齡 : 48
來自 : 台北市文山區
職業 : AutoCAD顧問
愛好 : 蹓狗/戶外活動/拍照/吸貓
個性 : 幽默/樂觀/善良
使用年資 : 20↑
使用版本 : AutoCAD 2022
經驗值 : 88626
威望值 : 16958
注冊日期 : 2008-04-23
2D基礎函授 2D進階函授 3D基礎函授 https://i.servimg.com/u/f11/19/71/67/71/2d3d10.png2D+3D線上 顧問外掛程式 經典問與答讀者 藍鵲1號
2009聚會勳章 2010聚會勳章 2011聚會勳章 2012聚會勳章 2013勳章-2D基礎 2014聚會勳章 2015聚會勳章 2016聚會勳章 串連貼紙成功 男 水瓶座 兔

http://mypaper.pchome.com.tw/kv1012tiger

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 adslwang 2011-07-16, 14:22

前輩,謝謝您的幫忙
真是受益良多,這一些我在我的書本上找不到的可貴知識.....
我轉
adslwang
adslwang
高級會員
高級會員

文章總數 : 376
年齡 : 45
來自 : 台南
職業 : 自由業
愛好 : 電腦、旅行
個性 : 樂觀
使用年資 : 1年
使用版本 : 2009
積分 : 17
經驗值 : 6994
威望值 : 356
回帖精華 : 1
注冊日期 : 2008-10-02
藍鵲88號
男 處女座 馬

回頂端 向下

[已解決]lisp 圖層框選凍結問題 Empty 回復: [已解決]lisp 圖層框選凍結問題

發表 由 ginse0727 2011-07-16, 18:16

我也是,從這個問題中也學到了前輩很多可貴的經驗,感恩!竊喜

____________________________________________________________________________________
[已解決]lisp 圖層框選凍結問題 Ioaoe110 [已解決]lisp 圖層框選凍結問題 Zuoiy_10 [已解決]lisp 圖層框選凍結問題 2020-211 [已解決]lisp 圖層框選凍結問題 Aizyao11 [已解決]lisp 圖層框選凍結問題 Iyb_1510
[已解決]lisp 圖層框選凍結問題 Aizyao10 [已解決]lisp 圖層框選凍結問題 BPl3tjj.png [已解決]lisp 圖層框選凍結問題 Ziao1510 [已解決]lisp 圖層框選凍結問題 Oo-2-110 [已解決]lisp 圖層框選凍結問題 Oooa_110
ginse0727
ginse0727
高級會員
高級會員

文章總數 : 256
年齡 : 49
來自 : 台北巿
職業 : 帷幕牆
愛好 : 電玩,漫畫,網路小說
個性 : 宅男/正直/死腦筋
使用年資 : 退伍後工作迄今,10年以上
使用版本 : 2012
積分 : 14
經驗值 : 6612
威望值 : 500
發帖精華 : 1
注冊日期 : 2010-07-13
經典問與答讀者 藍鵲61號
2011聚會勳章 男 獅子座 虎

回頂端 向下

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章
[已解決]lisp 圖層框選凍結問題 Ioaoe110[已解決]lisp 圖層框選凍結問題 2020-310[已解決]lisp 圖層框選凍結問題 Oiu15010[已解決]lisp 圖層框選凍結問題 2020-211[已解決]lisp 圖層框選凍結問題 Ia15010[已解決]lisp 圖層框選凍結問題 Aizyao10[已解決]lisp 圖層框選凍結問題 Uos15010[已解決]lisp 圖層框選凍結問題 BPl3tjj[已解決]lisp 圖層框選凍結問題 Ziao1510
[已解決]lisp 圖層框選凍結問題 Oo-2-110[已解決]lisp 圖層框選凍結問題 Zuoiy_10[已解決]lisp 圖層框選凍結問題 Aizyao11[已解決]lisp 圖層框選凍結問題 Iyb_1510[已解決]lisp 圖層框選凍結問題 Aoe1-111[已解決]lisp 圖層框選凍結問題 Uos15011[已解決]lisp 圖層框選凍結問題 Aoe2da10[已解決]lisp 圖層框選凍結問題 Aoe2da11[已解決]lisp 圖層框選凍結問題 Aoe10