Jump to content

Recommended Posts

Posted

This code is changing the oblique angle of my text in the variable...

 

(setq text-to-oblique (entget (entlast)))

(setq text-to-oblique (subst (cons 51 15.0)(assoc 51 text-to-oblique) text-to-oblique))

(entmod text-to-oblique)

 

...but not in the entity?

 

the resultant variable reads 51 . 15.0 for the oblique angle but when I check the actual entity it still reads 51 . 2.4338 (I don't know why it has this number because usually it's 51 . 0)

 

Any assistance appreciated.

Posted

Hi John,

 

Looks like you have radian/degree mix up.

 

include this in your code somewhere:

 

(defun dtr (x)
  (* pi (/ x 180.0))
) ; end dtr

Then use it in the main LISP to convert the 15 degrees into radians:

 

i.e.

 

(cons 51 (dtr 15.0)) 

Posted

Or

 

(setq text-to-oblique(subst(cons 51[color="Blue"](angtof "15.0")[/color])(assoc 51 text-to-oblique)text-to-oblique))

Posted

Thanks Lee!

 

that made me smile.

 

LISP is great!

Posted

Thank you very much ASMI

 

I didn't know about that function but I do now.

Posted

Just thought I'd post this for you John, may help :P

 

; Italic Text by Lee McDonnell
; 
; SYNTAX: itxt
;
; [leebob3@hotmail.com for queries]

(defun c:itxt (/ ss1 ssl index tents ent1 entyp)
   (if     (not (getenv "itxt:ang"))
       (setenv "itxt:ang" "20.0")
   ) ; end if
   (princ (strcat "\nType \"ITXTANG\" to set Obliquing Angle - Current Angle: "
           (getenv "itxt:ang"))
   ) ; end princ    
   (setq     ss1     (ssget))
   (setq     ssl     (sslength ss1)
       index     0
       tents     0
   ) ; end setq
   (repeat ssl
       (setq     ent1     (entget (ssname ss1 index))
           entyp    (cdr (assoc 0 ent1))
       ) ; end setq
       (if
           (= entyp "TEXT")
           (progn
               (setq ent1
                   (subst (cons 51 (dtr (atof (getenv "itxt:ang")))) (assoc 51 ent1) ent1)
               ) ; end setq
               (entmod ent1)
               (setq tents (+ tents 1))
           ) ; end progn
       ) ; end if
       (setq index (+ index 1))
   ) ; end repeat
   (if (/= tents 1)
   (alert (strcat (itoa tents) " Text Entities Modified."))
   (alert (strcat (itoa tents) " Text Entity Modified. "))
   ) ; end if
   (princ)
) ; end defun
           

(defun c:itxtang (/ ang)
   (if     (not (getenv "itxt:ang"))
       (setenv "itxt:ang" "20.0")
   ) ; end if
   (princ (strcat "\nCurrent Settings: " (getenv "itxt:ang")))
   (if    (setq ang
           (getreal (strcat "\nSpecify Obliquing Angle <" 
                   (getenv "itxt:ang") 
                   "> :")) ; end getreal
       ) ; end setq
       (setenv "itxt:ang" (rtos ang))
   ) ; end if
   (princ "\nObliquing Angle Set.")
   (princ)
) ; end defun
   

(defun dtr (x)
   (* pi (/ x 180.0))
) ; end dtr

 

Let me know if this helps at all :)

Posted

Thanks for the afterthought, Lee.

 

I can certainly learn for this.

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