wannabe Posted November 10, 2008 Posted November 10, 2008 Hello, I have a series of MTEXt entities that represent coordinates to 4 decimal places. Now I need to convert them all to three decimal places. The only option at the moment is to manually edit them. Im just wondering if there are quicker ways to carry out this process such as converting them to blocks and trying to make a table from them (only just this second had the idea). Any suggestions or referals to marco/lisp routines? Quote
dbroada Posted November 10, 2008 Posted November 10, 2008 I was about to recommend a table but you already have had that idea. I don't think converting them to blocks will give you any gain in functionality. It is possible to trim them using LISP (but I couldn't do it right now) or VBA. I have just pulled about a similar routine from my colection to give you this. Private Sub SigDig() Dim myText As String Dim returnObj As AcadObject Dim basePnt As Variant ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object" If returnObj.EntityName = "AcDbText" Then 'do this myText = FormatNumber(returnObj.TextString, 2) returnObj.TextString = myText returnObj.UpDate End If End Sub This only works on DText but shows the form. The significant digits is the last number in the myText= row. Quote
wannabe Posted November 10, 2008 Author Posted November 10, 2008 If i explode the Mtext I wont lose any required functionality; which should bring your routing into play nicely. Thanks for that. What I was thinking with the blocks was to export the attribute text. But first I would need to convert text to attributes. If you anyone has a LISP for this I am sure it would come in handy on numerous future occassions. Quote
dbroada Posted November 10, 2008 Posted November 10, 2008 my routine will work on MText (with a small mod) but will treat the MTEXT as a single number. If the MTEXT doesn't start with a number it will return 0.00 and if there is a list of numbers only the first will be returned so exploding to text may be just as easy. Howmany numbers do you have to convert and does the MTEXT only contain one number? Quote
eldon Posted November 10, 2008 Posted November 10, 2008 If you have exploded all your coordinates to text, then use this lisp TextMath. It allows variable places of decimals as output, so you could add zero. Textmath.lsp Quote
wannabe Posted November 10, 2008 Author Posted November 10, 2008 I exported some coordinates using EATTEXT. The table needed to be modified to drastically for the table editing options to allow. So I exploded the text and set it up how I wanted. The engineer then says 4dp is too much. Can I make it 3DP? So there are approx 200 instances of MTEXT that are similar to this: 1223.4445. This example would need to appear as 1223.445. Quote
wannabe Posted November 10, 2008 Author Posted November 10, 2008 If you have exploded all your coordinates to text, then use this lisp TextMath. It allows variable places of decimals as output, so you could add zero. good man. Using this to multiply by one works perfect. You will be getting a christmas card this year:) . Quote
rustym Posted March 19, 2009 Posted March 19, 2009 How do I Convert / Explode mtext with field values to Single Line text and still keep the fields values?? Any LISP for this? Quote
Recommended Posts
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.