明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1409|回复: 3

怎样实现分数的输入呢?

[复制链接]
发表于 2005-4-25 21:05:00 | 显示全部楼层 |阅读模式
如题,在LISP里怎样写一个分数到CAD呢?譬如说,分子是AAA,分母是BBB?
发表于 2005-4-26 06:25:00 | 显示全部楼层
输入之后你要什么样的结果,比如说输入1/4,让程序知道实际你想要的是0.25,如果是这样的,可以实现。
发表于 2005-4-26 08:17:00 | 显示全部楼层
(command "mtext" pt1 pt2 "\SAAA/BBB;" "");pt1和pt2为给定对角点
发表于 2005-4-28 10:56:00 | 显示全部楼层
;; 写分数文字
(DEFUN C:FWZ (/ OLDOS PT1 OBJ TXTH PT2 TXT PT3 ANG)
(SETvar "CMDECHO" 0)
(SETQ OLDOS (GETvar "OSMODE"))
(SETvar "OSMODE" 0)
(SETQ PT1 (GETPOINT "\n选择文字位置左下角点 :"))
(SETQ OBJ (ENTSEL "\n选择直线 :"))
(command "style" "ST" "宋体" 2.5 1.0 0 "N" "N")
;;设置文字样式。
(SETQ TXTH (* (GETvar "DIMSCALE") (GETvar "DIMTXT")))
(SETQ PT2 (POLAR (POLAR PT1 0 (* TXTH 20)) (/ PI 2) (* TXTH 3)))
(SETQ TXT (GETSTRING "\n分子 :"))
(SETQ TXT (STRCAT "\\S" TXT "/" (GETSTRING "\n分母 :") ";"))
(SETQ PT3 (OSNAP (CADR OBJ) "NEA"))
(SETQ ANG (ANGLE PT3 (CDR (ASSOC 10 (ENTGET (CAR OBJ))))))
(WHILE (> ANG (/ PI 2)) (SETQ ANG (- ANG PI)))
(SETQ ANG (* (/ ANG PI) 180))
(COMMAND "MTEXT" PT1 PT2 TXT "")
(COMMAND "ROTATE" "L" "" PT1 ANG)
(SETvar "OSMODE" OLDOS)
(SETvar "CMDECHO" 1)
(PRINC)
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-17 06:36 , Processed in 0.182004 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表