×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

need help adding text to string

need help adding text to string

need help adding text to string

(OP)
I have downloaded a routine for doing arc dimensions in acad 2002. it works for what we need it to do but i would like to add the text (ARC LENGTH) after the numeric value. Also i would like to retrieve the units settings and reset them back after the routine runs. below is the code:

CODE

;arcdim.lsp   Arc Length   (c)1998, Paul Standing

;MEASURES THE LINEAR LENGTH OF ARCS AND DIMENSIONS THE ARC TO THE
        (defun dtr (x)
        (* pi (/ x 180.00))
        )
        
        (defun rtd (y)
        (/ (* 180 y) pi)
        )
        
       (defun right ()
         (setq ang1 (angle ep cen)
              ang2 (angle ep1 cen)
              ang (- ang1 ang2)
              arclen (abs(* rad ang))
         )
        )
       
        (defun left ()
        (setq ang (- a1 a2))
        (setq arclen (abs(* rad ang)))
        )

;_______________________________________________________________________        

        (defun C:arcdim (/ ang1 ang2 ang arclen rad pick_pt pick_ang
        cen pick_pt extpt1 extpt2 extpt3 extpt4 ep a1 a2 ep1 e6 e7 ent4 temp_pt1
        temp_pt2 temp_pt3 temp_pt4 e1 e2 e3 e4 text_ang th txt1 txt e5 ep1a epa
        ep1a1 epa1 search type)
        (setvar "cmdecho" 0)
    (command "-units" "5" "32" "1" "2" "0" "n" "")
        (setvar "blipmode" 0)
        (setq cn (entsel "\nSelect arc to dimension: "))
        (setq dn (car cn))
        (setq aw (entget dn))
        (setq type (cdr(assoc 0 aw)))
     (if (= type "ARC")
          (progn
        (setq a1 (cdr (assoc 50 aw)))
        (setq a2 (cdr (assoc 51 aw)))
        (setq cen (cdr (assoc 10 aw))
              rad (cdr (assoc 40 aw)))
        (setq ep (polar cen (cdr (assoc 50 aw)) rad)
              ep1 (polar cen (cdr (assoc 51 aw)) rad))
                  (if (< a1 a2) (left)
                      (right)
                   )
         (prompt "\nEnter dimension location: ")
         (command "dim" "angular" "" cen ep ep1 pause (rtos arclen) "" "exit")
 
            )
        (prompt "\nThe Selected entity was not an arc ")
    )
    (setvar "clayer" "0")
    (setvar "cmdecho" 1)
    ;(setvar "blipmode" 1)

                         (princ)
)
        (princ "\nType arcdim to envoke the command: ")
       

RE: need help adding text to string

To add "ARC LENGTH" modify the following line:

(command "dim" "angular" "" cen ep ep1 pause (rtos arclen) "" "exit")

to:

CODE

(command "dim" "angular" "" cen ep ep1 pause (strcat (rtos arclen) " ARC LENGTH") "" "exit")

To save user units settings add the following snippet after the line (setvar "cmdecho" 0)

CODE

(setq UsrAunits (getvar "AUNITS")
      UsrAuprec (getvar "AUPREC")
      UsrLunits (getvar "LUNITS")
      UsrLuprec (getvar "LUPREC")
      UsrAngdir (getvar "ANGDIR")
)

And to restore settings, add the following lines just before the line (setvar "cmdecho" 1):

CODE

(setvar "AUNITS" UsrAunits)
(setvar "AUPREC" UsrAuprec)
(setvar "LUNITS" UsrLunits)
(setvar "LUPREC" UsrLuprec)
(setvar "ANGDIR" UsrAngdir)



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close