Jump to content

Match Attribute Justification (Text)


Jim Clayton

Recommended Posts

I see what the issue is.  I selected the source, then the destination objects.  Didn't work.  Above you're selecting the source, then the source/destination objects.  Just tried that and it works.  Details.  Good news.  I think this will work out well.  I appreciate all of the help.

Link to comment
Share on other sites

1 minute ago, Jim Clayton said:

I see what the issue is.  I selected the source, then the destination objects.  Didn't work.  Above you're selecting the source, then the source/destination objects.  Just tried that and it works.  Details.  Good news.  I think this will work out well.  I appreciate all of the help.

Ah yes ... my bad, try this version:

(defun c:foo (/ a c e o s)
  ;; RJP » 2021-09-17
  (cond	((and (setq e (car (entsel)))
	      (= 1 (cdr (assoc 66 (entget e))))
	      (setq s (ssget ":L" '((0 . "INSERT") (66 . 1))))
	 )
	 (setq o (vlax-ename->vla-object e))
	 (ssdel e s)
	 (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (setq a (vla-copy o))
	   (setq e (vlax-vla-object->ename a))
	   (setq c (vlax-ename->vla-object b))
	   (vlax-invoke a 'move (vlax-get a 'insertionpoint) (vlax-get c 'insertionpoint))
	   (foreach at (vlax-invoke c 'getattributes)
	     (vl-catch-all-apply
	       'setpropertyvalue
	       (list e (vla-get-tagstring at) (vla-get-textstring at))
	     )
	   )
	   (entdel b)
	 )
	)
  )
  (princ)
)

 

Link to comment
Share on other sites

7 minutes ago, Jim Clayton said:

Even better!  Thanks again.  Exactly what I needed!

Glad to help. 🍻 Bear in mind this will not preserve rotation, scale etc of blocks that get replaced.

Edited by ronjonp
Link to comment
Share on other sites

  • 1 year later...
16 hours ago, cadmaster1004 said:

 There's a problem with one of the great rehearsals above.

When you use the re-study, the block changes as well.

Text justify or angle is good to apply,
I don't want it to change to a block.

ATTRIBUTE_TEXT AND ANGLE MATCH.dwg 101.1 kB · 1 download

FOO.jpg

 

That is the way the code is written. It copies the source block to the destination block location then matches attribute values.

 

A better way to do this IMO is to open the block editor .. make the changes you want to the attributes. Close the block editor then ATTSYNC.

Link to comment
Share on other sites

Thank you so much for your answer.
I am familiar with attsync.

Then, can't you make the lisp work only for the same block?

For example, if you apply Lisp from block A to block B,
It doesn't work at all, it only works on the same block.

Link to comment
Share on other sites

  • 4 weeks later...
On 11/10/2022 at 3:29 AM, ronjonp said:

 

That is the way the code is written. It copies the source block to the destination block location then matches attribute values.

 

A better way to do this IMO is to open the block editor .. make the changes you want to the attributes. Close the block editor then ATTSYNC.

I'm very sorry to ask you this again.

As I said before, this code is pretty good.
However, if I select another block(attribute), that block(attribute) will change completely.

so,
Can't you let me apply the applicable study only to the same block(attribute)?
I looked up the conditional statement for a few days, but I couldn't solve it.

ex)
Run lisp -> Select A Block -> Select A, B, C, D, E Block
Apply applicable lisp only to block A. 

 

And attsync is not considered because the properties need to be different between the same blocks.
I am sorry for my poor English.

Edited by cadmaster1004
Link to comment
Share on other sites

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