gtwatson 发表于 2022-7-6 10:03:56

 
I looked up attreq and it has something to do with blocks and prompts that I don't quite understand.
 
1
Turns on prompts or a dialog box for attribute values, as specified by ATTDIA
 
 
As you can tell, I am no programmer of LISP.I used to do some FORTRAN and once learned ICAD which was an AI language based on lisp.I am an Engineer that plays with ACAD to produce drawings.
 
I would guess that attreq being off caused the attributed text to be inserted and not the value I wanted to be put in the box or circle.
 
Thanks for all the help.I will probably be back to ask more dumb lisp questions, so be patient with an old FORTRAN programmer.

gtwatson 发表于 2022-7-6 10:06:45

 
I was thinking that it would be nice to combine an alpha character in front of the integer but I'm not sure how to apply strcat.

Lee Mac 发表于 2022-7-6 10:12:45

 
Try something like this:
 

(defun c:mem nil (InsertBlock "memnum" "\nEnter Member Number to start with: "))(defun c:joi nil (InsertBlock "jn"   "\nEnter Joint Number to start with: "))(defun InsertBlock ( block msg / *error* old pre pt scale val var ) (defun *error* ( msg )   (if old (mapcar 'setvar var old))   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")       (princ (strcat "\n** Error: " msg " **")))   (princ) ) (setq var '("CMDECHO" "ATTREQ") old (mapcar 'getvar var)) (mapcar 'setvar var '(0 1)) (if   (or   (tblsearch "BLOCK" block)   (findfile (strcat block ".dwg"))   )   (if   (and       (setq pre (getstring t "\nSpecify Prefix : "))       (setq val (getint msg))       (progn         (initget 6) (setq scale (getint "\nEnter scale factor: "))       )   )   (while (setq pt (getpoint "\nPick next Point: "))       (command "_.-insert" block "_S" scale "_non" pt "" (strcat pre (itoa val)))       (setq val (1+ val))   )   )   (princ (strcat "\n--> " block ".dwg not Found.")) ) (mapcar 'setvar var old) (princ))
 
BTW, with regards to ATTREQ: If set to 0, you will not be prompted to 'Enter Attributes' when inserting a block, otherwise, if set to 1, the prompt will appear.

gtwatson 发表于 2022-7-6 10:15:23

Many thanks, that worked perfectly. I'll stop begging for Lisp help and try to learn some on my own.

Lee Mac 发表于 2022-7-6 10:21:24

You're very welcome   Good luck with your learning!

gtwatson 发表于 2022-7-6 10:21:36

Let me know if you ever need any lattice Transmission Towers or tapered tubular poles designed (my area of expertise) and I'll be glad to help.
 
These numbers in boxes are used to define a member size on a schematic drawing. It will tell the structure detailer the angle size, the number of bolts, and number of holes out as well as which leg is bolted, in case you had a burning desire to know how this lisp code is used.
 
I originally created it back last millinium to annotate a drawing. The circles with numbers designated the joint number and the boxes defined the member number when I was doing my structural model of a 3 dimensional truss. The ACAD drawing was used to document the model to see what member went where.

Lee Mac 发表于 2022-7-6 10:26:41

 
Thanks, I'll keep you in mind if I ever have that need
页: 1 [2]
查看完整版本: It used to work, but quit