Lee Mac 发表于 2022-7-5 20:30:44

 
AutoLISP is only compatible with the ASCII (and extended ASCII) character set, and therefore Unicode characters must be represented using their code points (e.g. U+#### etc.) and you cannot save an AutoLISP file in Unicode format, else you will receive errors when the interpreter tries to read the file.
 
However, the character ² is part of the extended ASCII character set (character 178) and therefore should be compatible for use with AutoLISP.
 
Try the following instead:

(setq fmt (strcat "%lu2%pr2%ps%ct8")) ;; Field Formatting

muurr 发表于 2022-7-5 20:36:11

I'm widening my knowledge about AutoLISP with your answers, thank you Lee! I didn't know that AutoLISP are only ASCII-able.
So, I tried with chr178 but it gave me another character. I figured out that's because my system is on Latin-2 ASCII due to language pack by default, which is different in extended part (where the superscript character is).
Than I changed 'Language for non-Unicode programs' in Windows (8.1) settings, Language, and - voila! Now it displays superscript 2 as you suggested.
I also changed that individual programs use their own language, and installed language pack that I need.
Thank you!
Now only my second question is un-answered: is there possibility to show text in superscript/subscript for field prefix/suffix via AutoLISP?

Lee Mac 发表于 2022-7-5 20:39:36

 
You're welcome - I'm glad you were able to resolve it!
 
 
Since the field prefix/suffix content is fixed and since field expressions do not permit the use of MText formatting, I would instead suggest moving the prefix & suffix text outside of the field expression and surrounding these with the appropriate MText formatting codes.
 
For example, where my Areas to Field program is concerned, you would need to change the field formatting to:

(setq fmt (strcat "%lu2%pr2%ct8")) ;; Field Formatting
 
And then change line 94 of the program from:

str
to:

(strcat "A=" str "m{\\H0.7x;\\Syoursuperscripttexthere^;}")

muurr 发表于 2022-7-5 20:43:57

Divine.
Thank you Lee for your knowledge!
Now I know the reason why I haven't succeeded with:

{\H0.5x;2;}as I mentioned in post #6
I found on another thread about MText coding: http://www.cadtutor.net/forum/showthread.php?22036-VB-Automation-How-to-write-text-in-superscript-to-AutoCAD&p=140919&viewfull=1#post140919 tried different scenarios, and works.
Only thing is that with MText coding you cannot place superscript to look as you want it because if you set H0.3x maybe the size iz ok, but the vertical placement by main text doesn't look that good as it does with ASCII.
So size of 0.7x (0.65x) what you suggested is ideal for superscript.
Thank you once again!

Lee Mac 发表于 2022-7-5 20:49:15

You're most welcome muurr.
页: 1 [2]
查看完整版本: Special charector \ (92) ... (