Results 1 to 3 of 3

Thread: Get attribute default tag value from 3 blocks & transfer into 1 block

  1. #1
    Member
    Join Date
    2013-12
    Posts
    2
    Login to Give a bone
    0

    Default Get attribute default tag value from 3 blocks & transfer into 1 block

    Hi Everyone
    Need help to modify some code or re-write........Struggling
    I would like to transfer the default attribute value of multiple blocks into 1 single block by using a window selection.
    Attached is some awsome similar code by Lee Mac, Alan J Thompson & others
    which I am struggling to modify.
    Please Help
    Thanks
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    2013-12
    Posts
    2
    Login to Give a bone
    0

    Default Re: Get attribute default tag value from 3 blocks & transfer into 1 block

    Thanks to anyperson who was going to help out.
    Question was a couple of awsome programmers on Cadtutor.net.

    All the best

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

    Default Re: Get attribute default tag value from 3 blocks & transfer into 1 block

    Quote Originally Posted by Pinnacle View Post
    ...I would like to transfer the default attribute value of multiple blocks into 1 single block by using a window selection...
    Did you mean THE default value of the attribute definition? or the current value of the attribute of the selected blocks?

    EDIT: not sure which one but if its the latter (which makes more sense)

    Code:
    (Defun c:topost ( / _AttFunc blnmaes target 0SHS sp7 SP12 alldata) 
    (defun _AttFunc  (en lst / vals v)
    (mapcar (function (lambda (at)
    	(setq vals (list (vla-get-tagstring at)(vla-get-textstring at)))
              	(if (and lst (setq v (assoc (car vals) lst)))
                      	(vla-put-textstring at (cadr v))) vals))
                          			(vlax-invoke en 'Getattributes)
    		  	)
    		  )  
      (setq blnmaes '("`*U*" "POST1.1" "75x75x6.0SHS" "SP7" "SP12" ))
    
      	(if (setq ssb (ssget (list '(0 . "INSERT")'(66 . 1)
    				   (cons 2  (apply 'strcat (mapcar '(lambda (x)
    								      (strcat x ",")) blnmaes))))
    				   )
    			     )
    	  (progn
    	    (setq blnmaes (Cdr blnmaes))
    	  	(repeat (setq i (sslength ssb))
    		  (setq e (vlax-ename->vla-object (ssname ssb (setq i (1- i)))))
    		  (cond
    		    	(	(eq (setq bn (vla-get-effectivename e)) (Car blnmaes))
    			 	(setq target (list (_AttFunc e nil) e))
    			 		)
    			(	(eq bn (cadr blnmaes))
    			 	(setq 0SHS (_AttFunc e nil))
    			 		)
    			(	(eq bn (caddr blnmaes))
    			 	(setq sp7 (_AttFunc e nil))
    			 		)
    			(	(eq bn (cadddr blnmaes))
    			 	(setq SP12 (_AttFunc e nil))
    			 		)
    			)
    		  )
    		(and target 0SHS sp7 SP12
    			(setq alldata (apply 'append (list 0SHS sp7 SP12)))
    			  (_AttFunc (cadr target)
    			  	(mapcar '(lambda (v)
    					  (list (Car v) (cadr (assoc (Car v) alldata))))
    					(car target)))
    	    		)
    	    )
    	  )
    
      (princ)
      )
    Keep in mind that all 4 blocks need to be selected.

    HTH
    Last edited by pbejse; 2017-03-08 at 06:59 PM.

Similar Threads

  1. Replies: 2
    Last Post: 2022-04-01, 11:34 PM
  2. Please, help me extract data Dynamic Blocks and Attribute blocks to Excel
    By minhphuong.humg453254 in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2014-04-17, 08:12 PM
  3. How to change dynamic block attribute default values based on block selected?
    By zeirz109180 in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2013-12-13, 02:20 PM
  4. Replies: 13
    Last Post: 2012-09-18, 07:51 PM
  5. Copy previous Block Attribute Value to next Block Attribute
    By CADfunk MC in forum VBA/COM Interop
    Replies: 8
    Last Post: 2009-02-27, 09:46 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
  •