Johnc Posted June 5, 2015 Posted June 5, 2015 Hello all, Struggling with this I have a larger expression in which I get the name of a block. I would like to use the tcase to convert the attribute text to upper case. This works at the command line with "-tcase" "last" "UPPER" But I cant get the expression to take the block name. Tried the (acet-tcase (ssget) "upper") without success Thanks in advance John sample code.txt Quote
tombu Posted June 5, 2015 Posted June 5, 2015 To change text to UPPER (or lower) case in lisp use the strcase function: http://help.autodesk.com/view/CIV3D/2016/ENU/?guid=GUID-108DCD2C-6597-4548-856D-937787AFE5E0 Quote
tombu Posted June 5, 2015 Posted June 5, 2015 I do use (acet-tcase-change-string str "Title") often for Title case. You do have to place (load "TcaseSup.lsp") earlier in you code though. It only autoloads if you enter tcase at the command line. Quote
Lee Mac Posted June 5, 2015 Posted June 5, 2015 I do use (acet-tcase-change-string str "Title") often for Title case. You do have to place (load "TcaseSup.lsp") earlier in you code though. You may find these functions of interest Quote
Johnc Posted June 5, 2015 Author Posted June 5, 2015 Great thanks for the help, I wanted to use this function as its all the attribute text of a block I want to make upper case. In my current code I don't get the attribute text strings just the block name and wanted to pass this to the (acet-tcase "block name" "UPPER") if possible? Thanks John Quote
Lee Mac Posted June 5, 2015 Posted June 5, 2015 As suggested by tombu above, use the strcase function to convert a string to uppercase. Here is a quick example: (defun c:tc ( / ent enx ) (if (and (setq ent (car (entsel))) (= "INSERT" (cdr (assoc 0 (setq enx (entget ent))))) (= 1 (cdr (assoc 66 enx))) (setq ent (entnext ent) enx (entget ent) ) ) (while (= "ATTRIB" (cdr (assoc 0 enx))) (entmod (subst (cons 1 (strcase (cdr (assoc 1 enx)))) (assoc 1 enx) enx)) (setq ent (entnext ent) enx (entget ent) ) ) (princ "\nNo object selected or selected object is not a block.") ) (princ) ) Quote
Johnc Posted June 5, 2015 Author Posted June 5, 2015 That works great Many thanks for all the help Best wishes John Quote
Recommended Posts
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.