乐筑天下

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

[编程交流] listbox selection - insert blo

[复制链接]

1

主题

14

帖子

13

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 08:09:45 | 显示全部楼层 |阅读模式
I am new to writing visual lisp routines, and i am trying to develop a routine that shows a dialog box for valves and then you can select one and hit ok and then it inserts the block that you selected. Below is what i have so far...
 
Dcl file:
 
  1. BlockSelect : dialog { label = "Select block to insert";: list_box {key = "list";height = 10;width = 40;}ok_cancel;}
lsp file:
  1. (Defun c:valve (/)(defun ChooseBlk (lst / dcl result blkname)(defun OKClicked (/ )(setq result (get_tile "list"))(if (or (not result) (= result ""))(done_dialog 0)(progn(setq result (nth (atoi result) lst))(done_dialog 1))))(setq dcl (load_dialog "blksel.dcl"))(new_dialog "BlockSelect" dcl)(start_list "list" 3)(mapcar 'add_list lst)(end_list)(setq list (list "BALL" "BUTTERFLY" "CHECK"))(if blkname (progn )(princ "Canceled by user"))(action_tile "accept" "(OKClicked)")(action_tile "cancel" "(done_dialog 0)")(if (= 1 (start_dialog))resultnil))
 
any advise would be much appreciated!
 
Thank you
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:14:53 | 显示全部楼层
Hi Matsui21,
 
Welcome to CADTutor!
 
Firstly, I would suggest that you read the Code Posting Guidlines and edit your post to format your code correctly.
 
Concerning the program: are you writing the program specifically to learn LISP/DCL, because if not, I would recommend you use Tool Palettes for this task - they are very powerful and easy to use.
 
Lee
回复

使用道具 举报

1

主题

14

帖子

13

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 08:19:15 | 显示全部楼层
tool palettes would be fine...the only question i would have with using them is how do i make it to where other users can pull up the Palettes that i create?  And then when a new version of AutoCAD is installed with those Palettes transfer?  
 
Thanks,
Matt
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:19:46 | 显示全部楼层
 
You have the option to Import / Export the Tool Palettes that you create, although others may have a more streamlined solution.
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 08:23:00 | 显示全部楼层
1. Create a toolpalettes directory on the server.
2. Change the toolpalettepath (in options or do it by code) on everyone's computer to one on server
3. Either make the folder "read only" or have IT remove write access to that folder from everyone except you (keep people from accidentally altering something or you losing work - last out gets priority).
4. Every time you make an update to the tool palettes, everyone else will see the additions.
5. ???
6. Profit!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:28:28 | 显示全部楼层
Nice one Alan
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 08:30:13 | 显示全部楼层
b/w ToolPalletes, the enterprise CUIx and a custom menu pulldown, I can easily streamline everything I need for every user in the office.
回复

使用道具 举报

1

主题

14

帖子

13

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 08:34:36 | 显示全部楼层
Thanks Alan for the help on that!
Here is my next question for you and Lee; not all users are on the same version of AutoCAD...are the palettes that i create going to be able to function on different versions?
 
Thanks,
Matt
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 08:36:47 | 显示全部楼层
AFAIK, it shouldn't matter - very little has changed with Tool Palettes over the years. What version differences are we talking? Your biggest limitation with version differences will lie in lower versions not being able to utilize objects/procedures created in a newer version of CAD. Rule of thumb: if you have multiple versions of CAD to deal with and have to streamline blocks, etc., always make sure to create everything with the lowest used version of CAD.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 08:41:18 | 显示全部楼层
A bit extra if you have your partial menu's on the server only and make a change to the mnu then next time others start Autocad they will automatically see the new menu, you do not have to go to their box and load.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 08:47 , Processed in 0.510471 second(s), 83 queries .

© 2020-2025 乐筑天下

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