Jump to content

Recommended Posts

Posted (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

 

controle.gif

Edited by hanskes
Posted

It is not really necessary to use a loop. Fixes problem 1.

Posted

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

 

Posted

Works! Any thoughts about the inputbox and (if (string= controle "akkoord") --> "-" instead of number?

Posted
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.

Posted (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 by hanskes
Posted

"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.

 

image.png.1e9c4801d763bc6cbaff099f4582c7b3.png

 

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...