;;-------------------=={ Match Attribs }==--------------------;;
;;                                                            ;;
;;  Prompts for selection of source attribute, then proceeds  ;;
;;  to match the listed properties for subsequently picked    ;;
;;  attributes.                                               ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright ?2010 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

(defun c:mini_MatchAttribs ( / old_cmd properties source )
  (mai_start nil)
  (mai_last_com "lm_MatchAttribs")

  (setq properties
   '(
     Backward
     Height
     Layer
     Linetype
     LinetypeScale
     Lineweight
     ObliqueAngle
     Rotation
     ScaleFactor
     StyleName
     Thickness
     UpsideDown
    )
  )

	(setq source (car (mai_Entsel T  "选择用来修改其他块内属性的原始属性:" "没有选择到属性:" '((0 . "ATTRIB")) nil)))
	(or source (exit))
	(setq source (vlax-ename->vla-object source)
		  properties (mapcar '(lambda(x / y )
                                  (setq y (vl-catch-all-apply 'vlax-get (list source x)))
								  (if (not (vl-catch-all-error-p y)) (list x y))
							  )
							  properties
					 )
		  properties (vl-remove nil  properties)
	)
	(while
	  (setq dest (car (mai_Entsel T  "选择需要修改的属性:" "没有选择到属性:" '((0 . "ATTRIB")) nil)))
	  (setq dest (vlax-ename->vla-object dest))
	  (mapcar '(lambda ( x ) (vl-catch-all-apply 'vlax-put (cons dest x))) properties)
	)
    (mai_end)
)
