乐筑天下

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

[编程交流] repeat insert block - while lo

[复制链接]

15

主题

687

帖子

169

银币

中流砥柱

Rank: 25

铜币
582
发表于 2022-7-6 07:33:25 | 显示全部楼层
I corrected the error handling when the block (or file) is not found, so reload the new version.
 
To use it, load the DLL from AutoCAD with the NETLOAD command (the DLL is loaded for the whole session) and type MULTINSERT.
回复

使用道具 举报

1

主题

8

帖子

7

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:38:37 | 显示全部楼层
 
All right men! Excellent stuff!!!
I owe you a beer!
 
By the way, where is the new version?
 
Thanks!
"France 10 Points!"
回复

使用道具 举报

15

主题

687

帖子

169

银币

中流砥柱

Rank: 25

铜币
582
发表于 2022-7-6 07:39:59 | 显示全部楼层
 
In the first message, it replaces the old one.
回复

使用道具 举报

1

主题

8

帖子

7

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:44:11 | 显示全部楼层
 
Thanks again,
 
I have learned something today,
Have a nice day!
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 07:46:27 | 显示全部楼层
mestar,
 
Here is a looping method that I use. Some might frown on it, But its really not bad. I have seen well known programmers use this method before. I create a function for the loop instead of using while allowing prompting of two choices, R or Enter for repeating insertion or E for program Exit.
 
Give this a try. You will also see the block on insertion.
 
The block name must be called MyBlock.dwg and must be in the ACAD Search Support Path or you can use findfile and specify the path. I included a line for this if you decide to use it. It is commented out temporary for now. I indicate instructions for this.
 
See the attached Zip file.
Sorry about that, But I am having trouble posting this code with code brackets.
MyBlock.zip
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 07:50:52 | 显示全部楼层
 
Hello gile.
 
How do you make the .dll file ? ....  and is it better than .vlx file ?
 
Many thanks
 
Tharwat
回复

使用道具 举报

15

主题

687

帖子

169

银币

中流砥柱

Rank: 25

铜币
582
发表于 2022-7-6 07:53:29 | 显示全部楼层
tharwhat313,
 
This DLL is compiled from a .NET (C#) code, not LISP.
And yes, "it's better than vlx" because .NET is more powerfull than LISP (this example shows it).
回复

使用道具 举报

1

主题

8

帖子

7

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:57:06 | 显示全部楼层
 
Thanks Buzzard,
 
It's OK, but there is a one klick too much (for my user who is to be my boss, and does not know anything about it...) I supose "repeat" could not be a default option and ESC as an exit?
 
Thanks for your time!
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 08:00:33 | 显示全部楼层
 
Thats Ok, I just want to put another option out there for you. I did setup R (Repeat) as a default so all you needed to do was right click the mouse for enter. You do not need to enter R each time, And when you were done click E for (Exit). As I mentioned not everyone cares for this method. If you are changing settings in the program it would pay to have an error trap so that ESC will not screw the settings up. I think the program works cleaner this way than using ESC.
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 08:02:57 | 显示全部楼层
I modified MyBlock.lsp to MyBlock2.lsp. I used you suggestion looping the insert command and allowing you to use ESC to exit. Its up to you, But as I said its sort of tacky. I would prefer the first lisp better.
 
By the way, I had retested the first code comparing the amount of steps required to operate. There are no extra steps. You must hit enter to finish out the insert command in any event. So what is the difference between hitting enter in the loop or at the end of each insert which is the same thing. I mentioned before that you do not have to hit the R for Repeat, But right click for enter as this is set as default or enter. The E for Exit is no different than hitting ESC except that E for Exit is a cleaner way to exit as it does not show an error.
The amount of steps required will depend upon the insert command input such as Block Scale and rotation.
I will make one more code and post to show you the difference in speed of insertion by supply default values for these as well.
You need to move away from those rogue code habits.
MyBlock2.lsp
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 10:56 , Processed in 0.724114 second(s), 70 queries .

© 2020-2025 乐筑天下

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