Clicking on check box initiates last autocad command??

Started by Hypersonic, December 11, 2009, 03:58:56 PM

Previous topic - Next topic

Hypersonic



;**** the Draw punches check box ****


If I enter the line command, start drawing lines, then cancel out....
Then go to the check box labels draw punches..... it wigs out and appears to attempt to resume the "line" command....
Am I not initiating something properly?

below is the autolisp code for the check box....

(defun c:Parametrics_PM_synthesis_CheckBox1_OnClicked (nValue /)
  (if (= nVAlue 1)
   (progn
     (ied_punches)
     (ied_headed_punches)

     (make_edm_punch_from_groups)
     (make_headed_punch_from_groups)

     (setq make_punches 1);this maybe should be based on successfull completion....
   )
   (progn
     (ied_punches)
     (ied_headed_punches)
     (setq make_punches 0)
   )
);end if

(save_all_completed_operation_values_to_db)
)

BazzaCAD

Do you have "Event Invoke" set to 1 on the check box?
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom


BazzaCAD

a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Kerry

#4
Without seeing the code and dialog I'm just guessing ...
Is the form modeless.
What is your *error* function like
Is it local

What's in your sub-routines inside the progn
Have you tried to debug/step-through the code.
.. how about adding (vl-bt) to your error trap

If Modeless, Have you looked at using something like (dcl_SendString "(ied_punches)").
from help
QuoteModeless dialog event handlers are normally invoked in the AutoCAD application context instead of the document context. AutoLISP code running in the application context cannot call document-dependent functions like the (command) function. To deal with this problem, the control's 'Event Invoke' property may be used to trigger the event handler asynchronously in the document context, thus allowing calls to (command) to succeed. Alternatively, the event handler may be executed synchronously, but instead of calling document-dependent functions within the handler function, it can simply trigger a new command to execute in the document context via the (dcl_SendString) function.
Perfection is not optional.
My other home is TheSwamp

Kerry

#5
I notice thay you have

    (ied_punches)
    (ied_headed_punches)

in both branches of the if statement.

This is fine if it's really what you want but  the logic dictates those statements be run prior to the if statement.
Perfection is not optional.
My other home is TheSwamp

BazzaCAD

Quote from: Kerry Brown on December 11, 2009, 08:03:20 PM
Without seeing the code and dialog I'm just guessing ...
Is the form modeless.

If Modeless, Have you looked at using something like (dcl_SendString "(ied_punches)").
from help
QuoteModeless dialog event handlers are normally invoked in the AutoCAD application context instead of the document context. AutoLISP code running in the application context cannot call document-dependent functions like the (command) function. To deal with this problem, the control's 'Event Invoke' property may be used to trigger the event handler asynchronously in the document context, thus allowing calls to (command) to succeed. Alternatively, the event handler may be executed synchronously, but instead of calling document-dependent functions within the handler function, it can simply trigger a new command to execute in the document context via the (dcl_SendString) function.


Kerry just an FYI, you can tell it's modeless by the titlebar in the screen shot.
Also, controls on Modal forms don't have an "Event Invoke" property, which he said he had. :)
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Hypersonic


I don't have much for error trapping (ugh)

What is this:  (vl-bt)

I tried synchronous and asynchronous, and also the "send string" method.... all do the same thing....
It must be something in my other code,  I have run into this before it's like their is a command not closing out or something...

the same code runs when pasted to the command line..

Hypersonic

Never could get it to work....... so I switched to buttons and it worked just fine...? oh well

could anyone tell me what the (vl-bt) mentioned above does for you?

Thanks!

Fred Tomke

Quote from: Hypersonic on December 13, 2009, 07:38:53 AM
could anyone tell me what the (vl-bt) mentioned above does for you?

Hi, Hypersonic,
bt stands for backtrace. So you can follow back in which function an error occured.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]