Picking origin point with modal form

Started by william17051, March 12, 2009, 05:31:12 AM

Previous topic - Next topic

Fred Tomke

You've already done. Have a look into the OnInitialize-function. The OnInitialize event will be called when the form will be shown again. and there you wrote


  (setq OrX(car Spot))
  (setq OrY(cadr Spot))
  (setq OrZ(caddr Spot))


and then


  (dcl_Control_SetText BillsShopDrawing_form1_TextBox4 (itoa OrX))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox5 (itoa OrY))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox6 (itoa OrZ))


It should work.

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

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

william17051

Well it does not update. ???
It continues to to use the original 0,0,0.

I thought it would update as well.

I just noticed in the command prompt after the getpoint command it is giving me an error.

Command: _BillsShopDrawing
Select point: Program ERROR
Resetting environment ; error: An error has occurred inside the *error*
functionbad argument type: consp nil
1
Command: 'VLIDE
Command:


Im not sure why yet. :o

Fred Tomke

Hm, go far ahead from the ucs origin - itoa is given back a text from an integer. Try a (rtos OrX 2 4) instead.
I didn't check you code - I only moved som things.

I will take a closer look.

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

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

william17051

Thanks Fred,
Your help is greatly appreciated! ;)

Fred Tomke

Ahm, I cannot see any mistake at the code. Please be so kind to upload

a) the project file and
b) your *error* function

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

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

william17051

As far as an error code, Well I dont have one. :-\  What you have, I have.
Sort of a newbee here. Never really had an error function.

Here is the project file. And code.

(defun C:BillsShopDrawing (/)
  (command "OPENDCL")
  (dcl_Project_Load "BillsShopDrawing") ; load it just only one time
 
  (setq Spot(list 1 1 1))
  (setq lg 100)
  (setq wd 96)
  (setq ht 90)
  (SETQ bflag T)
  (WHILE bflag                                  ; To fire it up
    (SETQ bflag nil)
    (setq intResult (dcl_Form_Show BillsShopDrawing_form1))      ; jump to open form and set variables
    (cond
      ((= intResult 3)
       (SETVAR "BLIPMODE" 1)
       (SETQ Spot(GETPOINT "\nSelect point: "))
       (SETVAR "BLIPMODE" 0)
       (VL-CMDF "._REDRAW")
       (SETQ bflag T))
      ); cond
    ); end while
  (setvar "osmode" 175)
  (setvar "highlight" 1)
);end defun


(defun c:BillsShopDrawing_form1_OnInitialize (/ OrX OrY OrZ)
  (setq OrX(car Spot))
  (setq OrY(cadr Spot))
  (setq OrZ(caddr Spot))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox1 (itoa lg))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox2 (itoa wd))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox3 (itoa ht))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox4 (rtos OrX 2 4))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox5 (rtos OrY 2 4))
  (dcl_Control_SetText BillsShopDrawing_form1_TextBox6 (rtos OrZ 2 4))
); c:BillsShopDrawing_form1_OnInitialize


(defun c:BillsShopDrawing_form1_SetOrigin_OnClicked (/)
  (dcl_FORM_CLOSE BillsShopDrawing_form1 3) ; the given argument will be the returning value of Form_Show method
); c:BillsShopDrawing_form1_SetOrigin_OnClicked

owenwengerd

Your text bozes contain an integer filter, so they are rejecting any setting that is not an integer. The (rtos) is resulting in a real number, which is rejected. Try changing the third argument to (rtos) from a 4 to zero, then it should work.

william17051

You guys are awsome ;D!
Works great!
Thanks for all the help!
Bill