Grrr Posted February 20, 2016 Share Posted February 20, 2016 Hello guys, I was curious is it possible to add unicode character (squared ²) into a field format ? I used Lee Mac's lisp routine to see what it returns from a field which contains such character: Formatting code: "%lu2%pr1%ps[,м²]%ds44%zs12%ct8[0.0001]%th32" Then I tried on applying it in another routine (Area 2 Field - By LM), Saved the file with Encoding: ANSI: (setq fmt "%lu2%ps[,м \\U+00B2 ]%zs12%ct8[0.0001]") ;; Field Formatting As you guess - it didn't work. However I did a test to see how it goes on the princ part (encoding: ANSI): (princ "\nCharacter \\U+00B9 \\U+00B2 \\U+00B3") Returns: Character ¹ ² ³ Does this uncode characters work only on printing in commandline ? Quote Link to comment Share on other sites More sharing options...
hmsilva Posted February 20, 2016 Share Posted February 20, 2016 Hello guys, I was curious is it possible to add unicode character (squared ²) into a field format ?I used Lee Mac's lisp routine to see what it returns from a field which contains such character: Formatting code: "%lu2%pr1%ps[,м²]%ds44%zs12%ct8[0.0001]%th32" Then I tried on applying it in another routine (Area 2 Field - By LM), Saved the file with Encoding: ANSI: (setq fmt "%lu2%ps[,м \\U+00B2 ]%zs12%ct8[0.0001]") ;; Field Formatting As you guess - it didn't work. Try (setq fmt "%lu2%ps[,м\\\\U+00B2 ]%zs12%ct8[0.0001]") ;; Field Formatting Henrique Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 20, 2016 Share Posted February 20, 2016 If you are planning to use it in a filed object , just add the \U+00B2 in the Suffix edit box as Square Symbol. NOTE: One black slash. Quote Link to comment Share on other sites More sharing options...
Grrr Posted February 20, 2016 Author Share Posted February 20, 2016 Thank you Tharwat, you are very helpful ! This worked: (setq fmt "%lu2%ps[,м\\\\U+00B2 ]%zs12%ct8[0.0001]") ;; Field Formatting Now people will learn something new Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 20, 2016 Share Posted February 20, 2016 You are welcome anytime. Be informed that Henrique's post is helpful also and he beat me to it Quote Link to comment Share on other sites More sharing options...
Grrr Posted February 20, 2016 Author Share Posted February 20, 2016 Oh, damn I thought it was Tharwat doubleposting! Thank you Henrique!!! Quote Link to comment Share on other sites More sharing options...
hmsilva Posted February 20, 2016 Share Posted February 20, 2016 Thank you Henrique!!! You're welcome, Grrr Glad I could help! Be informed that Henrique's post is helpful also and he beat me to it Cheers my friend! Henrique Quote Link to comment Share on other sites More sharing options...
Corro Posted March 14, 2016 Share Posted March 14, 2016 Hi All I have been using the same lisp routine "Area Field to Attribute" to add the area of a polyline to the drawing. The company now would like to add some text to the end of the area field, following the sq metres. This text, (PAD), is to have smaller text and be a different colour to the other text. Can anyone help with this? Thanks Quote Link to comment Share on other sites More sharing options...
Grrr Posted March 14, 2016 Author Share Posted March 14, 2016 Hi Corro, I would suggest you firstly to modify by hand a field so it will fit your needs, then use this field formatting code program http://www.lee-mac.com/fieldformat.html (also by Lee Mac) to extract its formatting code, It should look something like this: Formatting code: "%lu2%pr1%ps[,м²]%ds44%zs12%ct8[0.0001]%th32" Then open the lisp program (I guess you use Lee Mac's routine) and modify this line: (setq fmt "%lu2%ps[,м \\U+00B2 ]%zs12%ct8[0.0001]") ;; Field Formatting My issue was the formatting part for (squared symbol) ², but you should have the answer by now from these awesome guys. Quote Link to comment Share on other sites More sharing options...
Corro Posted March 14, 2016 Share Posted March 14, 2016 Hi Grrr That is exactly what I have been trying to do, but I am unable to change text height and color in the field suffix to be able to create manually. Quote Link to comment Share on other sites More sharing options...
Corro Posted March 14, 2016 Share Posted March 14, 2016 I am able to create the required format within mtext, but cannot copy or recreate within field command. This is an example of what I require, the m squared is in one color and at initial text height and the remainder is a different color and smaller text height. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 14, 2016 Share Posted March 14, 2016 I am able to create the required format within mtext, but cannot copy or recreate within field command.This is an example of what I require, the m squared is in one color and at initial text height and the remainder is a different color and smaller text height. Hi Corro, Since you state that you are using my Area Field to Attribute program, are you using multiline attributes? (As single-line attributes cannot support MText Formatting) Though, even using multiline attributes, the formatting will be lost if the content is edited manually. (As multiline attributes do not 'officially' support MText formatting, but it can be applied programmatically) Quote Link to comment Share on other sites More sharing options...
Corro Posted March 14, 2016 Share Posted March 14, 2016 Hi Lee I only used mtext to create the example. I am using your routine and it works perfectly, but we need to have it do something special, as per my previous message. We need it to change the text height and color of the "(PAD)" text to be placed on the drawing. This is what I have been able to determine for the codes - (setq fmt "%lu2%ps[,m² \\H0.722x; %ct8[1e-006]">%"]\\C4;(PAD)]%ct8[1e-006]">% ;; Field Formatting tag nil ;; Optional predefined attribute tag ) , but I receive a syntax error on loading the routine. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 14, 2016 Share Posted March 14, 2016 To avoid the error, change the parameter to: (setq fmt "%lu2%ps[,m² \\H0.722x; \\C4;(PAD)]%ct8[1e-006]" ;; Field Formatting tag nil ;; Optional predefined attribute tag ) However, I'm not sure whether it is possible to use MText formatting codes within field formatting (I've not tried). Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 14, 2016 Share Posted March 14, 2016 OK, after some testing you will need to set the parameters to: (setq fmt "%lu2%ps[,m²]%ct8[1e-006]" ;; Field Formatting tag nil ;; Optional predefined attribute tag ) And change line 95 to: ">%).Area \\f \"" fmt "\">% \\H0.722x;\\C4;(PAD)" And line 113 to: " \\f \"" fmt "\">% \\H0.722x;\\C4;(PAD)" Though, as noted above, this formatting will be lost if the multiline attribute is edited manually. Quote Link to comment Share on other sites More sharing options...
Corro Posted March 14, 2016 Share Posted March 14, 2016 No you cannot use mtext codes in the field formatting, but I am unable to create a format to run the Fieldformat routine to extract the correct codes. Quote Link to comment Share on other sites More sharing options...
Corro Posted March 14, 2016 Share Posted March 14, 2016 This is the output from the changes you suggested. Quote Link to comment Share on other sites More sharing options...
Corro Posted March 15, 2016 Share Posted March 15, 2016 (edited) I have located a converter to percentage code, but I am unsure of the sequence for the date. The below does not work - (setq fmt "%lu2%ps[,m²]%ct8[1e-006][(PAD)]%5CH0.722x%3B%5CC4%3B" ;; Field Formatting tag nil ;; Optional predefined attribute tag ) This is the output from the above format Edited March 15, 2016 by SLW210 Remove Image attempt. Quote Link to comment Share on other sites More sharing options...
Corro Posted March 15, 2016 Share Posted March 15, 2016 Sorry for the above garbage, but it was an image. Not sure what happened Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 15, 2016 Share Posted March 15, 2016 This is the output from the changes you suggested. The suggestions from my above post yield the correct result in my testing - can you double-check you have modified the code correctly? Quote Link to comment Share on other sites More sharing options...
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.