明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 340|回复: 1

[讨论] 控制变量输入

[复制链接]
发表于 2019-4-19 16:04 | 显示全部楼层 |阅读模式
  • ;--------------------执行下面的dj命令先要设置5个参数,这样操作有点繁琐
  • ;------------怎么变成如下操作形式:
  • ;------------
  • ; "\n点选第一个剪力值;或[肢数(s1)/最小直径(s2)/单侧个数(s3)/弯起角度(s4)/强度等级(s5)]:"
  • ;执行dj命令时,若采用5个参数的默认值则直接执行“选第一个剪力值”。
  • ;若要修改某个参数,则通过s1或s2修改对应的参数,然后执行“选第一个剪力值”。
  • (defun c:s1()
  •   (setq nub (getint "\n箍筋肢数:"))
  •   (princ)
  • )
  • (defun c:s2()
  •   (setq d (getint "\n箍筋最小直径:(箍筋面积)/箍筋直径: (吊筋面积):"))
  •   (princ)
  • )
  • (defun c:s3()
  •   (setq nu (getint "\n附加箍筋单侧个数:"))
  •   (princ)
  • )
  • (defun c:s4()
  •   (setq jd (getint "\n附加吊筋弯起角度(1:45 2:60):"))
  •   (princ)
  • )
  • (defun c:s5()
  •   (setq gj (getint "\n附加吊筋强度等级(1:300 2:335 3:400 4:500):"))
  •   (princ)
  • )
  • ;---------------------
  • (defun c:dj()
  •   (if (null d) (setq d 8))
  •   (if (null nub) (setq nub 2))
  •   (if (null nu) (setq nu 3))
  •   (if (null jd) (setq jd 1))
  •   (if (null gj) (setq gj 3))
  •   (setq sg (* d d pi 0.25))
  •   (if (= jd 1)
  •     (progn (setq ang 0.707) (setq ang1 45))
  •     (progn (setq ang 0.866) (setq ang1 60))
  •   )
  •   (cond
  •     ((= gj 1) (setq fy 270))
  •     ((= gj 2) (setq fy 300))
  •     ((= gj 3) (setq fy 360))
  •     ((= gj 4) (setq fy 435))
  •   )
  •   (prompt (strcat "\n当前附加箍筋单侧" (itoa (fix nu)) "个(s3设置); " (itoa (fix nub)) "肢箍(s1设置); 箍筋直径为:" (itoa (fix d)) "mm(s2设置); " "附加吊筋弯起角度为:" (itoa (fix ang1))
  •             "度(s4设置); 附加吊筋抗拉强度为:" (itoa (fix fy)) "MPa(s5设置)。"))
  •   (setq fgv (* sg 360 2 0.001 nu nub))
  •   (setq ent1 (entget(car(entsel "\n点选第一个剪力值:"))))
  • ;这里想变成: "\n点选第一个剪力值;或[肢数(s1)/最小直径(s2)/单侧个数(s3)/弯起角度(s4)/强度等级(s5)]:"
  •   (setq ent2 (entget(car(entsel "\n点选第二个剪力值:"))))
  •   (setq jl1 (atof(cdr(assoc 1 ent1))))
  •   (setq jl2 (atof(cdr(assoc 1 ent2))))
  •   (if (> jl1 jl2)
  •     (progn (setq j1 jl1) (setq j2 jl2))
  •     (progn (setq j1 jl2) (setq j2 jl1))
  •   )
  •   (setq jl (- j1 j2 fgv))
  •   (setq asw (/ (* jl 1000) ang fy 2 100))
  •   (if (> asw 0)
  •     (progn (princ "\n附加吊筋面积为: ") (princ asw) (princ "cm^2"))
  •     (progn (princ "\n不需要附加吊筋"))
  •   )
  •   (princ)
  • )

发表于 2019-4-19 16:26 | 显示全部楼层
改成对话框,在对话框里设置
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-19 08:52 , Processed in 0.161846 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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