dynamic text in attribute
Hello,I want to add an attribute with dynamic text to a block.Our attribute should have a default value followed with a asked value.for example:A block with attribute “boring”. The displayed value should be “boring” followed with a requested value asked in command line. Every time we insert a block it should ask only the number.Second, it should be a movable attribute (the whole text).
">
Comments
-
To my knowledge this is currently not supported in Bricscad. You could try creating a lisp function to accomplish this.
0 -
hi,
I never worked with lisp.
can you recommend me a good website to accomplish this with lisp as a beginner?thanks in advance
0 -
Hi Alexander,Have you seen our GeoTools product? We have a tool to interactively move and rotate attributes from existing blocks.
See below:
http://www.4d-technologies.com/geotools/manual/block_tools.htm#ATTMOVE
From your sample image shown, it appears this is exactly what our GT_ATTMOVE command does.
Are you asking for a tool that would allow you to interactively place a block and then ask for a location for the attribute. That would be a good enhancement or opportunity to create a new tool.
GeoTools is entirely in Lisp.
Regards
Rakesh Rao
Blog: http://rakeshrao.typepad.com0 -
If you want to learn more about lisp I highly recommend this German website:
http://www.autolisp-tutorial.mapcar.net/Another interesting site:
http://www.afralisp.net/A few lessons from afralisp have been translated into Dutch:
http://www.cadsite.be/lisp/lisp.phpBelow is some code that may work for you. Using the examples c:Bor and c:Test you can create your own functions.
(defun InsertNumBlock (block scale ang pre suf / i oldAttdia pt quotedGlobalVar)
(setvar 'cmdecho 0)
(setq oldAttdia (getvar 'attdia))
(setq quotedGlobalVar (read (strcat "*globalNr" block "*")))
(if (not (eval quotedGlobalVar))
(set quotedGlobalVar 1)
)
(if (setq i (getint (strcat "\nStart number <" (itoa (eval quotedGlobalVar)) ">: ")))
(set quotedGlobalVar i)
)
(while (setq pt (getpoint "\nInsertion point or ENTER to quit: "))
(setvar 'attdia 0) ; since there is no error function change attdia as late as possible...
(command "_.insert" block pt scale scale ang (strcat pre (itoa (eval quotedGlobalVar)) suf))
(while (> (getvar 'cmdactive) 0)
(command "")
)
(setvar 'attdia oldAttdia) ; ... and change it back to the old value as soon as possible
(set quotedGlobalVar (1+ (eval quotedGlobalVar)))
)
(princ)
)
(defun c:Test ()
(InsertNumBlock "TestBlock" 1 0 "Text before number " " text after number")
)
(defun c:Bor ()
(InsertNumBlock "boring" 1 0 "Boring " "")
)0 -
0