明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: peraperson

[已解答] 请问如何用lisp实现预输入

[复制链接]
发表于 2013-10-22 09:38 | 显示全部楼层
本帖最后由 langjs 于 2013-10-22 09:40 编辑

带记忆功能带预设的带显示的支持空格默认a值,试试
(defun c:aa (/ b)
  (if (null a)
    (setq a 10)
  )
  (if (setq b (getint (strcat "\n输入整数:<" (itoa a) ">")))
    (setq a b)
  )
  (princ "\n a=")
  (princ a)
  (princ)
)
发表于 2013-10-22 11:34 | 显示全部楼层
本帖最后由 寒林清远 于 2013-10-22 11:36 编辑

                (if (/= cc1_hzm nil)
                        (progn
                                (setq cc1 (getreal (strcat "\n输入桩帽内侧边长<" (rtos cc1_hzm) ">:")))
                                (if (null cc1) (setq cc1 cc1_hzm)(setq cc1_hzm cc1))
                        )
                        (progn
                                (setq cc1(getreal"\n输入桩帽内侧边长:"))
                                (setq cc1_hzm cc1)
                        )
                )

类似于这个,改改就行了,其中cc1_hzm为全局变量
 楼主| 发表于 2013-10-22 12:45 | 显示全部楼层
自贡黄明儒 发表于 2013-10-19 08:07
(setq a (getint));如果回车,则a =nil,所以下行写
(if a nil (setq a 10))

额 可能是我表达不是很清楚吧 我看了你给的链接 好像是用对话框的形式弹出的提示数值10的是吗? 我想要的是另外一种效果 就是比如我们画线的时候 输入line 马上就会给提示“指定第一个点”在在这个提示信息后面紧跟着一个小框框,里面一个数字 我希望达到的就是这种效果 就是10出现在这个小框框里面 而不是对话框的形式弹出 请问有什么方法吗 谢谢
发表于 2013-10-22 13:16 | 显示全部楼层
peraperson 发表于 2013-10-22 12:45
额 可能是我表达不是很清楚吧 我看了你给的链接 好像是用对话框的形式弹出的提示数值10的是吗? 我想要的 ...

是不是这样呀?
(defun C:myline (/ P1 P2)
  (setq p1 (getpoint "\n 画线起点"))
  (if (setq p2 (getpoint p1 "\n 第二点<默认画一10mm横线>"))
    nil;输入距离or点取or输入点
    (setq p2 (mapcar '+ p1 '(10 0)));如果用户回车,默认画一横线
  )
  (command "_.Line" p1 p2 "")
  (princ)
)
发表于 2013-10-22 14:30 | 显示全部楼层
  1. (defun c:tt ()
  2.   (defun uint (bit kwd msg def / inp)
  3.     (if        def
  4.       (setq msg        (strcat "\n" msg "<" (itoa def) ">: ")
  5.             bit        (* 2 (fix (/ bit 2)))
  6.       )
  7.       (setq msg (strcat "\n" msg ": "))
  8.     )
  9.     (initget bit kwd)
  10.     (setq inp (getint msg))
  11.     (if        inp
  12.       inp
  13.       def
  14.     )
  15.   )
  16.   (if (null int)
  17.     (setq int 10)
  18.   )
  19.   (setq int (Uint 1 "" "整数" int))
  20.   (princ)
  21. )
 楼主| 发表于 2013-10-22 15:05 | 显示全部楼层
langjs 发表于 2013-10-22 09:38
带记忆功能带预设的带显示的支持空格默认a值,试试
(defun c:aa (/ b)
  (if (null a)

谢谢 成功解决了
 楼主| 发表于 2013-10-22 15:05 | 显示全部楼层
寒林清远 发表于 2013-10-22 11:34
(if (/= cc1_hzm nil)
                        (progn
                               ...

谢谢 成功解决了
 楼主| 发表于 2013-10-22 15:06 | 显示全部楼层
自贡黄明儒 发表于 2013-10-22 13:16
是不是这样呀?
(defun C:myline (/ P1 P2)
  (setq p1 (getpoint "\n 画线起点"))

不是的 要的就是楼上的那种效果 还是很谢谢你
 楼主| 发表于 2013-10-22 15:07 | 显示全部楼层
xyp1964 发表于 2013-10-22 14:30

谢谢 成功解决了

点评

相当费劲  发表于 2013-10-22 15:59
发表于 2013-10-24 10:50 | 显示全部楼层
peraperson 发表于 2013-10-21 13:16
谢谢 但是有个问题就是这个10不会出现在屏幕上 我想要的效果是预先显示有10这个值 如果要输入的是10按ent ...

(setq a(getint"<10>"))
(setq a(if (null a) 10 a)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-19 18:23 , Processed in 0.261405 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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