Use of 'pause' in LISP routine
I'm working on a migration of our AutoCAD customisation to something that will also work in BricsCAD.
Working through the commands, I've come across something that happens differently between the two applications. I'm looking for some advice.
The codes pretty basic. Nothing special:
(defun c:c25 ()
(setq curLay (getvar "CLAYER"))
(setvar "CLAYER" "MR_CON_025")
(command "PLINE" pause)
(setvar "CLAYER" curLay)
)
Some testing shows that BricsCAD lets you change the layer of the object currently being drawn, the drawn object adopting the changed layer.
AutoCAD, although it lets you change the current layer mid-stream, continues to draw the object on the layer active when the command started.
I'm fairly new to BricsCAD. Is there a variable I can flick that stops the current behaviour, making it more like AutoCAD?
Working through the commands, I've come across something that happens differently between the two applications. I'm looking for some advice.
The codes pretty basic. Nothing special:
(defun c:c25 ()
(setq curLay (getvar "CLAYER"))
(setvar "CLAYER" "MR_CON_025")
(command "PLINE" pause)
(setvar "CLAYER" curLay)
)
Some testing shows that BricsCAD lets you change the layer of the object currently being drawn, the drawn object adopting the changed layer.
AutoCAD, although it lets you change the current layer mid-stream, continues to draw the object on the layer active when the command started.
I'm fairly new to BricsCAD. Is there a variable I can flick that stops the current behaviour, making it more like AutoCAD?
0
Comments
-
(defun c:c25 ( / curLay) (setq curLay (getvar "CLAYER")) (setvar "CLAYER" "MR_CON_025") (command "_.PLINE") (while (/= 0 (getvar "CMDACTIVE")) (command pause) ) (setvar "CLAYER" curLay) )
0 -
Just curious... why do they let you change the active layer during a command if the change won't apply to that command? i.e., Why would a user want to change the active layer during a command if it won't apply to that command (as opposed to changing it after the command finishes)?..... AutoCAD, although it lets you change the current layer mid-stream, continues to draw the object on the layer active when the command started. .....
Or did you mean that AC assigns the new layer ONLY to entities created by the current command, and leaves the active layer unchanged, as with an Osnap Override or your lisp function? If so, I think it would be pretty easy to create a lisp function to do that in Bricscad.
0 -
Thanks Roy.
I'll give that a go. The code I supplied was the answer I got when I was putting it together. Your suggestion never turned up. Probably because of the observed behaviour with layer changes mid-command.
Hi Anthony,
It was more an observed difference in behaviour.
Because I was getting the result I was after in AutoCAD, I didn't pay a lot of attention to what was happening behind the scenes.
Both BricsCAD and AutoCAD allow you to change the 'current' layer in the middle of an active command.
However, BricsCAD immediately adopts the new 'current' layer, where AutoCAD continues with the layer in play before the command was launched.0 -
Thanks Roy. That worked. You knew it would.0
-
I couldn't understand why it would work that way, so I talked to a co-worker who uses AC. He checked and said it's true of the Pline command, but not the Circle or Line command. Is it different in your AC?.... BricsCAD immediately adopts the new 'current' layer, where AutoCAD continues with the layer in play before the command was launched.
He said he used the Line command to draw 4 lines, changing the active layer before each one. When the command was finished, each line was on the layer he selected for that line, and the last layer he selected had become the active layer. It sounds to me like there's a bug in AC's Pline command.
0 -
You can use the Pause symbol by itself when the user input will only be a single pick point or numeric entry. For example:.... The code I supplied was the answer I got when I was putting it together. Your suggestion never turned up. Probably because of the observed behaviour with layer changes mid-command. ....
(command "circle" "0,0" pause "circle" "250,250")
0 -
It may be just a case of reworking the code so works in both. Just an idea 4 lines do a foreach layer in a list. Setting 2nd point to 1st point in each sequence.
Post what you have.
Yes some situations are different and I use an IF Autocad or Bricscad. When Intellicad was released similar problems tiny differences in some routines.
0