Page 4 of 5 FirstFirst 12345 LastLast
Results 31 to 40 of 45

Thread: Reinsert Blocks - need help with routine

  1. #31
    Active Member
    Join Date
    2011-10
    Posts
    83
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    List apeares but when I select my blocks nothing happend
    Can you put names of my blocks inside routine. I have only these two blocks I want to "secure". I will use this lisp for many drawings using AutoScript program.

  2. #32
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Quote Originally Posted by Arterius View Post
    List apeares but when I select my blocks nothing happend
    Can you put names of my blocks inside routine. I have only these two blocks I want to "secure". I will use this lisp for many drawings using AutoScript program.
    I see. Dynamic Block, is that right Arterius?

    Code:
    (defun c:att2txt (/ _data data fdata ss i e from info)
    (vl-load-com)
    (setq blks (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object))))  
    (defun _data (en func l1 l2 rv)
      	(if l2
    	(mapcar '(lambda (j k)
    		   (func en j (if (and rv (/= 0 rv)
                                (eq j "Rotation")) (- k rv) k))) l1 l2)
      	(mapcar '(lambda (j)	      
    		   (func en j)) l1)
    	  )
      )
    
    (setq data '( "InsertionPoint" "Height" "TextAlignmentPoint")
          Fdata '("Textstring" "color" "Rotation"  "StyleName" "Alignment" "Layer"
                  "ScaleFactor" "UpsideDown" "Backward" 
                   )
          )
    (if
      (setq ss (ssget "_X" '((0 . "INSERT")(66 . 1)(2 . "BLOCKNAME1,BLOCKNAME2,`*U*"))))
      		(repeat (setq i (sslength ss))
    		  	(setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
                            (setq r (vla-get-rotation e))
                      (if (member  (strcase (vla-get-effectivename e)) '("BLOCKNAME1" "BLOCKNAME2"))
                        (progn
    			(vlax-invoke e 'ConvertToAnonymousBlock)
    			(setq from (mapcar '(lambda (k)
    					(setq info (_data k vlax-get fdata nil nil))
    					      (vla-delete k) info)	      
    						(vlax-invoke e 'GetAttributes)))  	
    			 			  	
    		(vlax-for itm (setq blk (vla-item
    				     blks
    				     (vla-get-name e)
    				   ))
    	(if (eq "AcDbAttributeDefinition" (vla-get-objectname itm))
    		(progn
                      (setq fd (car from))
    		  (setq old (_data itm vlax-get data nil nil))
    		  (setq new (vlax-invoke blk 'AddText (car fd) (car old) (cadr old)))
    		  (_data new vlax-put fdata fd r)
                      (vlax-invoke new 'Move '(0.0 0.0 0.0) (last old))
    		  (vla-delete itm)
          
    		  (setq from (cdr from))
    		  )
    	  )
    		  ) 
    		  )
    	  )
                      )
              )
    (princ)
      )
    EDIT/UPDATE: Fudge Attribute properties....
    Last edited by pbejse; 2013-01-06 at 05:21 PM. Reason: more and more fudge

  3. #33
    Active Member
    Join Date
    2011-10
    Posts
    83
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Sorry for replying so late but I needed to be at home earlier.
    I have just tested it, works AWESOME! Great, thanks for your help and engagement.
    Second routine (ATTL) also great, I think I will find it very handy
    Just one small think, my attributes are on "0" layer (layer color is white) but in Attribute Editor I set it to red, after using routine it turns to color of a layer on which block was. In my case it turned from red to cyan (I had block on layer with cyan color). Can I somehow keep my red color of attributes? It will look beter on printed drawing because cyan is the thickest color I use If it is to much just ignore it. Thanks a lot!

  4. #34
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Quote Originally Posted by Arterius View Post
    Sorry for replying so late but I needed to be at home earlier.
    I have just tested it, works AWESOME! Great, thanks for your help and engagement.
    Second routine (ATTL) also great, I think I will find it very handy
    You are welcome Arterius

    Quote Originally Posted by Arterius View Post
    Just one small think, my attributes are on "0" layer (layer color is white) but in Attribute Editor I set it to red, after using routine it turns to color of a layer on which block was. In my case it turned from red to cyan (I had block on layer with cyan color). Can I somehow keep my red color of attributes? It will look beter on printed drawing because cyan is the thickest color I use If it is to much just ignore it. Thanks a lot!
    Yes its possible. Would you want it exclusively RED for ALL or just the "fudge" attributes?

    The updated code will inherit the original color prior to conversion.

    Hope this helps

  5. #35
    Active Member
    Join Date
    2011-10
    Posts
    83
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Yes, GREAT! Now it works perfect!
    The updated code will inherit the original color prior to conversion.
    Exactly what I was dreaming of

    I also change your previous routine (ATTL - with list box) to do the same with blocks, I mean this keeping orginal atributes color and surprisingly it works....
    Last thing, I have just prepared drawing package for investor to sent, I open some drawing and all my attributes are rotated (up side down)! Can you advice what to change in your routine to keep final rotation of attributes?
    (eyes of Puss in Boots form Shrek)

  6. #36
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Quote Originally Posted by Arterius View Post
    ..... I open some drawing and all my attributes are rotated (up side down)! Can you advice what to change in your routine to keep final rotation of attributes? .....
    Rotated/Upside Down/Color/Layer/Backwards... hmmm let me see , what else is there to fudge?

    Code updated yet again Arterius

  7. #37
    Active Member
    Join Date
    2011-10
    Posts
    83
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    I got error : "error: malformed string on input" :/ do you have the same?

  8. #38
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Quote Originally Posted by Arterius View Post
    I got error : "error: malformed string on input" :/ do you have the same?
    Ooops

    missing quotation mark. <">

    (member (strcase (vla-get-effectivename e)) '("BLOCKNAME1" "BLOCKNAME2"))

  9. #39
    Active Member
    Join Date
    2011-10
    Posts
    83
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Works great now, thanks a lot again!

  10. #40
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Reinsert Blocks - need help with routine

    Good for you.

    You are welcome Arterius.

Page 4 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Attribute blocks scaling routine
    By gilsoto13 in forum AutoLISP
    Replies: 9
    Last Post: 2017-12-13, 03:41 PM
  2. moving the origin of a link without having to reinsert
    By john.mclaughlin325438 in forum Revit MEP - General
    Replies: 2
    Last Post: 2012-01-10, 04:35 PM
  3. Hatch routine ignoring blocks
    By jwmcneal2 in forum AutoCAD General
    Replies: 1
    Last Post: 2011-10-26, 04:12 PM
  4. lsip routine for autobreaking blocks
    By vtmiii in forum AutoLISP
    Replies: 5
    Last Post: 2010-09-01, 10:17 PM
  5. Routine to Batch Edit Blocks
    By CADdancer in forum VBA/COM Interop
    Replies: 2
    Last Post: 2006-09-19, 09:35 PM

Posting Permissions

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