乐筑天下

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

[编程交流] (getint) or (getpoint)

[复制链接]

2

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 15:34:55 | 显示全部楼层 |阅读模式
I need lisp to choose (getint) or (getpoint)
(setq txt(getint))
(setq pt(getpoint))
If I have txt I do not need pt
and if I have pt I do not need txt
so I need to choose beteen pt and txt on one process.
regards,
回复

使用道具 举报

76

主题

312

帖子

254

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
390
发表于 2022-7-5 15:54:56 | 显示全部楼层
Something like this?
  1. (cond((and txt pt)        (princ "Both are present. Error?"))(txt        (setq pt (getpoint "\nSelect point")))(pt        (setq txt (getint "\nWhats the text?")))(t        (princ "Neither are present...")))
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 15:55:49 | 显示全部楼层
Hi,
 
Try this:
  1. (or (setq no (getint "\nEnter an integer  :"))   (setq pt (getpoint "\nSpecify a point :"))   )
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
325
发表于 2022-7-5 16:07:29 | 显示全部楼层
  1. ; (get_pt_or_int "\nPick a point [Exit] : " "\nSpecify int [Exit] : ")(defun get_pt_or_int ( mp mi ) (cond    ( (progn (initget "Exit") (getpoint mp)) )   ( (progn (initget "Exit") (getint mi)) )   ( (get_pt_or_int mp mi) ) ); cond  ); defun
 
Or -
 
  1. (progn (initget 128 "Exit") (getpoint "\nSpecify input [Exit]: "))
 
But you'd need to process it, it will return strings from keyboard inputs, such as: "123".
回复

使用道具 举报

51

主题

481

帖子

457

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
262
发表于 2022-7-5 16:20:25 | 显示全部楼层
May be this
  1. ...
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-5 16:25:20 | 显示全部楼层
 
maybe this
  1. (while (progn   (initget 128)   (setq var (getpoint "\nInsertion point or Number: ")) ) (print var))Command:Insertion point or Number:(-2.43958 704.87 0.0)Insertion point or Number:"aaa"Insertion point or Number:"123"Insertion point or Number:
As you can see, you can pick a point or you can type something. The output is a list (a point) or a string. You only need to check the input validity.
回复

使用道具 举报

51

主题

481

帖子

457

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
262
发表于 2022-7-5 16:43:56 | 显示全部楼层
Give this a try
  1. (if   (and     (setq e (car (nentsel "\nSelect Level: ")))     (setq en (entget e))     (setq typ  (cdr (assoc 0 en)))     )   (progn     (cond( (eq typ "MTEXT")  (setq ent (cdr (assoc 0 en))) )( (eq typ "TEXT")  (setq ent (cdr (assoc 0 en))) )( (eq typ "POINT")  (setq ent (cdr (assoc 0 en))) )        ); cond     ) )
 
And change DXF number to what ever you want
 
  1. (assoc 0 en)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-2 15:43 , Processed in 1.093286 second(s), 66 queries .

© 2020-2025 乐筑天下

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