Author Topic: CMDACTIVE-Pause issue with text or hatch commands  (Read 3170 times)

0 Members and 1 Guest are viewing this topic.

NICK_VNV

  • Newt
  • Posts: 63
CMDACTIVE-Pause issue with text or hatch commands
« on: June 23, 2014, 08:44:08 AM »
When I use
Code: [Select]
(command "_pline")
(while (> (getvar 'CmdActive) 0) (command pause))
...some code
everything goes OK, but when I do it with a "_-text" or "_text" or "_-hatch" instead of "_pline", these commands begin to skip some values and do not work properly, for example I can't write a text after setting insertion point for text, and can't select a method for hatching. Is there any other way to fix it, maybe i missed something?
Sorry for my English...

ROBBO

  • Bull Frog
  • Posts: 217
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #1 on: June 23, 2014, 09:10:39 AM »
these are examples of what I have used for text:

Code - Auto/Visual Lisp: [Select]
  1. (command "_.Dtext" "j" pause pause pause)(command)(command)

Code - Auto/Visual Lisp: [Select]
  1. (command "_.mtext" pause pause)(command)(command)
  2. )

Kind regards, Robbo.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #2 on: June 23, 2014, 10:04:10 AM »
Your answer is burred in the function TextAdd
No time this morning. (routine is a work in progress)
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.

NICK_VNV

  • Newt
  • Posts: 63
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #3 on: June 24, 2014, 12:21:40 PM »
Your answer is burred in the function TextAdd
No time this morning. (routine is a work in progress)
Hmmm it's a large file with a lot of functions, it will take some time to study them :-)
And I think you mean vla-addtext function? Yes of course I can use it, or something like entmake functions, but for this time I wanted to let users run standard Autocad commands (so they see no difference in workflow) and after that make some changes in properties of newly created object. Just trying to find more simple way. If it is not possible I'll have to use vla-add.. with my propmts added or something like
these are examples of what I have used for text:

Code - Auto/Visual Lisp: [Select]
  1. (command "_.Dtext" "j" pause pause pause)(command)(command)


Code - Auto/Visual Lisp: [Select]
  1. (command "_.mtext" pause pause)(command)(command)
  2. )

Kind regards, Robbo.
with some pauses individual for each type of command.
« Last Edit: June 24, 2014, 12:26:02 PM by NICK_VNV »
Sorry for my English...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #4 on: June 24, 2014, 01:40:51 PM »
No under the TextAdd you will find this:
Code - Auto/Visual Lisp: [Select]
  1.       ;;  layer & text size & style were Pre set
  2.       ;;  Start the COMMAND
  3.       ;;  Note strange behavior, if Leader is created prior to this command it dissapears while in this command
  4.       ;;  but reappears after command is completed.
  5.       (command "._text")
  6.       (if (/= just "L") (command "_j" just))
  7.       (command "_non")
  8.       (if (zerop (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))))
  9.        (command p "" (distof addAngle))
  10.        (command p (distof addAngle))
  11.       )
  12.       (while (= (logand (getvar "cmdactive") 1) 1)
  13.         (command "\\acedpause")
  14.       )
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.

NICK_VNV

  • Newt
  • Posts: 63
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #5 on: June 25, 2014, 07:04:35 AM »
Ah you use some code instead of pauses as input parameters. But this give me the same result - function stops when it becomes time to write some text (it tries to write "pauses" for some reason). Also using \\acedpause instead of pause gives me "unkown command "\ACEDPAUSE". But I found that using (initcommandversion) before (command ..) makes this command work properly and I can normally write some text and then use it as entlast for any pusposes:
Code: [Select]
; example
(defun foo (/)
 (initcommandversion)
 (command "_dtext")
 (while (> (getvar 'CmdActive) 0) (command pause))
 (entlast)
)

(assoc 1 (entget(entlast))) ; just for check entlast's text
This also works for (command "_-hatch")
« Last Edit: June 25, 2014, 07:24:08 AM by NICK_VNV »
Sorry for my English...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #6 on: June 25, 2014, 07:50:58 AM »
Glad you found a way.
acedpause only works within a lisp and not from the command line
Try this: User picks the point for text and then enters it.
Code: [Select]
(defun c:test ()
  (command "._text")
  (command "_non")
  (if (zerop (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))))
    (command  pause "" 0.0)
    (command pause 0.0)
  )
  (while (= (logand (getvar "cmdactive") 1) 1)
    (command "\\acedpause")
  )
  (princ)
)
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.

NICK_VNV

  • Newt
  • Posts: 63
Re: CMDACTIVE-Pause issue with text or hatch commands
« Reply #7 on: June 25, 2014, 08:30:21 AM »
acedpause only works within a lisp and not from the command line
didn't know that, now I see your code also works for me,  thank you for help CAB!
Sorry for my English...