Author Topic: Why is this action_tile crashing??  (Read 3222 times)

0 Members and 1 Guest are viewing this topic.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Why is this action_tile crashing??
« on: April 10, 2006, 09:38:15 PM »
Need a little help in debugging this.

Why is this action_tile crashing??  It creates the WBlock file in the correct location.  And that is where it stops, right at the end of Action tile “rb1” line.  I took out line of code for “rb2” and it is still crashing at “rb1” line. Animate and Stop @ break confirmed the same thing.

Code: [Select]
    (unload_dialog dcl_id) ;unload

  (princ)



  ;; Main Application ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(today)
(StrPath)

(vl-mkdir NewPath)

(setvar "expert" 4)
(action_tile "rb1" "(command " Wblock " NewFile " * ")")
;New version 2004 file with date Prefix
(action_tile "rb2" "(command " saveas " " 2000 " OldFile)")
  ;New version 2000 file with date Prefix
 
(command "saveas" "2004" OldFile) ;Saves back to the Orginal File.
(setvar "expert" 0)
(setq *error* old_error)
(princ)
);;End of Routine


When I check it with the editor’s check, I get this warning.
Code: [Select]
[CHECKING TEXT Tedstest.LSP loading...]
.
; warning: too many arguments: (ACTION_TILE "rb1" "(command " WBLOCK ... )
; Check done.


Question so I can understand this.  Is the “action_tile” function nothing more that a fancy “IF” function?
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Why is this action_tile crashing??
« Reply #1 on: April 10, 2006, 09:57:58 PM »
you cannot use "command" as the action of any action_tile. If you wish to use COMMAND as the result of any button the user may press, I would suggest that what you do is:

Remove COMMAND from the function call in the action_tile
Set a variable (call it whatever you like)
dismiss the dialog box
execute COMMAND based on the value of the variable you set ...

It could be done as such:
Code: [Select]
;New version 2004 file with date Prefix
(action_tile "rb1" "(setq which_action 1)")
;New version 2000 file with date Prefix
(action_tile "rb2" "(setq which_action 2)")
;Saves back to the Orginal File.
;;; extraneous code here

(done_dialog);how you achieve it is entirely up to you
(setvar "expert" 4)
(cond
 ((= which_action 1)(vl-cmdf " Wblock " NewFile " * "))
 ((= which_action 2)(vl-cmdf " saveas " " 2000 " OldFile))
)
(vl-cmdf "saveas" "2004" OldFile)
(setvar "expert" 0)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Why is this action_tile crashing??
« Reply #2 on: April 11, 2006, 09:23:05 AM »
Thanks Keith.

Thanks for showing me about the “vl-cmdf” function.  Last night I look it up Vlisp help and can understand how that function came about.

I basically pasted in your suggested code, tweaked a few minor bugs that popped up and it works great.  One of the bugs that came across is listed below.  I got it to work but don’t understand why it is needed.  I had to add the “Line 1” code (not really line 1 in the routine) so that Lines 2 & 4 could work.  Why do I need to preset the variable “which_action” to one when Line 2 sets the variable “which_action” to 1 again?
Why?  I am just asking so I can understand.
 


Code: [Select]
Line 1 =  (setq which_action 1)
Line 2 =  (action_tile "rb1" "(setq which_action 1)")
Line 3 = ;New version 2004 file with date Prefix
Line 4 =  (action_tile "rb2" "(setq which_action 2)")
Line 5 = ;New version 2000 file with date Prefix

Thanks again
Ted
Oh by the way; my IT guy thanks you too.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Why is this action_tile crashing??
« Reply #3 on: April 11, 2006, 09:30:22 AM »
It shouldn't ... but as long as it works ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

GDF

  • Water Moccasin
  • Posts: 2081
Re: Why is this action_tile crashing??
« Reply #4 on: April 11, 2006, 11:21:47 AM »
Keith

change:
(action_tile "rb1" "(command " Wblock " NewFile " * ")")
to:
(action_tile "rb1" "(command \"Wblock\" NewFile \"*\")")

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Why is this action_tile crashing??
« Reply #5 on: April 11, 2006, 11:31:10 AM »
Keith

change:
(action_tile "rb1" "(command " Wblock " NewFile " * ")")
to:
(action_tile "rb1" "(command \"Wblock\" NewFile \"*\")")

Gary

Nope ....
Quote from: AutoLISP Reference in AutoCAD help file
NOTE You cannot call the AutoLISP command function from the action_tile function.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

GDF

  • Water Moccasin
  • Posts: 2081
Re: Why is this action_tile crashing??
« Reply #6 on: April 11, 2006, 11:56:51 AM »
Keith

change:
(action_tile "rb1" "(command " Wblock " NewFile " * ")")
to:
(action_tile "rb1" "(command \"Wblock\" NewFile \"*\")")

Gary


Nope ....
Quote from: AutoLISP Reference in AutoCAD help file
NOTE You cannot call the AutoLISP command function from the action_tile function.



You can call me bonehead. Of course you are correct. I was only refering to the \" and should have
spotted the command in the action tile.

I'm going across the street for some more coffee, now...

Gary


Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64