明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: xransnow

[基础] [求助]使用lisp或者vlisp是否可行?

  [复制链接]
发表于 2010-5-6 21:10 | 显示全部楼层
(setq sa "")
(foreach x (list "aaa" "bbb" "ccc" "ddd") (setq sa (strcat sa x "/")))
(setq sa (substr sa 1 (1- (strlen sa))))
发表于 2010-5-8 10:32 | 显示全部楼层
可以实现吧,不过丝路很难
 楼主| 发表于 2010-5-10 13:15 | 显示全部楼层

我怎么得不到“8820.0”,请高手指导下

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2010-5-10 14:37 | 显示全部楼层
先(setvar "DIMZIN" 0)再转换
 楼主| 发表于 2010-5-15 09:24 | 显示全部楼层

看了各位的回复,收获很大,谢谢各位

继续请教

(setq startnum (getint "\n请输入起始序号:"))

在用户直接回车的时候,会提示“错误: 参数类型错误: numberp: nil”

怎么可以给startnum赋值一个默认值?而不因为错误中断程序?

发表于 2010-5-15 09:49 | 显示全部楼层

其下加
(if (not startnum )
  (setq startnum DefVal)

or
类似 uint 的函数
    ;* UINT User interface integer function
    ;* BIT (0 for none) and KWD key word ("" for none) are same as for INITGET.
    ;* MSG is the prompt string, to which a default integer is added as <DEF> (nil
    ;* for none), and a : is added.
    ;*
    (defun uint (bit kwd msg def / inp)
      (if def                                                 ;test for a default
        (setq msg (strcat "\n >> " msg " < " (itoa def) " >: ")      ;string'em with default
             bit (* 2 (fix (/ bit 2)))  ;a default and no null bit code conflict so
        )                               ;this reduces bit by 1 if odd, to allow null
        (if (= " " (substr msg (strlen msg) 1))            ;no def, if last char is space
          (setq msg (strcat "\n >> " (substr msg 1 (1- (strlen msg))) " : ")) ;then strip space
          (setq msg (strcat "\n >> " msg " : "))                ;else msg OK
      ) );if,if
      (initget bit kwd)
      (setq inp (getint msg))       ;use the GETINT function
      (if inp inp def)              ;compare the results, return appropriate value
    );defun
   
ureal ustr upoint .... 皆可比照 (from Google ...)

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

本版积分规则

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

GMT+8, 2024-5-3 04:15 , Processed in 0.165353 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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