Jump to content

Match Block attribute


Mo4u

Recommended Posts

I have difficult time finding a command that would match a block's attribute (text height, text rotation, and text scale) with a source block. I had found a LISP routine that would match the block itself with a source block but it did not include attributes. I don't need to match attibute values, just the properties.

 

I'm using AutoCAD 2012 with regular blocks (not dynamic)

Link to comment
Share on other sites

ReMark, MatchAtts.lsp looks like a nice routine, but I think it only copies the attribute values of selected tags, whereas it sounds like the OP wants attribute properties rather than values, though it is still unclear to me exactly what is being asked for.

 

Mo4u, are you trying to get the individual properties of a selected source attribute within a block and apply them to other selected attributes? Or are you saying that you applied properties from one block to another block and it did not update the attributes accordingly? Please explain with more detail. Posting the attributed block objects here in a drawing might help as well.

Link to comment
Share on other sites

Neophoible, you are correct, I am trying to match individual attribute properties within a block and apply them to other selected attributes. MatchAtts is a good routine but not what I am looking for.

 

For example, from the attached file, I'm trying to match attribute text height, text style, text rotation from "CKT 1" over to "CKT 2."

 

 

 

I'm trying to consolidate drawings from different people and it becomes tedious trying to make blocks attributes look similiar.

Snap.jpg

example.dwg

Link to comment
Share on other sites

Remark, that is a good routine. The text height and rotation matched. However, the text color and text location didn't match. I'm not familiar enough on how to edit the routine to add those properties.

Link to comment
Share on other sites

Well now is as good a time as any to learn then isn't it? You're just two parameters short of your goal. Lee Mac's routine got you half way there already.

 

 

If the color of your text is governed by what layer it is on then you need not edit the routine. What do you mean re: text location? Are you talking about Justification?

 

OK I just tested it and adding "Color" as a parameter to Lee's routine was very easy. Just add it to the list at the beginning of the file. I put it right after the word "Backward" since the list is alphabetical.

Edited by ReMark
Link to comment
Share on other sites

Remark, that is a good routine. The text height and rotation matched. However, the text color and text location didn't match. I'm not familiar enough on how to edit the routine to add those properties.

Well, the color part would be easy enough, just add the line Color right after Backward in the list--and it is a very long list, much more than height and rotation, more like everything but the kitchen sink. :lol: It is a very good routine.

 

However, the attribute insertion point relative to the block insertion may be another matter. I'm not so sure it's a simple fix. Furthermore, it looks like in both instances in your drawing, attribute locations have been modified from the original.:shock: Is this correct? Seems to me that you might want to take the metaphorical hides of the guilty, sell them and pay someone like Lee to fix this for you.

Link to comment
Share on other sites

In thinking about this a bit more, it may be possible to write a routine (or find one already written) that will copy and replace. It could copy the block you want to imitate, extract the attribute values of the one you are replacing, and then delete the one being replaced. Note that this would be different from inserting a new copy of the block, which would leave you with the original attribute locations.

 

If you cannot find a routine to do both of these, you may be able to find two routines, one that will copy and replace the block and one that will match attributes. In fact, ReMark already gave you the second one; and it seems to me that I posted one somewhere that will do the first step. I'll go look for it, but note that the insertions are also on different layers, so you may have to deal with that as well. Also, you will have to preserve a copy of the block with the correct attribute values long enough to do the attribute matching.

Link to comment
Share on other sites

It appears that all the parameters Lee used were taken from the edit attribute dialog box with the exception of Text Style, Justification, Width Factor, Annotative and Plot Style. I'm assuming all of the missing ones could be added.

Link to comment
Share on other sites

I'm not so sure all of them can be. Justification appears to be one exception. And in this case, the users have changed the location of the attributes as well as the justification. Such changes might be warranted if the block was not well-defined to begin with. It's just a bear to make them all the same, but with these changes now. Of course, another option is to redefine the Block then re-Insert them using the existing attribute values. That sort of routine probably already exists somewhere as well.

Link to comment
Share on other sites

This is the link to the thread where I posted a Replace routine earlier. See post#2. Like I said before, you will want to retain a copy of the block with the correct attribute values so that you can MatchAttribs. Edited by neophoible
added caveat
Link to comment
Share on other sites

That's certainly an option. It worked for Color. I actually tried Justification that way, but it didn't work for me, nor did a couple of variations, which is why I singled it out. I'm not familiar with where the tables are for the actual names of these properties, but I'm sure there is one, though it doesn't mean there aren't also some undocumented options as well. No doubt Lee would know much better, and I'm sure there are others who could help with that. I did notice that there are ways to test if a property name is available, but I did not find a function that will list the names for you. If there isn't one, there oughtta be!

 

But the main problem I see is that the basepoint of the attribute has been user changed in both instances. Even if the justification can be easily reset, this aspect does not look like such an easy fix to me, yet one that the OP seems to need as much as anything. Is it doable? Yes, maybe even fun to work on, but perhaps not so easy. Thus, I'm thinking that the easiest route would be to do it in the few steps I mentioned earlier. One might even cobble the routines together if he were so inclined. In either case, this should be a workable solution.

Link to comment
Share on other sites

Thansks for your help guys. Yes, matching the attribute location will be a challenge but worth the effort. I will try the two routines.

Link to comment
Share on other sites

It appears that all the parameters Lee used were taken from the edit attribute dialog box with the exception of Text Style, Justification, Width Factor, Annotative and Plot Style. I'm assuming all of the missing ones could be added.

 

FYI: the properties listed are the ActiveX Properties for the Attribute VLA-Object, as stated in the program description on my site ;)

Link to comment
Share on other sites

I wouldn't know an ActiveX property if I tripped over one! LoL
Well, I don't know about that, but you're not likely to trip over the reference guide for them, I'll tell you. Even Lee thought they'd been removed from 2012!:o After Lee's post and a bit of more accurate searching, I found where they are hidden. On my computer (not to be confused with My Computer), the file is C:\Program Files\Common Files\Autodesk Shared\acadauto.chm. The list of properties for attributes is far more extensive than I imagined; I'm not complaining.:)

 

Thanks for the post Lee, but did you forget how hard this reference is to find for those who don't already know or have access otherwise?:P Of course my bigger prob is that I'm just not up to that level yet.:(

Link to comment
Share on other sites

OK, so the justification property is there and it's called very intuitively (NOT!) Alignment. So, add Alignment to the list and you're closer to matching what you need. Man, this is easy when you have the reference and someone has already written the program!

Link to comment
Share on other sites

I briefly looked into the insertion basepoint issue, but have not found an easy solution yet using MatchAttribs.lsp.

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