See the top rated post in this thread. Click here

Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Help with DCL lisp

  1. #21
    Active Member
    Join Date
    2023-03
    Posts
    54
    Login to Give a bone
    0

    Default Re: Help with DCL lisp

    Hi BIG_AL. I check in notepad ++ all the bracket and is correct. I can not find the problem in this code !!!

    This code open dcl , select the coordinate file , but when I press OK I have this error

    Error: invalid argument type: listp:
    Code:
    (defun PI:GETFILEFORMAT (/ )
    
          (defun *error* ( / *error* dch dcl des)
            (if (and (= 'int (type dch)) (< 0 dch))
              (unload_dialog dch)
            )
            (if (= 'file (type des))
              (close des)
            )
            (if (and (= 'str (type dcl)) (findfile dcl))
              (vl-file-delete dcl)
            )
    
            (princ)
          ) ; end defun
         
          (cond
            ( (not
                (setq dcl (vl-filename-mktemp nil nil ".dcl")
                     des (open dcl "w")
                ) ; end setq
              ) ; end not
              (princ "\nUnable to open DCL for writing.")
            )
            ( (progn
                (foreach str '(
                                "ed : edit_box { alignment = left; width = 20; edit_width = 10; fixed_width = true;}"
                                ""
                                "pointsin : dialog { spacer; key = \"dcl\";"
                                " : boxed_column { label = \"Text Style\"; height = 1.0;}"
                                "      : radio_button { height = 1.0; width = 20; is_tab_stop = true;"
                                "        key = \"radio_button01\"; label = \"1. PNEZD (comma delimited)\";"
                                "    }" ; radio_button 
                                "      : radio_button  { height = 1.0; width = 20; is_tab_stop = true;"
                                "        key = \"radio_button02\"; label = \"2.  PNEZD (tab delimited)\";"
                                "    }" ; radio_button 
                                "      : radio_button  { height = 1.0; width = 20; is_tab_stop = true;"
                                "        key = \"radio_button03\"; label = \"3.PNEZD (white-space delimited)\";"
                                "    }" ; radio_button 
                                "      : radio_button  { height = 1.0; width = 20; is_tab_stop = true;"
                                "        key = \"radio_button04\"; label = \"4. PENZD (comma delimited)\";"
                                "    }" ; radio_button 
                                "      : radio_button  { height = 1.0; width = 20; is_tab_stop = true;"
                                "        key = \"radio_button05\"; label = \"5. PENZD (tab delimited)\";"
                                "    }" ; radio_button 
                                "      : radio_button { height = 1.0; width = 20; is_tab_stop = true;"
                                "        key = \"radio_button06\"; label = \"6. PENZD (white-space delimited)\";"
                                "    }" ; radio_button 
                                "    : row { width = 20;"
                                "      : button { key = \"OK\"; label = \"OK\"; is_default = true;"
                                "                 is_cancel = true; fixed_width = true; width = 10; }" 
                                "    }" ; end row
                                "  }" ; end dialog
                              ) ;end list
                  (write-line str des)
                ) ; end foreach
                (setq des (close des)
                     dch (load_dialog dcl)
                ) ; end setq
                (<= dch 0)
              )
              (princ "\nUnable to load DCL file.")
            )
            (   (not (new_dialog "pointsin" dch))
                (princ "\nUnable to display 'pointsin' dialog.")
            )
            ( t
              (set_tile "dcl" "Select file")
    		(setq FILEFORMAT1)
              (action_tile "radio_button01" "(setq FILEFORMAT 1))")
              (action_tile "radio_button02" "(setq FILEFORMAT 2))")
              (action_tile "radio_button03" "(setq FILEFORMAT 3))")
              (action_tile "radio_button04" "(setq FILEFORMAT 4))")
              (action_tile "radio_button05" "(setq FILEFORMAT 5))")
              (action_tile "radio_button06" "(setq FILEFORMAT 6))")
              (action_tile "OK" "(progn (done_dialog 1) FILEFORMAT)")
              (start_dialog)
            )
          ) ; end cond
          (*error* nil)
        (princ)
    ) ;_  end defun
    Thanks
    Last edited by mhy3sx.; 2024-04-22 at 05:15 AM.

  2. #22
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,124
    Login to Give a bone
    1

    Default Re: Help with DCL lisp

    Your *error* subroutine is being called with a parameter, yet the definition you have created does not include a parameter value. You have also localized variables inside of the *error* subroutine that were set outside of the subroutine. The localized variables will not contain the values you have set outside of the subroutine. I am not saying the changes to this subroutine will fix your overall routine, but those changes will need to be made in the long run.

    You appear to have an error on line 69 which is right after the set_tile line. Were you intending to assign a value to the FILEFORMAT variable or the FILEFORMAT1 variable?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #23
    Member
    Join Date
    2015-09
    Location
    Madrid - Spain
    Posts
    11
    Login to Give a bone
    1

    Default Re: Help with DCL lisp

    You can try this:
    usage:
    Code:
    (setq OPTION (delimitedDLG))
    Code:
    (defun delimitedDLG ( /  FichDlg idxDlg acc delim WriteDlg)
     
    	;;___________________________________________________
    	(defun WriteDlg ( / dir FileDlg openFile)
    	 (setq dir (getvar "TEMPPREFIX"))
    	 (setq FileDlg (strcat dir "$Delimited$.dcl"))
    	 (cond
    	  ;;(T ;;Forzar reescribir el cuadro: dejar así en este caso porque tiene argumentos y se tiene que reescribir
    	  ((not (findfile FileDlg))
    	   (setq openFile (open FileDlg "w"))
    		(write-line "//-----------------------------------------//" openFile)
    		(write-line "// delimiter dialog box                    //" openFile)
    		(write-line "//-----------------------------------------//" openFile)
    		(write-line "delimiter : dialog {" openFile)
    		(write-line " label = \"Select a file format\";" openFile)
    		(write-line "  : boxed_radio_column {" openFile)
    		(write-line "    key = \"delim\";" openFile)
    		(write-line "    label = \"&Delimiter PNEZD: \";" openFile)
    		(write-line "      : radio_button {vertical_margin = none; label = \"&1. PNEZD (comma delimited)\"; key = \"1\";}" openFile)
    		(write-line "      : radio_button {vertical_margin = none; label = \"&2. PNEZD (tab delimited)\"; key = \"2\";}" openFile)
    		(write-line "      : radio_button {vertical_margin = none; label = \"&3. PNEZD (white-space delimited)\"; key = \"3\";}" openFile)
    		(write-line "      : radio_button {vertical_margin = none; label = \"&4. PENZD (comma delimited)\"; key = \"4\";}" openFile)
    		(write-line "      : radio_button {vertical_margin = none; label = \"&5. PENZD (tab delimited)\"; key = \"5\";}" openFile)
    		(write-line "      : radio_button {vertical_margin = none; label = \"&6. PENZD (white-space delimited)\"; key = \"6\";}" openFile)
    		(write-line "      : spacer { width = 1; }" openFile)
    		(write-line "  } " openFile)
    		(write-line " : spacer { width = 1; }" openFile)
    		(write-line " ok_cancel_err;" openFile)
    		(write-line "}" openFile)
    	   (close openFile)
    	  )
    	 );c.cond
    	 FileDlg
    	)
     
      ;;-------------------------------- MAIN ------------------------------------------
      ;;default value
      (or *delimiterPNEZD* (setq *delimiterPNEZD* "1"))
      (setq delim *delimiterPNEZD*)
      ;;Load the dialog file
      (if (null Pos-Dlg) (setq Pos-Dlg '(-1 -1)))
      (setq FichDlg (WriteDlg))
      (setq idxDlg (load_dialog FichDlg))
    
      ;;______________________________________________________________________
      ;;Abre el cuadro de dialogo
      (if (not (new_dialog "delimiter" idxDlg "" Pos-Dlg)) (exit))
      ;;__________________________________
       (set_tile "delim" delim)
      ;;__________________________________
       (action_tile "delim"  "(setq delim $value))")
       (action_tile "accept" "(setq Pos-Dlg (done_dialog 1))")
       (action_tile "cancel" "(setq Pos-Dlg (done_dialog 0))")
       (setq acc (start_dialog))
       (cond
        ((= acc 0)
         (unload_dialog idxDlg)
         nil
        )
        ((= acc 1)
         (unload_dialog idxDlg)
         (setq *delimiterPNEZD* delim)
         ;;delim
        )
       )
    )

  4. #24
    Active Member
    Join Date
    2023-03
    Posts
    54
    Login to Give a bone
    0

    Default Re: Help with DCL lisp

    Hi garcigj ,I did this change but gives me this error

    Code:
    trapped error: invalid argument type: listp: "4"

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Help with Lisp and DCL
    By laison.albarado in forum AutoLISP
    Replies: 0
    Last Post: 2010-10-29, 11:42 PM
  2. DCL & Lisp help
    By ben.hill in forum AutoLISP
    Replies: 1
    Last Post: 2009-09-23, 05:29 PM
  3. DCL - Button that would pick a point in AutoCAD in DCL
    By katkinson0082914 in forum AutoLISP
    Replies: 3
    Last Post: 2006-06-09, 12:19 PM
  4. Help using dcl to launch lisp routine
    By charlie.bauer341340 in forum AutoLISP
    Replies: 4
    Last Post: 2005-07-22, 06:03 PM
  5. Lisp/DCL Help
    By fletch97 in forum AutoLISP
    Replies: 3
    Last Post: 2005-06-23, 11:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •