乐筑天下

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

[编程交流] Help Please - with creating ef

[复制链接]

33

主题

96

帖子

65

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
170
发表于 2022-7-6 07:57:10 | 显示全部楼层 |阅读模式
I got this to work but before i go any farther is there a better or shorter way to reach the same result? I am using 2012 and these have been modified from some codes I have gotten here.
 
  1. (defun C:bd() ;list your key here, it is not necessary but it will useful with a huge list of key, or you can do a function lisp to write your dcl(setq     lstWidth '( "3.5" "5.25" "7" "1 ply" "2 ply" "3 ply")       lstDepth '("7.25" "9.25" "11.25" "11.875" "14" "16" "18")         lstmembr '("Flush Beam" "Header/Drop Beam")  )        (or membr (setq membr (car lstmembr)))(or width (setq width (car lstWidth)))(or depth (setq depth (car lstDepth)))                              (setq dcl_id (load_dialog "beam.dcl"))                      (if (not (new_dialog "beam" dcl_id)) (exit)                           (progn              (set_tile membr "1")       (set_tile width "1")       (set_tile depth "1")                    (action_tile "kmembr" "(setq membr $value)")     (action_tile "kWidth" "(setq width $value)")       (action_tile "kDepth" "(setq depth $value)")       (start_dialog)       (unload_dialog dcl_id)   ))(if (= membr "Flush Beam") (setq tp 2))(if (= membr "Header/Drop Beam") (setq tp 3))  (if (= width "3.5") (setq wd 5))(if (= width "5.25") (setq wd 7))(if (= width "7") (setq wd 11))(if (= width "1 ply") (setq wd 13))  (if (= depth "7.25") (setq dp 23))(if (= depth "9.25") (setq dp 29))(if (= depth "11.25") (setq dp 31))(setq bt (+ (+ wd dp) tp))(command "filedia" "0") (if (= bt 30)   (command "_.layer" "M" "S-FRM-BEAM" "C" "12" "S-FRM-BEAM" "s" "S-FRM-BEAM" "" "-linetype" "c" "3.5x7.25 PSL" "" "Y" "3.5x7.25 PSL" "0.25,-0.125" "S" "3.5x7.25 PSL" ""    )      ) (if (= bt 39)   (command "_.layer" "M" "S-FRM-HEADER" "C" "1" "S-FRM-HEADER" "s" "S-FRM-HEADER" "" "-linetype" "c" "5.25x9.25 PSL" "" "Y" "5.25x9.25 PSL" "0.25,-0.125" "S" "5.25x9.25 PSL" ""    )      ) (command "filedia" "1") (princ))
 
  1. beam : dialog {label = "Pick a Member";     : row {       : boxed_radio_row {key = "kmembr";         label = "Member";         : radio_button {           label = "Flush Beam";           key = "Flush Beam";         }         : radio_button {           label = "Header/Drop Beam";           key = "Header/Drop Beam";           }}}     : row {       : boxed_radio_row {key = "kWidth";         label = "Width";         : radio_button {           label = "3.5";           key = "3.5";         }         : radio_button {           label = "5.25";           key = "5.25";         }         : radio_button {           label = "7";           key = "7";         }         : radio_button {           label = "1 Ply";           key = "1 Ply";         }                  : radio_button {           label = "2 Ply";           key = "2 Ply";         }                  : radio_button {           label = "3 Ply";           key = "3 Ply";         }}}         : row {       : boxed_radio_row {key = "kDepth";         label = "Depth";          : radio_button {           label = "7.25";           key = "7.25";                    }         : radio_button {           label = "9.25";           key = "9.25";         }         : radio_button {           label = "11.25";           key = "11.25";         }                  : radio_button {           label = "11.875";           key = "11.875";         }                  : radio_button {           label = "14";           key = "14";         }                  : radio_button {           label = "16";           key = "16";         }                  : radio_button {           label = "18";           key = "18";         }}}                : row {       : button {         label = "&OK";         key = "accept";         fixed_width = true;         is_default = true;         alignment = centered;       }         : button {         label = "&Cancel";         key = "cancel";         fixed_width = true;         is_cancel = true;         alignment = centered;       }     }}
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 08:23:12 | 显示全部楼层
Is the final result of the routine would be to create specific layers names with some kind of different properties ?
If yes , list the name of your layers to have then in pop_up list instead of all these long lines of codes .
回复

使用道具 举报

33

主题

96

帖子

65

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
170
发表于 2022-7-6 08:46:09 | 显示全部楼层
Sorry what it does is it creats a layer with a linetype then I will make it draw lines where ever I need them, then another routine I have will label all those lines by their linetypes. If that makes since? I just didn't want to keep writing alot of code knowing there has to be shorter way to write it. I trying to learn has i go.
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 09:01:15 | 显示全部楼层
While I don't quite understand your entire process,
 
 
You may want to look into (cond) statements:
 
  1. (if (= depth "7.25") (setq dp 23))(if (= depth "9.25") (setq dp 29))(if (= depth "11.25") (setq dp 31))
 
  1. (setq dp  (cond ((= depth  "7.25") 23)       ((= depth  "9.25") 29)       ((= depth "11.25") 31))       (T (alert "Cannot find a Depth - Aborting")          (exit)))
 
But you would need a robust error trap in order to use (exit) safely -David
 
Or you code force a manual input
  1. (setq dp  (cond ((= depth  "7.25") 23)       ((= depth  "9.25") 29)       ((= depth "11.25") 31))       (T (initget 7)          (setq depth "\n Depth Not Found - Enter a Depth Value:   ")))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 20:48 , Processed in 0.401214 second(s), 60 queries .

© 2020-2025 乐筑天下

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