乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: jnky

[编程交流] Special charector \ (92) ... (

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 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 [noparse](character 178)[/noparse] and therefore should be compatible for use with AutoLISP.
 
Try the following instead:
  1. (setq fmt (strcat "%lu2%pr2%ps[A=,m" (chr 178) "]%ct8[1e-004]")) ;; Field Formatting
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 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?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 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:
  1. (setq fmt (strcat "%lu2%pr2%ct8[1e-004]")) ;; Field Formatting
 
And then change line 94 of the program from:
  1. str
to:
  1. (strcat "A=" str "m{\\H0.7x;\\Syoursuperscripttexthere^;}")
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 20:43:57 | 显示全部楼层
Divine.
Thank you Lee for your knowledge!
Now I know the reason why I haven't succeeded with:
  1. {\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!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 20:49:15 | 显示全部楼层
You're most welcome muurr.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 00:53 , Processed in 0.509109 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表