newbe question

Started by MexicanoRS, February 14, 2015, 10:16:47 AM

Previous topic - Next topic

MexicanoRS

Hello i new here :D .
I am having a problem with a small project . I can not use the command "command" . I am trying in every way but only get the message that the autocad rejected this command. i was using a Palette so i chage to a modal dialog, but now when I click on my button the autocad simply does nothing . (sorry by the english i'm BR)

here is may code:
Code (autolisp) Select

(defun c:k() (load "C:/Projetos/Autocad/teste1.lsp"))
(princ)

; the following command will ensure the
; appropriate OpenDCL ARX file is loaded.
(command "_OPENDCL")

(defun c:Hello ()
   (dcl_Project_Load "C:/Projetos/Autocad/teste" T)
   (dcl_Form_Show teste_Form1)
   (princ)
)

(defun c:teste/Form1/TextButtonFazerEscada#OnClicked (/)
  ;;;(dcl-MessageBox "To Do: code must be added to event handler\r\nc:teste/Form1/TextButtonFazerEscada#OnClicked" "To do")
   (setq comp1 (dcl_Control_GetText teste_Form1_TextBoxComp1))
   (setq comp2 (dcl_Control_GetText teste_Form1_TextBoxComp2))
   (setq esp1 (dcl_Control_GetText teste_Form1_TextBoxEsp1))
   (setq esp2 (dcl_Control_GetText teste_Form1_TextBoxEsp2))
   (command "_Line" (list comp1 0 0 ) (list 0 0 0 ) (list 0 esp1 0) (list comp1 esp1 0 ) "c" )
   (dcl_Form_Close teste_Form1)
)

owenwengerd

Take a look at the last paragraph here. This applies to your modeless palette. For a modal dialog, you need to put your calls to (command) in the main (c:Hello) function so they execute after the modal dialog has closed and the command throat has been reactivated.