Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted
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 :thumbsup:

Posted

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

Posted

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)
)

Posted

That works great

Many thanks for all the help

Best wishes

John

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...