+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 33
  1. #1
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Apr 2008
    Posts
    43

    Default A Spin on Attributes...? Can this be done??

    Registered forum members do not see this ad.

    Attached is a dwg of a bunch of 2 x 4 lights with three attributes...

    What I want to know is - could it be possible to automate the rotation of these attributes as I have them shown.

    The problem is, depending on the roration angle of the inserted block, the insertion points of the attributes will change.

    I have a routine that will rotate all atributes horizontal - but it does not change the insertion points....

    Code:
    (defun C:2ft_x_4ft ( )
    (setvar "cmdecho" 0)
    (setvar "orthomode" 1)
    (SETVAR "attreq" 0)
    (setq ds (getvar "dimscale"))
    (setq ip (getpoint "Insertion Point:"))
    (setq clay (getvar "clayer"))
     (command "-layer" "s" "E-LITE-CLNG-NEW" "")
     (command "insert" "2ft_x_4ft" ip ds "" pause)
    (SETVAR "attreq" 1)
    (SETQ ENT (entlast))
    (SETQ NXT (ENTNEXT ENT))
           (IF (/= NXT nil)
             (progn
                   (SETQ VAR (ENTGET NXT))
                   (WHILE (= (CDR (ASSOC 0 VAR)) "ATTRIB")
                      (SETQ VAR (SUBST '(50 . 0.0) (ASSOC 50 VAR) VAR))
                      (ENTMOD VAR)
                      (ENTUPD ENT)
                      (SETQ NXT (ENTNEXT NXT))
                      (SETQ VAR (ENTGET NXT))
                   )
              )
           )
    (SETVAR "attreq" 1)
     (setvar "clayer" clay)
    (princ)
    )



    ATRIBS.dwg

    I'm sure something like this has been done in the past - can anyone help out?

    mhamilton5@neo.rr.com

  2. #2
    Senior Member neekcotrack's Avatar
    Using
    MEP 2009
    Join Date
    May 2008
    Location
    Florida
    Posts
    329

    Default

    Are you trying to insert and no matter what angle you put the block at the attribute in the block or outside of it will always me at 0? How are you inserting the blocks?

  3. #3
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Apr 2008
    Posts
    43

    Default followup

    Yes - no matter what angle I insert the block the text will be horizontal (rotation angle = zero)... but the trick is to get the insertion points of the attributes to move. I am inserting by clicking on an icon that runs the above listed routine.

  4. #4
    Senior Member JerryG's Avatar
    Discipline
    Civil
    JerryG's Discipline Details
    Occupation
    Stream Restoration
    Discipline
    Civil
    Using
    Civil 3D 2012
    Join Date
    Jan 2008
    Location
    Washington State
    Posts
    286

    Default

    Matt murphy from Augi did a great job of explaning just that problem.
    This is from some notes;
    "Under Attribute definition, check or uncheck the Lock position in block according to what results you are looking for"
    I believe (if my memory serves me correctly) that this can all
    be done through the block/attribute editor.

    Hope that helps

  5. #5
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Apr 2008
    Posts
    43

    Default hmmm....

    Matt,

    I want all this attribute moving stuff to happen automatically upon inserting a block. I do not want it to be a manual process. Select teh icon to insert a particular block... depending on the rotation angle the attributes reposition themselves to a standard. Then weh the user actually enters data into the attribute - the text will be preformattted to the standard.

    - mark

  6. #6
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Have you thought about two blocks ?

    Then you can always apply a rule to the text position.

  7. #7
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Apr 2008
    Posts
    43

    Default response

    Yes - but I would need 360 blocks. one for each angle - I just thought coding it would be cooler and more neat.

  8. #8
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    I have alterate one of my routines for this purpose:

    Code:
    (defun c:anor(/ blSet attLst errCount minPt maxPt mPt xPt nPt cX)
      (princ "<<< Select blocks with attributes >>>")
      (setq errCount 0)
      (if
        (setq blSet(ssget '((0 . "INSERT")(66 . 1))))
        (progn
          (setq blSet(mapcar 'vlax-ename->vla-object 
                        (vl-remove-if 'listp 
                         (mapcar 'cadr(ssnamex blSet)))))
          (foreach itm blSet
    	(setq attLst
    	       (vlax-safearray->list
    		 (vlax-variant-value
    		   (vla-GetAttributes itm))))
    	(foreach att attLst
    	  (if(vl-catch-all-error-p
    		   (vl-catch-all-apply
    		     'vla-put-Rotation(list att 0)))
    	    (setq errCount(1+ ErrCount))
    		  ); end if
    	  ); end foreach
    	(vla-GetBoundingBox(car attLst) 'minPt 'maxPt)
    	(setq cX
    	       (car
    		  (vlax-safearray->list minPt)))
    	(foreach att attLst
    	  (vla-GetBoundingBox att 'mPt 'xPt)
    	  (setq nPt(vlax-3D-point
    		     (list cX
    			   (cadr
    			     (vlax-safearray->list mPt))
    			   0.0)))
    	  (if(vl-catch-all-error-p
    		   (vl-catch-all-apply
    		     'vla-Move(list att mPt nPt)))
    	                nil
    		  ); end if
    	  ); end foreach
    	); end foreach
          ); end progn
        (princ ">>> Nothing selected! <<<")
        ); end if
      (if(/= 0 errCount)
        (princ
          (strcat ">>> "
    	(itoa errCount)
    	      " were on locked layers! <<< "))
    	      ); end if
      (princ)
      ); end of c:anor
    Find also AMOVE program to move multiple attributes in multiple blocks.

  9. #9
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Apr 2008
    Posts
    43

    Default Here is the problem

    ASMI,

    Here is the problem with your routine... I ran into the same problem...


    you start with this

    1.JPG

    then run anor.lsp

    and you end up with this

    2.JPG


    All the attributes pile up on top of each other.

    that is why this routine needs to some how move the insertion point too.

  10. #10
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Registered forum members do not see this ad.

    Ok, there is little problem. I will correct it.

Similar Threads

  1. attributes
    By GIB39 in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 9th Oct 2007, 10:51 pm
  2. attributes
    By chrisdarmanin in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 18th Sep 2007, 03:07 pm
  3. Attributes!
    By Jakasaurus in forum AutoCAD General
    Replies: 1
    Last Post: 25th Jun 2007, 06:03 pm
  4. Little help with ATTRIBUTES....
    By StykFacE in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 17th Jul 2006, 10:07 pm
  5. Attributes
    By Sherrissa in forum AutoCAD General
    Replies: 3
    Last Post: 9th May 2006, 02:49 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts