hanskes Posted May 11, 2021 Posted May 11, 2021 (edited) I am working on a lisp routine for placing a block which is used for digitally checking construction drawings. The block contains 3 attribute, an attribute with a number that increases with each time the block is placed, an attribute that indicates the status of the comment and the comment itself. I run into a few things. If I cancel the placement of the blocks with esc, and continue later, a number is skipped. I do not want to place a number for checked matters that have been approved. In addition, I would like to use an input box for specifying the comment description. - how can I prevent a number from being skipped? (see gif file) - the routine below gives an error if I use the lines with; turn it on, what's going wrong here? - the input box (https://www.afralisp.net/dialog-control-language/tutorials/the-autolisp-input-box.php) gives an error: * Lisp (new_dialog) failed: DCL id = -1, dialog name 'inputbox' ; error: quit / exit abort I hope someone can help me move forward. (defun c:controleblok () (while T (command "-layer" "m" (strcat "00-C" typesymbool1) "c" (strcat laagkleur1) "" "") (command "_.insert" (findfile "controle1.dwg") pause ; for insertion point "" "" "" ; default scales/rotation ;(if (string= controle "akkoord") ;"-" (if attnum (itoa (setq attnum (1+ attnum))) (itoa (setq attnum (getint "startnummer: "))) );) "" ;(inputbox "opmerking:" "plaats opmerking" "") (strcat controle) ) ) );defun Edited May 11, 2021 by hanskes Quote
hanskes Posted May 11, 2021 Author Posted May 11, 2021 It is not really necessary to use a loop. Fixes problem 1. Quote
tombu Posted May 11, 2021 Posted May 11, 2021 Untested but seems like setting the number to a temporary local variable for the block insert and only setting the attnum value afterwards should do the trick. (defun c:controleblok ( / temp) (while T (command "-layer" "m" (strcat "00-C" typesymbool1) "c" (strcat laagkleur1) "" "") (command "_.insert" (findfile "controle1.dwg") pause ; for insertion point "" "" "" ; default scales/rotation ;(if (string= controle "akkoord") ;"-" (if attnum (itoa (setq temp (1+ attnum))) (itoa (setq temp (getint "startnummer: "))) );) "" ;(inputbox "opmerking:" "plaats opmerking" "") (strcat controle) );insert (setq attnum temp) );while );defun Quote
hanskes Posted May 11, 2021 Author Posted May 11, 2021 Works! Any thoughts about the inputbox and (if (string= controle "akkoord") --> "-" instead of number? Quote
tombu Posted May 11, 2021 Posted May 11, 2021 52 minutes ago, hanskes said: Works! Any thoughts about the inputbox and (if (string= controle "akkoord") --> "-" instead of number? As "string=" isn't defined in the code you posted and is missing closing parenthesis you would need to post the rest of the code for anyone to figure that out. Quote
hanskes Posted May 12, 2021 Author Posted May 12, 2021 (edited) The whole code was in my first post. This part was commented out because it didn't work. I tried this: (defun c:controleblok (/ temp) (while T (command "-layer" "m" (strcat "00-CTR" typesymbool1) "c" (strcat laagkleur1) "" "") (command "_.insert" (findfile "controle1.dwg") pause ; for insertion point "" "" "" ; default scales/rotation (if (string= controle "akkoord") "-" (if attnum (itoa (setq temp (1+ attnum))) (itoa (setq temp (getint "startnummer: "))) ) ) "" (inputbox "opmerking:" "plaats opmerking" "") (strcat controle) ) ;insert (setq attnum temp) ) ;while ) ;defun I want to check if the variable controle matches the akkoord text. The variable is set separately from the lisp routine with a command button: (setq control "akkoord"). If it matches, a dash is entered in the attribute, otherwise a incremental number. As for the inputbox, this is an existing lisp routine from https://www.afralisp.net/dialog-control-language/tutorials/the-autolisp-input-box.php When I try to run this I get this error in Bricscad: * Lisp (new_dialog) failed: DCL id = -1, dialog name 'inputbox' ; error: quit / exit abort Edited May 12, 2021 by hanskes Quote
BIGAL Posted May 13, 2021 Posted May 13, 2021 "If it matches, a dash is entered in the attribute, otherwise a incremental number." Look at this maybe as a front end. Multi radio buttons.lsp its in the Down load section. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.