Author Topic: Attributes rotated at their insert point  (Read 2882 times)

0 Members and 1 Guest are viewing this topic.

TJAM51

  • Guest
Attributes rotated at their insert point
« on: March 02, 2005, 08:40:50 AM »
I am seeking a routine that will allow me to rotate attributes at their insertion point either by picking them individually or several through crossing.


Thanks

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Attributes rotated at their insert point
« Reply #1 on: March 02, 2005, 08:42:25 AM »
Rotate to 0 or someother angle?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Attributes rotated at their insert point
« Reply #2 on: March 02, 2005, 08:44:02 AM »
This does one at a time.
Code: [Select]
(Defun C:AT0 ()
  (setvar "cmdecho" 0)
  (princ "\nSelect attribute {0 degrees}: ")
  (command "attedit" "y" "*" "*" "*" PAUSE "" "A" "0" "")
  (setvar "cmdecho" 1)
  (princ)
)
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

TJAM51

  • Guest
Attributes rotated at their insert point
« Reply #3 on: March 02, 2005, 08:44:22 AM »
0 and possibley another angle.....more towards 0 than any other angle.




Thanks

hudster

  • Gator
  • Posts: 2848
Attributes rotated at their insert point
« Reply #4 on: March 02, 2005, 09:00:32 AM »
This changes angles, colours etc.

Code: [Select]
; Change Attribute Properties en masse
;; A series of routines for changing attribute properties on a mass of attributes.
;; Can change each proprty, i.e. the layer, color, style, layer etc of many attributes at once.
;;
;; Also a routine to change attribute text to upper case.
;;
;; Another to transfer data from one attribute to another. Handy if you are updating or
;; replacing blocks with a new version, i.e. line number racetrack blocks. Also copies from
;; text to attribute but not from attribute to text.
;;
;; Another routine if you drawing piping GA's using line numbers for layer names. Get the
;; layer name from an object and paste into the attribute in a line number racetrack block.
;;


;;;Attribute style change
(defun c:asc ()
(setq atts(getstring "\nEnter new attribute style: "))
(command "attedit" "y" "*" "*" "*" "c" pause pause)
(while
(= 1 (logand (getvar "cmdactive") 1))
(command "s" atts "n")
);;; end while
);;; end lisp

;;;Attribute height change
(defun c:ahc ()
(setq atth(getreal "\nEnter new attribute height: "))
(command "attedit" "y" "*" "*" "*" "c" pause pause)
(while
(= 1 (logand (getvar "cmdactive") 1))
(command "h" atth "n")
);;; end while
);;; end lisp

;;;Attribute angle change
(defun c:aac ()
(setq atta(getint "\nEnter new attribute angle: "))
(command "attedit" "y" "*" "*" "*" "c" pause pause)
(while
(= 1 (logand (getvar "cmdactive") 1))
(command "a" atta "n")
);;; end while
);;; end lisp

;;;Attribute color change
(defun c:acc ()
(setq attc(getint "\nEnter new attribute color: "))
(command "attedit" "y" "*" "*" "*" "c" pause pause)
(while
(= 1 (logand (getvar "cmdactive") 1))
(command "c" attc "n")
);;; end while
);;; end lisp

;;;Attribute layer change
(defun c:alc ()
(setq attl(getstring "\nEnter new attribute layer: "))
(command "attedit" "y" "*" "*" "*" "c" pause pause)
(while
(= 1 (logand (getvar "cmdactive") 1))
(command "l" attl "n")
);;; end while
);;; end lisp

;;; Block attribute case change
(defun c:AttUpper ()
 (setq ATWC1(nentsel "\nSelect block data from: "))
  (setq ATWC2(car ATWC1))
   (setq ATWC3(entget ATWC2))
    (setq ATWC4(cdr(assoc 1 ATWC3)))
     (setq ATWC5(cdr(assoc 10 ATWC3)))
  (setq ATWCTXT (Strcase ATWC4))
(command "attedit" "n" "y" "*" "*" "*" ATWC5 "" ATWC4 ATWCTXT)
)

;;; Block attribute data transfer
(defun c:BADT ()
 (setq e1s(nentsel "\nSelect block data from: "))
 (setq e2s(nentsel "\nSelect block data to: "))
  (setq e1n(car e1s))
  (setq e2n(car e2s))
   (setq e1d(entget e1n))
   (setq e2d(entget e2n))
    (setq e1dd(cdr(assoc 1 e1d)))
    (setq e2dd(cdr(assoc 1 e2d)))
     (setq e1p(cdr(assoc 10 e1d)))
     (setq e2p(cdr(assoc 10 e2d)))
  (setq tt1 e1dd)
  (setq tt2 e2dd)
(command "attedit" "n" "y" "*" "*" "*" e2p "" tt2 tt1)
)

;;; Layer name to block attribute
(defun c:LTATT ()
 (setq en1s(nentsel "\nSelect entity on layer: "))
 (setq en2s(nentsel "\nSelect block data to: "))
  (setq en1n(car en1s))
  (setq en2n(car en2s))
   (setq en1d(entget en1n))
   (setq en2d(entget en2n))
    (setq en1dd(cdr(assoc 8 en1d)))
    (setq en2dd(cdr(assoc 1 en2d)))
     (setq en1p(cdr(assoc 10 en1d)))
     (setq en2p(cdr(assoc 10 en2d)))
  (setq ttn1 en1dd)
  (setq ttn2 en2dd)
(command "attedit" "n" "y" "*" "*" "*" en2p "" ttn2 ttn1)
)
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

whdjr

  • Guest
Attributes rotated at their insert point
« Reply #5 on: March 02, 2005, 09:27:41 AM »
Here's mine that rotates the selected attributes to World UCS:

Code: [Select]
(defun *get_atts* (obj)
  (vlax-safearray->list
    (vlax-variant-value
      (vla-getattributes
(if (eq (type obj) 'ENAME)
 (vlax-ename->vla-object obj)
 obj
)
      )
    )
  )
)

(defun c:attrot (/ ss len)
  (prompt "\nSelect attributes to rotate to World UCS:  ")
  (if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
    (repeat (setq len (sslength ss))
      (setq len (1- len))
      (foreach atts (*get_atts* (ssname ss len))
(vla-put-rotation atts 0)
      )
    )
  )
  (princ)
)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Attributes rotated at their insert point
« Reply #6 on: March 02, 2005, 10:29:59 AM »
Uh ... how about something that works in the background in VBA to automatically set the attributes to 0 when you insert the block.

I created our blocks with the attributes center justified and oriented so they rotate around a specific point.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

whdjr

  • Guest
Attributes rotated at their insert point
« Reply #7 on: March 02, 2005, 10:37:22 AM »
um...that would work too.

 :D


That sounds like a good one Keith.  Do you ever have any multi-lined text?  How does it work with that?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Attributes rotated at their insert point
« Reply #8 on: March 02, 2005, 11:06:35 AM »
Most of our attributes are only one or 2 per block and that works great. If there were more than 1 it would create an issue with the orientation, since the insertion point would need to be recalculated as well.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie