+ Reply to Thread
Results 1 to 8 of 8

Thread: Question On Dcl

  1. #1
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    611

    Default Question On Dcl

    Registered forum members do not see this ad.

    Does anyone have a simple example of a dcl lisp they are willing to post?

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    May take a look on the tutorial for examples.

    Regards,

  3. #3
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    611

    Default

    I'm asking for help with this. This works but the problem is the insert button does nothing. I'd like to get a insert and cancel button going but everytime I try acad locks up. how do I get the buttons to work?

    this is getting really frustrating!

    Code:
    Panel : dialog {    //dialog name
           label = "Insert Panels";  //dialog label  
           :boxed_radio_column {   //define radio column
           label = "Panel" ;    //give it a label
              
            : radio_button {   //define radion button
            key = "p1" ;    //give it a name
            label = "1" ;  //give it a label
              value = "1" ;
              
             }     //end definition
     
          : radio_button {   //define radio button
            key = "p2" ;    //give it a name
            label = "2" ;
            //give it a label
          }     //end definition
     
          : radio_button {   //define radio button
            key = "p3" ;    //give it a name
            label = "3" ;
            //give it a label
            }     //end definition
      
          : radio_button {   //define radio button
            key = "p4" ;    //give it a name
            label = "4" ;
            //give it a label
            }
            }
     : button 
     {
     key = "accept";
     label = "INSERT";
     is_default = true;
     fixed_width = true;
     alignment = centered;
     }
     
         : row {     //define row
     
         : image {     //define image tile
         key = "im" ;    //give it a name
         height = 1.0 ;    //and a height
         width = 3.0 ;    //and now a width
         }      //end image
     
         : paragraph {    //define paragraph
         : text_part {    //define text
         label = "Created by Reid Booe";  //give it some text
         }
     
         }      //end paragraph
     
         }      //end row
         
         }      //end dialog
    Code:
    (defun C:test ( )
    (setq dcl_id (load_dialog "Panel.dcl"))
         (if (not (new_dialog "Panel" dcl_id))
      (exit)
         );if
     
      (setq w (dimx_tile "im")    ;get image tile width
            h (dimy_tile "im")    ;get image tile height
     
    );setq
     
      (start_image "im")     ;start the image
      (fill_image 0 0 w h 5)    ;fill it with blue
      (end_image)      ;end image
     
      (action_tile "p1" "(setq panel \"1\")")  ;store hole type
      (action_tile "p2" "(setq panel \"2\")")  ;store hole type
      (action_tile "p3" "(setq panel \"3\")")  ;store hole type
      (action_tile "p4" "(setq panel \"4\")")  ;store hole type
    (action_tile "accept"
        "(done_dialog)"
    );action_tile
     
    (start_dialog)
    (unload_dialog dcl_id)
     (command "_insert" panel pause "" "" pause)
    (princ)

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    You need to test the method used to exit the dialog - may use the DIASTAT system variable for this; I made some changes to your code:

    Code:
    (defun C:test ( )
    (setq dcl_id (load_dialog "Panel.dcl"))
         (if (not (new_dialog "Panel" dcl_id))
      (exit)
         );if
     
      (setq w (dimx_tile "im")    ;get image tile width
            h (dimy_tile "im")    ;get image tile height
     
    );setq
     
      (start_image "im")     ;start the image
      (fill_image 0 0 w h 5)    ;fill it with blue
      (end_image)      ;end image
     
      (action_tile "p1" "(setq panel \"1\")")  ;store hole type
      (action_tile "p2" "(setq panel \"2\")")  ;store hole type
      (action_tile "p3" "(setq panel \"3\")")  ;store hole type
      (action_tile "p4" "(setq panel \"4\")")  ;store hole type
      (action_tile "accept" "(done_dialog 1)");action_tile
      (action_tile "cancel" "(done_dialog 0)");action_tile
     
    (start_dialog)
    (unload_dialog dcl_id)
    (if (= (getvar "DIASTAT") 1)
     (command "_insert" panel pause "" "" pause)
    )
    (princ)
    )
    Regards,

  5. #5
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    611

    Default

    Thank you soo much! I was pulling my hair out over here.

  6. #6
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    You're welcome!

    Another way is to test the value returned by START_DIALOG statement (1 for OK and 0 for Cancel).

    Regards,

  7. #7
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    611

    Default

    question. on new drawings I get this: ; error: Automation Error. Filer error

    But when I try it again and It works. What's wrong with the code?

    Not the same code as above but I do have the code you given me inside

  8. #8
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    611

    Default

    Registered forum members do not see this ad.

    I figured it out. Nevermind

Similar Threads

  1. command line up arrow question, and grip edit distance question
    By Rebel in forum AutoCAD Drawing Management & Output
    Replies: 7
    Last Post: 2nd Jun 2008, 03:15 pm
  2. question
    By Raul Ramirez in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 3rd Feb 2006, 04:30 pm
  3. Some Question - PLZ Help
    By Zone in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 30th Sep 2005, 08:14 pm

Bookmarks

Posting Permissions

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