gfreddog
2008-07-30, 06:12 PM
I have an existing LISP that inserts a block with 1 attribute in it and can sequentially number it also:
;WIRE - drops in sequentially numbered WIRE NUMBER blocks
(DEFUN C:WIRE()
(COMMAND "LAYER" "SET" "OUR_Text""")
(setq prefix (getstring "Enter Prefix: (default=none) "))
(setq suffix (getstring "Enter Suffix: (default=none) "))
(setq nmber (getstring "Enter starting number: (default= 1) "))
(if (= nmber "")(setq nmber "1"))
(setq blok (getstring "Enter Block to use(WIRE NUMBER): (default= WIRE NUMBER) "))
(if (= blok "")(setq blok "WIRE NUMBER"))
(setq num (atoi nmber))
(setq p (getpoint "Location: "))
(while
(not (atom p))
(setq txt (strcat prefix (itoa num) suffix))
(setvar "attdia" 0)
(setvar "attreq" 1)
(COMMAND "INSERT" blok p 1 1 0 txt)
(setvar "attdia" 1)
(setvar "attreq" 1)
(setq num (1+ num))
(setq p (getpoint (getvar "lastpoint") "Location: "))
)
(COMMAND)
)
I'd like to use a different block with 2 Attributes.
Attribute 1 would be for a wire type which would stay the same for each insertion of the block during the instance the LISP is run.
Attribute 2 would be the wire number which would function as the it does in the original LISP.
I know I also have to change the block, but I need help with the LISP part.
Any ideas?
;WIRE - drops in sequentially numbered WIRE NUMBER blocks
(DEFUN C:WIRE()
(COMMAND "LAYER" "SET" "OUR_Text""")
(setq prefix (getstring "Enter Prefix: (default=none) "))
(setq suffix (getstring "Enter Suffix: (default=none) "))
(setq nmber (getstring "Enter starting number: (default= 1) "))
(if (= nmber "")(setq nmber "1"))
(setq blok (getstring "Enter Block to use(WIRE NUMBER): (default= WIRE NUMBER) "))
(if (= blok "")(setq blok "WIRE NUMBER"))
(setq num (atoi nmber))
(setq p (getpoint "Location: "))
(while
(not (atom p))
(setq txt (strcat prefix (itoa num) suffix))
(setvar "attdia" 0)
(setvar "attreq" 1)
(COMMAND "INSERT" blok p 1 1 0 txt)
(setvar "attdia" 1)
(setvar "attreq" 1)
(setq num (1+ num))
(setq p (getpoint (getvar "lastpoint") "Location: "))
)
(COMMAND)
)
I'd like to use a different block with 2 Attributes.
Attribute 1 would be for a wire type which would stay the same for each insertion of the block during the instance the LISP is run.
Attribute 2 would be the wire number which would function as the it does in the original LISP.
I know I also have to change the block, but I need help with the LISP part.
Any ideas?