Total Newby

Started by Cornelis, September 25, 2015, 01:29:35 PM

Previous topic - Next topic

roy_043

Quote from: Cornelis on September 29, 2015, 05:24:42 AM
Command: (setq pt (getpoint "\nPoint please: "))
Point please: (list 1.1 2.2 3.3)
Can't reenter LISP.
Invalid point.
Maybe you have to change the TEXTEVAL variable in AutoCAD or this, indeed, does not work in AutoCAD. As I said I use BricsCAD.

roy_043

Finally, Cornelis, you interpretation of my 'escape' example is not correct.

My suggestion:
Code (autolisp) Select
(dcl-SendString (strcat (chr 27) (chr 27) "_ellipse "))
Your code:
Code (autolisp) Select
(dcl-SendString "(chr 27) (chr 27) (setq p1 (getpoint \"Getpoint (Ellipse)\")) ")

I have used (strcat) for a reason. My code sends 2 escape characters your code does not.

Your code should be:
Code (autolisp) Select
(dcl-SendString (strcat (chr 27) (chr 27) "(setq p1 (getpoint \"Getpoint (Ellipse)\")) "))
This works in BricsCAD, and judging by the discussion I have previously linked to, should also work in AutoCAD.

Cornelis

Enter new value for TEXTEVAL <0>: 1
Command: (setq pt (getpoint "\nPoint please: "))
Point please: (list 1.1 2.2 3.3)
can't reenter LISP.
Invalid point.
Command: texteval
Enter new value for TEXTEVAL <1>: 0
Command: (setq pt (getpoint "\nPoint please: "))
Point please: (list 1.1 2.2 3.3)
Can't reenter LISP.
Invalid point.

texteval has no influence.

Sorry for the (strcat ,wil look into that.
Thanks.

Cornelis

I changed in Roy.lsp to this
Code (autolisp) Select
(defun DrawEllipse ()
  (dcl-Control-SetCaption Roy/Form1/LblStatus "Select Ellipse")
  (dcl-SendString (strcat (chr 27) (chr 27) "(setq p1 (getpoint \"Getpoint (Ellipse)\")) "))
)

(defun DrawRectangle ()
  (dcl-Control-SetCaption Roy/Form1/LblStatus "Select Rectangle")

(dcl-SendString (strcat (chr 27) (chr 27) "(setq p1 (getpoint \"Getpoint (Rectangle)\")) "))
)

(defun DrawCircle ()
  (dcl-Control-SetCaption Roy/Form1/LblStatus "Select circle")

   (dcl-SendString (strcat (chr 27) (chr 27) "(setq p1 (getpoint \"Getpoint (Cirlce)\")) "))
)

(defun DrawLine ()
  (dcl-Control-SetCaption Roy/Form1/LblStatus "Select Line")
  (dcl-SendString (strcat (chr 27) (chr 27) "(setq p1 (getpoint \"Getpoint (Line)\")) "))
)


but same result. Texteval 1
Thanks.

roy_043

That is disappointing. I don't think I can be of further assistance.

BTW: You have never confirmed if my code in post #2 works.

owenwengerd

I'm not sure I understood the problem, but if your modeless form's event invoke property is set to 'Asynchronous', you should go to the button's OnClicked event and click the [Add Cancel] button to add a ^C^C prefix to your event handler string. This cancels any running commands before executing the event handler.

roy_043

Quote from: owenwengerd on September 29, 2015, 07:50:30 AM
I'm not sure I understood the problem, but if your modeless form's event invoke property is set to 'Asynchronous', you should go to the button's OnClicked event and click the [Add Cancel] button to add a ^C^C prefix to your event handler string. This cancels any running commands before executing the event handler.
Owen, you are completely right. That is indeed the difference between the two projects. Resetting the event names removes this prefix. Both the OP and I have completely overlooked this. Good to know that it is so easy to accomplish this. Thank you.

Cornelis

Wow that works the clicking the add Cancel button is the solution!!! I am a happy camper now.

Thank you so much Owen and Roy
Thanks.