See the top rated post in this thread. Click here

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Help with DCL lisp

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

    Default Re: Help with DCL lisp

    I update to this but give me this error

    Code:
    Error: An error has occurred inside the *error* function too many arguments
    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 sngReturn 1)
              (action_tile "radio_button01" "(setq sngReturn 1))")
              (action_tile "radio_button02" "(setq sngReturn 2))")
              (action_tile "radio_button03" "(setq sngReturn 3))")
              (action_tile "radio_button04" "(setq sngReturn 4))")
              (action_tile "radio_button05" "(setq sngReturn 5))")
              (action_tile "radio_button06" "(setq sngReturn 6))")
              (action_tile "OK" "(progn (done_dialog 1) sngReturn)")
              (start_dialog)
            )
          ) ; end cond
          (*error* nil)
        (princ)
    ) ;_  end defun
    Thanks

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

    Default Re: Help with DCL lisp

    Can anyone fix the code?

    Thanks

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

    Default Re: Help with DCL lisp

    I update the code . The DCL load , gives me the option to select the coordination file and the gives me this error

    Code:
    Esc or Error Pressed...

    Can any one help?

    Thanks
    Attached Files Attached Files

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

    Default Re: Help with DCL lisp

    Any ideas?

    Thanks

  5. #15
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Help with DCL lisp

    I would not try to fix someone else's code.

    I write everything from scratch using structured programming techniques with good notes.

    I try to write code that others can easily read.

    The code I presented is to teach you to create a dialog box with radio buttons.

    I would have you write a functional specification (write out what you need the code to do in steps)

    1. Select data file
    2. Present Dialog to select data format (with radio buttons).
    3. Insert point block at specified location (from data) into the drawing.
    4. Add data to attributes of each point block.

    If this is what you want...

    Can you select a data file using the 'getfiled' expression?

    Can you insert a block with attributes using LISP?

    Can you programmatically change the attributes of each block?

    P=


    This is really not a difficult program to write.
    AutomateCAD

  6. #16
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Help with DCL lisp

    My $0.05 try this make sure Multi radio buttons is saved in a support path so auto loads.

    Code:
    (if (not AH:Butts)(load "Multi Radio buttons.lsp"))
    
    (setq ans (atoi(ah:butts 1 "V" '("Structural Holes"  "PNEZD (comma delimited)" "PNEZD (tab delimited)" "PNEZD (white-space delimited)" )))) ; ans holds the button picked as an integer value
    screenshot453.png

    A little hint is look at variable BUT it is button chosen eg 1 2 3

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

    Default Re: Help with DCL lisp

    Hi BIG-AL the radio buttons load correct in the code, the problem is after choose the coordinate file the code stop. CAn you help me to fix the code ?

    Thanks

  8. #18
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Help with DCL lisp

    Forgot to post this can do the dcl for you look at examples in code.
    Attached Files Attached Files

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

    Default Re: Help with DCL lisp

    The radio buttons in the code I post work fine , the DCL file open , I select the coordinate file type and the coordinate file but not insert the points. Perhaps something in the code is not corrrect. Can any one help?
    Thanks

  10. #20
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Help with DCL lisp

    Are you talking about my Radio buttons code or yours, in mine the code returns 2 answers a hidden Value of BUT which is the radio button selected and ans which is the radio button string. So do a cond and import points.

    Have you checked that part of your code seperately, I dummy up values like "PENZD" and test bits of code. So after running dcl is it returning a known variable answer ?

    For me with my experience never write lots of code but test portions as I go so make sure they are working, looking at DCL checking I write the dcl to a file but do not load rather open in Notepad++ and look at all the bracket pairings to make sure I did not have something missing or out of sequence. Checking stuff like labels and keys have double quotes.

Page 2 of 3 FirstFirst 123 LastLast

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
  •