Jump to content

Unicode character in field formatting


Grrr

Recommended Posts

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 ?

Link to comment
Share on other sites

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • Corro

    16

  • Lee Mac

    8

  • Grrr

    4

  • hmsilva

    2

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

ACmN2rw1JiS2AAAAAElFTkSuQmCC

Area Field Example.JPG

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by SLW210
Remove Image attempt.
Link to comment
Share on other sites

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?

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