Jump to content

Recommended Posts

Posted

is it possible to be able to have a block with text that only rotates to two angles. I have a rectangle block and when its rotated i want the text to only rotate 90 if the whole block is rotated 90 or 270 and not to rotate if its rotated 180, is this possible. And to make things harder im trying to add the text to the block definition after the blocks with no text have been inserted and rotated already... any suggestions?

Posted

I don't think its possible with a standard block and its not that easy to do (but not impossible) with a dynamic block. With a dynamic block I think you will still have to manually adjust the text angle though.

Posted

If your block text is attributes, try this, just pick an instace of the block you need to correct.

 

;;; Attribute orientation
;;; This function will correct the text rotation of all attributes whose text reads downwards or upside down.
;;; Created 2007-06-29

(defun c:attorient ()
 (setq blockname (cdr (assoc 2 (entget (car (entsel))))))
 (setq sset (ssget "x" (list (cons 2 blockname))))
 (setq ent-index 0)
 (setq update-index 0)
 (repeat (sslength sset)
   (setq blkname (ssname sset ent-index))
   (setq blklist (entget blkname))
   (setq attname (entnext blkname))
   (setq attlist (entget attname))
   (while (/= (cdr (assoc 0 attlist)) "SEQEND")
     (setq attangle (cdr (assoc 50 attlist)))
     (if (and (> attangle (* pi 0.5)) (<= attangle (* pi 1.5)))
       (progn
  (setq attlist (subst (cons 50 (- attangle pi)) (assoc 50 attlist) attlist))
  (entmod attlist)
  (entupd attname)
  (setq update-index (1+ update-index))
       )
     ); if
     (setq attname (entnext attname))
     (setq attlist (entget attname))
   ); while
   (setq ent-index (1+ ent-index))
 ); repeat
 (princ (strcat "\n" (itoa update-index) " attribute(s) rotated."))
 (princ)  
)

 

EDIT: for best results, middle-center justify your attributes... :shock:

Posted

I wonder if the new constraints features will be able to assist with instances such as this. I am sure they will be developed to over time, if not .

  • 1 month later...
Posted
If your block text is attributes, try this, just pick an instace of the block you need to correct.

 

;;; Attribute orientation
;;; This function will correct the text rotation of all attributes whose text reads downwards or upside down.
;;; Created 2007-06-29

(defun c:attorient ()
 (setq blockname (cdr (assoc 2 (entget (car (entsel))))))
 (setq sset (ssget "x" (list (cons 2 blockname))))
 (setq ent-index 0)
 (setq update-index 0)
 (repeat (sslength sset)
   (setq blkname (ssname sset ent-index))
   (setq blklist (entget blkname))
   (setq attname (entnext blkname))
   (setq attlist (entget attname))
   (while (/= (cdr (assoc 0 attlist)) "SEQEND")
     (setq attangle (cdr (assoc 50 attlist)))
     (if (and (> attangle (* pi 0.5)) (<= attangle (* pi 1.5)))
       (progn
     (setq attlist (subst (cons 50 (- attangle pi)) (assoc 50 attlist) attlist))
     (entmod attlist)
     (entupd attname)
     (setq update-index (1+ update-index))
       )
     ); if
     (setq attname (entnext attname))
     (setq attlist (entget attname))
   ); while
   (setq ent-index (1+ ent-index))
 ); repeat
 (princ (strcat "\n" (itoa update-index) " attribute(s) rotated."))
 (princ)  
)

EDIT: for best results, middle-center justify your attributes... :shock:

 

 

What a great lisp! Thank you very much.

Posted

Maybe a dynamic block with visibility states. Where you actually have two occurences of the attribute, or utilise a field, and only one is visible?

 

My exposure and expertise to dynamic blocks isn't great - suggestion is based on theory.

Posted
Maybe a dynamic block with visibility states. Where you actually have two occurences of the attribute, or utilise a field, and only one is visible?

 

My exposure and expertise to dynamic blocks isn't great - suggestion is based on theory.

if you can get it to work I'll be happy. I know it is possible but requires a number of sideways steps. Basically the field is not exposed at both creation and insertion stages. You can link a field/attribute to its created state or its first inserted state. I can't get the link to remain in a modified state.
Posted
if you can get it to work I'll be happy. I know it is possible but requires a number of sideways steps. Basically the field is not exposed at both creation and insertion stages. You can link a field/attribute to its created state or its first inserted state. I can't get the link to remain in a modified state.

 

Like I say: all based on theory from myself. Are you still using AutoCAD 2008? We could ask someone on the latest release to test it out if so?

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