PDA

View Full Version : ATTRIBUTED BLOCK



bklagrone
2004-09-16, 02:20 PM
Is a way to create an attributed block that will do math operations.
Like enter two number and the third number will automatically display the difference.
This does no have to be a block any way will work!!

mjfarrell
2004-09-16, 02:39 PM
This can be done with Point Label styles in Land Desktop,
If you 'only' have MAP and not Land I'm not sure it will be
so easy.

MHultgren
2004-09-16, 02:41 PM
a simple Lisp routine would do this for you. Have it prompt for the numbers, insert the block and fill in the attribute as the product/quotient, sum or whatever math you want to do to the input. You can set the scale, rotation, layer, etc right in the routine to make sure the users don't have to think about maintaining standards.

If you send this question to the Lisp guild, I'm sure someone there (PeterJ ?) either has a routine that will get you started or can help you in the right direction.

[CODE] (defun C:SUB ()

(setvar "osmode" 8 )
(setvar "cmdecho" 0)

(setq clay (getvar "clayer"))
(setq snpa (getvar "snapang"))
(setq angl (angtos snpa 2 0))
(setq layblk "0-RCA-WW-SERVICES-CALCULATIONS")
(setq laytext "0-RCA-WW-SERVICES-CALCULATIONS")
(setq fnumb (getreal "\n First Number"))
(setq snumb (getreal "\nSecond Number"))
(setq attval (rtos(- fnumb snumb)2 2))'CHANGE THE TWOS TO GET THE FORMAT YOU WANT
(setq msg (strcat "\nSelect Point: "))
(setq p1 (getpoint msg))
(setq x (car p1))
(setq y (cadr p1))
(setq z (caddr p1))
(setq p1 (list x y z))
(setq p2 (list x y 0))
(setq p3 (polar p2 snpa 1.75))

(if (not (tblsearch "LAYER" layblk))
(command "LAYER" "NEW" layblk "C" "1" layblk "")
)
(command "LAYER" "SET" layblk "")
(command "INSERT" "RCA-CO-CALC-SERV" p1 "" "" angl attval)

(princ)
)
[CODE]
Hopefully this will get you started down the path.