Author Topic: question about undo when only using (entmod in routine  (Read 1987 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
question about undo when only using (entmod in routine
« on: June 13, 2008, 07:10:14 PM »
why is it when you have a routine that only uses entmod and doesn't have any "(command)", if you undo the routine, it will undo what was done with the routine and the last thing performed before the routine was ran?

i put a "(command "layer" "")" as the first thing the routine issues and that works (and that still, if you undo, will undo routine, then undo group, then undo the last thing performed), but i feel that i just don't know something? i've encountered this issue numerous times on routines i did not write, so it's not just me.
« Last Edit: June 13, 2008, 07:19:08 PM by alanjt »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: question about undo when only using (entmod in routine
« Reply #1 on: June 13, 2008, 07:20:05 PM »
You either have to make a group/mark with the 'undo' command, or use the ActiveX method of the document object.  Maybe someone will come around with a why, but this is how I handle it.  A good precaution is to end any previous group/marks as shown in the code snippets below.

Code: [Select]
(command "_.undo" "_end")
(command "_.undo" "_group")
... code goes here ...
(command "_.undo" "_end")

Code: [Select]
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vla-EndUndoMark ActDoc)
(vla-StartUndoMark ActDoc)
... code goes here ...
(vla-EndUndoMark ActDoc)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: question about undo when only using (entmod in routine
« Reply #2 on: June 13, 2008, 07:31:25 PM »
Why?
I could only guess that COMMAND sets the Undo Mark & entmak does not.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: question about undo when only using (entmod in routine
« Reply #3 on: June 13, 2008, 07:34:27 PM »
Why?
I could only guess that COMMAND sets the Undo Mark & entmak does not.
Sounds good to me Alan.   :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: question about undo when only using (entmod in routine
« Reply #4 on: June 13, 2008, 08:24:51 PM »
well, that works :)
i know it would make more sense to add undo (which i will just do from now on, regardless), i just felt there had to be some strange reason why that occurred. my why was exactly what alan said, oh well. odd

thanks guys.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: question about undo when only using (entmod in routine
« Reply #5 on: June 13, 2008, 09:22:26 PM »
One note.
When using vla methods use the vla UndoMark and when using entmake or command use the command Undo.
Users have reported problems when you mix vla methods and the COMMAND Undo.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.