gile 发表于 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.

mestar 发表于 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!"

gile 发表于 2022-7-6 07:39:59

 
In the first message, it replaces the old one.

mestar 发表于 2022-7-6 07:44:11

 
Thanks again,
 
I have learned something today,
Have a nice day!

The Buzzard 发表于 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

Tharwat 发表于 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

gile 发表于 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).

mestar 发表于 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!

The Buzzard 发表于 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.

The Buzzard 发表于 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
页: 1 [2]
查看完整版本: repeat insert block - while lo