View Full Version : Another alert problem
youngsoo
2007-10-12, 06:29 AM
I was born in keochang.
My name is Kim Youngsoo.
I am an electrical engineer.
http://youngsoo.keochang.net/8xmas/8xmas5.htm
I wanted object to move.
But, object was not moved.
I'm surprised.
I saw prompt.
"1 was on a locked layer" dispalyed message.
My request is simple.
Could you display message in alert dialog box.
I'd like to use sub function of move,copy,erase command.
rajat_bapi_mallick
2007-10-12, 06:42 AM
I was born in keochang.
My name is Kim Youngsoo.
I am an electrical engineer.
http://youngsoo.keochang.net/8xmas/8xmas5.htm
I wanted object to move.
But, object was not moved.
I'm surprised.
I saw prompt.
"1 was on a locked layer" dispalyed message.
My request is simple.
Could you display message in alert dialog box.
I'd like to use sub function of move,copy,erase command.
I was born in Kolkata, India.
My name is Rajat Mallick
I am a Mechanical Engineer.
www.silicondesigns-my.com (http://www.silicondesigns-my.com)
Please unlock the layer before moveing/ coping / erasing an object.
I can display message in alert dialog box.
(alert "1 was on a locked layer")
RobertB
2007-10-12, 07:02 PM
I wanted object to move.
But, object was not moved.
I'm surprised.
I saw prompt.
"1 was on a locked layer" dispalyed message.
My request is simple.
Could you display message in alert dialog box.
I'd like to use sub function of move,copy,erase command.That alert will drive you crazy after a while. If you are using a recent version of AutoCAD, why not enable locked layer fading? Or configure preselect ghosting to honor objects on locked layers?
RobertB
2007-10-15, 05:31 PM
You might as well just unlock all layers. Why have them locked if you are always unlocking them?
youngsoo
2007-12-27, 05:11 AM
I'd like cad to show me alert message.
Is this possible? Please help.
rkmcswain
2007-12-27, 06:43 PM
Use the alert function.
Based on the command line in his second screen shot, he has already mastered the (alert) function. :)
Not sure how my post got dated earlier than Opie's. His is dated 12:04PM and it's only 11:42 right now....
Is this possible? Please help.
Use the alert function.
rkmcswain
2007-12-28, 12:31 AM
Isn't this a repeat of this thread?
Did this answer not work for you?
Here it is again
(alert (strcat "\noff=>" xx " \nfrozen=>" yy "\nlocked=>" zz))
youngsoo
2007-12-28, 05:24 AM
For example,
I'd like cad to show me alert message.
(defun c:LayerLock(/ ename lyr)
(setq ename (car (entsel "( Select objects: )")))
(if ename (progn (setq lyr (cdr (assoc 8 (entget ename))))
(command "-layer" "set" lyr "")
(command "-layer" "lo" lyr "" ) )
)
(if lyr
(progn
(alert (strcat "\"" lyr "\"" " Locked Layer "))
(prompt (strcat "\n\t Current Layer [" lyr "] is Locked "))
)
)
(prin1))
rkmcswain
2007-12-28, 02:40 PM
What are you trying to do with the function (offfrozenlockedlayerlist)?
Currently, it checks to see if there are any layers that are off, frozen or locked, and if so it displays the first layer in the list for each of these categories in an alert dialog.
If there are no layers that are off, frozen or locked, then it displays a similar prompt at the command line (as opposed to an alert dialog). However if there are no off, locked, or frozen layers, this will always be nil, so I don't know why a prompt is being built that will never show?
Here is my best guess at what you really wanted
(defun offfrozenlockedlayerlist ( / aa bb cc xx yy zz)
(setq aa (off-layer-list))
(setq bb (frozen-layer-list))
(setq cc (locked-layer-list))
(if (or aa bb cc)
(progn
(if aa
(setq xx (car aa))
(setq xx " ")
)
(if bb
(setq yy (car bb))
(setq yy " ")
)
(if cc
(setq zz (car cc))
(setq zz " ")
)
(alert
(strcat "\noff=>" xx " \nfrozen=>" yy "\nlocked=>" zz)
)
)
(alert "All layers are thawed, on, and unlocked!")
)
(princ)
)
rkmcswain
2007-12-28, 02:44 PM
(defun c:LayerLock(/ ename lyr)
(setq ename (car (entsel "( Select objects: )")))
(if ename (progn (setq lyr (cdr (assoc 8 (entget ename))))
(command "-layer" "set" lyr "")
(command "-layer" "lo" lyr "" ) )
)
(if lyr
(progn
(alert (strcat "\"" lyr "\"" " Locked Layer "))
(prompt (strcat "\n\t Current Layer [" lyr "] is Locked "))
)
)
(prin1))
That function seems to work OK for me - what problem are you having?
Please note, I have merged your two alert threads.
Richard
Forum Moderator
youngsoo
2007-12-31, 05:42 AM
Please solve the problem of (alert (strcat "\noff : aa \nfrozen : bb \nlocked : cc))
(defun table-list(name / dxf return)
(while (setq dxf(tblnext name(not dxf)))
(setq return(cons(cdr(assoc 2 dxf))return))
)
(reverse return)
;;(table-list"LTYPE")
;;(table-list"VIEW")
;;(table-list"STYLE")
;;(table-list"BLOCK")
;;(table-list"UCS")
;;(table-list"APPID")
;;(table-list"DIMSTYLE")
;;(table-list"VPORT")
;(table-list"LAYER")
)
;;;;---------------------------------------------
(defun off-layer-list(/ dxf return )
(while (setq dxf(tblnext"layer"(not dxf)))
(if (<(cdr(assoc 62 dxf))0)
(setq return(cons(cdr(assoc 2 dxf))return))
)
)
(reverse return)
)
;;;------------------------------------------------
(defun frozen-layer-list(/ dxf return)
(while (setq dxf(tblnext"layer"(not dxf)))
(if (=(logand(cdr(assoc 70 dxf))1)1)
(setq return(cons(cdr(assoc 2 dxf))return))
)
)
(reverse return)
)
;;-----------------------------------------------------
(defun locked-layer-list(/ dxf return)
(while (setq dxf(tblnext"layer"(not dxf)))
(if (=(logand(cdr(assoc 70 dxf))4)4)
(setq return(cons(cdr(assoc 2 dxf))return))
)
)
(reverse return)
)
;;;------------------------------------------------------
(defun offfrozenlockedlayerlist(/ aa bb cc)
(setq aa (off-layer-list))
(setq bb (frozen-layer-list))
(setq cc (locked-layer-list))
(if (or aa bb cc))
(alert (strcat "\noff :" aa "\nfrozen :" bb " \nlocked :" cc)
)
(prompt "\nAll layers are thawed, on, and unlocked!")
);if end
)
Moderator Note:
How to use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
rkmcswain
2007-12-31, 02:19 PM
Please solve the problem of (alert (strcat "\noff : aa \nfrozen : bb \nlocked : cc))
Already been done. Please read earlier posts.
rkmcswain
2008-01-01, 03:31 PM
I'm sorry.
My English is far from perfection.
Do you get the picture? No...............
youngsoo
2008-01-02, 03:37 AM
I'm sorry.
My English is far from perfection.
Do you get the picture?
Sorry! I can't explain enough.
For example,
off layer : layer1, layer2, layer3
frozen layer : layer4, layer5, layer6
Locked layer : layer7, layer8, layer9
;;;--------------------------------------------------------
alert
off=> layer1
frozen=>layer4
locked=>layer7
;;;-------------------------------------------------------------------------
(prompt "\noff=>" ) (princ (off-layer-list) ) : layer1, layer2, layer3
(prompt " frozen=>") (princ (frozen-layer-list) ) : layer4, layer5, layer6
(prompt " locked=>") (princ (locked-layer-list) ) : layer7, layer8, layer9
From what I can understand, you are creating a list for each one of your chosen states. You will need to concatenate your list items into a string. Once you have your string for each state, you could send that string to your alert box.
Since this function to combine a list into a string will be common to all layer state lists, you could write this as a sub routine for reuse.
rkmcswain
2008-01-02, 04:35 PM
You will need to concatenate your list items into a string. Once you have your string for each state, you could send that string to your alert box.
One quick way to do that would be
(vl-princ-to-string list)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.