Jump to content

COPY THE CONTENT OF ONE ATTRIBUTE TO OTHERS .... HELP


leonucadomi

Recommended Posts

HELLO 

 

IS THERE ANY LSP ROUTINE THAT CAN COPY THE CONTENT OF ONE ATTRIBUTE TO OTHERS?

 

IN THE EXAMPLE FILE COPY THE 008 TO THE ATTRIBUTES WITH 007

 

image.png.5d1642032fb4cc9292e06daf575f076d.png

 

 

THANKS

ATRIB TEST.dwg

Link to comment
Share on other sites

This does a one to one replace of objects.  Please note I am only selecting the yellow text.

 

;;----------------------------------------------------------------------------;;
;; Copy item to Multiple locations to replace selection
(defun C:COPYOBJ (/ ent BP SS obj LL UR MPT)
  (vl-load-com)
  (setq obj (vlax-ename->vla-object (setq ent (car (entsel "\nObject to copy: ")))))
  (vla-getboundingbox obj 'minpt 'maxpt)
  (setq BP (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2)))
  (if (setq SS (ssget))
    (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
      (setq obj (vlax-ename->vla-object e))
      (vla-getboundingbox obj 'minpt 'maxpt)
      (setq MPT (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2)))
      (vla-delete obj)
      (vl-cmdf "_.Copy" ent "" BP "_non" MPT)
    )
  )
  (princ)
)

 

Edited by mhupp
vl-load-com
Link to comment
Share on other sites

Didn't looked at DWG, but according to provided code, I suppose it's designed for copying and replacing normal entities, not specific ones like requested - attributes...

So, can you just select, input desired number, and change textstring to all collected through selection... Either way, it's the same... Sometimes it's better to just do input by keyboard through routine runtime, IMHO...

Link to comment
Share on other sites

  • 1 year later...

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