Jump to content

Modifying Text, MText and AttDef properties both outside and inside blocks globally


Kyraj

Recommended Posts

We are a small MEP design firm and we receive updated floor plans from architects very often. The drawings contain nested blocks with all sorts of Text, MText and AttDef's with God knows how many combinations of style, height, width factor and other properties.

 

I have been looking for a long time for a routine that will allow me to change the style, height, width factor, color and layer for ALL Text, MText and AttDef instances outside blocks, inside blocks and inside nested blocks at the same time, and also to strip the MText of all formatting.

 

I have found various routines that help partially, but not a full set that can help me out to the end, so i still have to explode everything, which leads to huge files.

 

Can anyone help me? The closest I've found were:

- Lee Mac's RedefineBlockText routine, which accounts for AttDef's Height and Width factor;

- Theodorus Winata's EDIT ATTRIBUTE TEXT, which accounts for AttDef's Angle/Height/Style/Text/Width;

- Steve Doman and Joe Burke's StripMtext for stripping MText of all properties.

 

Thank you for your time!

Link to comment
Share on other sites

My bad, I almost always use BURST instead of EXPLODE (unless I'm trying to turn a LWPoly into Line entities). The issue here is that the drawings contain many different blocks with text and a plethora of other blocks that repeat a lot (trees, furniture, doors, windows etc) which, upon being burst/exploded can more than quadruple the file size.

Regarding MatchAttribs, I am already using it (I use more than 20 of Lee Mac's routines), but with dozens, maybe hundreds of instances of Text and MText MIXED with AttDef's, it does not get me across the river.

Link to comment
Share on other sites

My bad, I almost always use BURST instead of EXPLODE (unless I'm trying to turn a LWPoly into Line entities). The issue here is that the drawings contain many different blocks with text and a plethora of other blocks that repeat a lot (trees, furniture, doors, windows etc) which, upon being burst/exploded can more than quadruple the file size.

Regarding MatchAttribs, I am already using it (I use more than 20 of Lee Mac's routines), but with dozens, maybe hundreds of instances of Text and MText MIXED with AttDef's, it does not get me across the river.

 

Well I figured there was no harm in asking, right?

Glad to hear that you are using so many of Lee's excellent lisps.

Do you use LAYER DIRECTOR?

It is one of my favorites from Lee.

Thanks Lee! :beer:

Link to comment
Share on other sites

@Dadgad: many thanks for your recommendations & compliments, I'm pleased that you find my Layer Director program so useful in your work.

 

@Kyraj: as its Christmas and I'm feeling generous, please try the attached program.

 

At the top of the code you will see a list of ActiveX Property names for each object type, with their associated values; change this list to suit your requirements (note that the program will not create Layers, Styles etc if they do not already exist in the drawing).

 

Beneath the list you will find an option for enabling or disabling the removal of MText formatting codes - if enabled, the program will remove all formatting from both MText and MText block attributes. My function to remove MText formatting codes should also be much faster than the StripMText program, since my function is performing far fewer replacement passes on each string.

 

As noted in the code header, the program will operate on all Text, MText, Block Attributes, MText Block Attributes & Attribute Definitions in all Layouts and in all Blocks & Nested Blocks (nested to any level).

 

Merry Christmas!

 

Lee

FixAllText.lsp

Link to comment
Share on other sites

Ungodly. It's very quick and it works with everything except nested blocks that have a scale other than one, case in which the text is scaled again.

 

With other routines you created it is possible to handle certain parameters after the command is entered. It is possible to have as default no change to text height and if H is pressed after the command is entered to pass a value? I program a lot in VBA but I'm quite inept when it comes to LISP, otherwise I would try to do it myself and not bother you.

 

Something is probably wrong with the way I perceive things, but there has never been a Christmas present I've appreciated as much as this one. Thank you so much!

 

While perusing your program list I noticed that Txt2Att is not listed (I found it in a forum post where I also found David Bethel's version of the same idea, I am attaching both). I hope you include it along with this wonderful routine.

 

I'll make sure to try out Layer Director too.

 

Happy Holidays!

Txt2Att-LeeMac.lsp

Txt2Att-DBethel.lsp

Link to comment
Share on other sites

It is possible to have as default no change to text height and if H is pressed after the command is entered to pass a value?

 

The list of object properties to be altered by the program may be changed by commenting the appropriate lines in the data list at the top of the code, hence, to remove text height property the list would become:

 

(
   "AcDbText" ;; Text
   (layer "0")
   (color acbylayer)
   (stylename "Standard")
   (scalefactor 1.0)
  [color=red];(height 1.0)[/color]
)

Though, the program could also be extensively developed to present the user with a dialog displaying the properties to be changed with their respective values if necessary.

 

Something is probably wrong with the way I perceive things, but there has never been a Christmas present I've appreciated as much as this one. Thank you so much!

 

You're very welcome!

 

While perusing your program list I noticed that Txt2Att is not listed (I found it in a forum post where I also found David Bethel's version of the same idea, I am attaching both). I hope you include it along with this wonderful routine.

 

There are perhaps hundreds (or maybe even thousands) of my programs posted here and at other forums which are not included on my site... I will only include my more developed and generic programs on my site, and simply don't have the time to write up pages for every program I write...

Link to comment
Share on other sites

  • 3 years later...

I have been searching for a lisp program to "fix" dwg files so they will produce a FULLY SEARCHABLE PDF file and this one does just that. Only enhancements I would like to see are:

1.) Add feature to change EXISTING fonts used in ALL Text Styles to a TrueType Font like Arial and set "Text Width Factor" (TWF) to 1.0, Obliquing Angle to 0.0.

2.) In doing this and then use one of the font family "styles" to approximate the "Text Width Factor" (TWF) used in Existing text styles. Example; Existing style is "standard" with a TWF of .85. So use ARIAL NARROW for the font

3.) Add the (ObliqueAngle 0.0) to each of the text object types at the top as shown below.

 

(

"AcDbBlockReference" ;; Block Attributes

;(layer "0")

;(color acbylayer)

;(stylename "Standard")

(scalefactor 1.0)

;(height 1.0)

(ObliqueAngle 0.0)

)

(

"AcDbText" ;; Text

;(layer "0")

;(color acbylayer)

;(stylename "Standard")

(scalefactor 1.0)

;(height 1.0)

(ObliqueAngle 0.0)

)

(

"AcDbMText" ;; MText

;(layer "0")

;(color acbylayer)

;(stylename "Standard")

;(height 1.0)

(ObliqueAngle 0.0)

)

(

"AcDbAttributeDefinition" ;; AttDefs

;(layer "0")

;(color acbylayer)

;(stylename "Standard")

(scalefactor 1.0)

;(height 1.0)

(ObliqueAngle 0.0)

Link to comment
Share on other sites

  • 1 month later...

Lee, I have similar query with Txt2att. is there any more additional way if those attribute convert to defined block, For example, I have a text with 10-20 string and if it can be get converted to a defined block called "Data" will resolve my query.

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