PDA

View Full Version : Need help updating a Layer name change routine with dialog box



plarson.118418
2007-04-05, 08:29 PM
I have a routine that my company currently runs called MEX that is not quite working right. What MEX does is that it will change something (text, blocks) that is currently on the drawing from New to Existing, Existing to New, New to Demo, Demo to New, Existing to Demo, Demo to Existing via a dialog box. It changes it by changing the extension of the layers from -EXST (existing), -DEMO (demolition) or nothing (new).

Here are the 2 problems that I am having with this routine:
1. When you open the MEX dialog box, if you click on "Cancel", it doesn't cancel the routine. It still asks you to continue with the command as if you just clicked on "OK".
2. Is there a way for you to know if you clicked on an object on a locked layer? When you do a typical erase or move command, the command line tells you that you picked on an object on a locked layer and doesn't highlight it. MEX doesn't do that, it lets you proceed on with the command, highlights it and doesn't change it because it is on a locked layer. I would like it to tell you in the command line that you picked on an object on a locked layer and doesn't highlight it. It might confuse the user into thinking that something is changing when it isn't.

Attached is the makeexist.lsp.

Thanks, Paul

A_LOTA_NOTA
2007-04-05, 08:41 PM
Paul,

Can you please post the dcl file also!

Thanks

plarson.118418
2007-04-05, 08:58 PM
Here is the n-e-d.dcl file.

A_LOTA_NOTA
2007-04-05, 09:38 PM
You need to add some code so it will know what to do when the user clicks "Cancel".

Look at the group codes for the locked layer part of your question.

LAYER group codes Group codes Description

Group code 2 = Layer name

Group code = 70
Standard flags (bit-coded values):
1 = Layer is frozen; otherwise layer is thawed.
2 = Layer is frozen by default in new viewports.
4 = Layer is locked.
16 = If set, table entry is externally dependent on an xref.
32 = If this bit and bit 16 are both set, the externally dependent xref has been successfully resolved.
64 = If set, the table entry was referenced by at least one entity in the drawing the last time the drawing was edited. (This flag is for the benefit of AutoCAD commands. It can be ignored by most programs that read DXF files and need not be set by programs that write DXF files.)

Good luck & let us know how it turns out!




I have a routine that my company currently runs called MEX that is not quite working right. What MEX does is that it will change something (text, blocks) that is currently on the drawing from New to Existing, Existing to New, New to Demo, Demo to New, Existing to Demo, Demo to Existing via a dialog box. It changes it by changing the extension of the layers from -EXST (existing), -DEMO (demolition) or nothing (new).

Here are the 2 problems that I am having with this routine:
1. When you open the MEX dialog box, if you click on "Cancel", it doesn't cancel the routine. It still asks you to continue with the command as if you just clicked on "OK".
2. Is there a way for you to know if you clicked on an object on a locked layer? When you do a typical erase or move command, the command line tells you that you picked on an object on a locked layer and doesn't highlight it. MEX doesn't do that, it lets you proceed on with the command, highlights it and doesn't change it because it is on a locked layer. I would like it to tell you in the command line that you picked on an object on a locked layer and doesn't highlight it. It might confuse the user into thinking that something is changing when it isn't.

Attached is the makeexist.lsp.

Thanks, Paul

CAB2k
2007-04-06, 05:28 PM
Try this, it will filter for matching layers & ignore locked layers.


(setq ssfilter (cons 8 (strcat "*" FLAY)))

;; Have user select objects to change and create a selection set of them
(prompt (strcat "\nSelect objects to change from " FLAY " to " TLAY ": "))
(if
(setq SS1 (ssget ":L" (list ssfilter))) ; :L Rejects locked layers

CAB2k
2007-04-06, 05:40 PM
Try something like this to catch the Cancel. dlg_Exit will = 0 if cancel or escape from the dcl.

(setq dlg_Exit (start_dialog))
(unload_dialog DCL_ID)

(if (not (zerop dlg_Exit))
(progn
;; OK to process layers

CAB2k
2007-04-06, 05:48 PM
There is an error in your code. Using the example [from -NEWW to -EXST]
The -EXST does not exist, so this Layer1-NEWW is used to creat a new layer but this is what you get Layer1-NEWW-EXST

I don't have time to look into where the error is as the rules you are using to manage the layer names is not clear.
I get the impression you allow later zero and Defpoints to be used some how. I think that is a bad idea.

If you have a written list of rules I'll be glat to explore further.