TheSwamp
Code Red => .NET => Topic started by: teslaxx on June 17, 2012, 02:56:58 AM
-
I have a script file in which I create layouyts based on the number of the layouts and the coordinates of 2 points.
LAYOUT C layout1 layout2 LAYOUT S layout2 MSPACE -PAN 250,00 0,0 PSPACE
LAYOUT C layout2 layout3 LAYOUT S layout3 MSPACE -PAN 250,00 0,0 PSPACE
LAYOUT C layout3 layout4 LAYOUT S layout4 MSPACE -PAN 250,00 0,0 PSPACE
LAYOUT C layout4 layout5 LAYOUT S layout5 MSPACE -PAN 250,00 0,0 PSPACE
But it's gets boring to modify the script for every file. Sometimes I need only 15 layouts, sometimes I need 200 layouts, sometimes the points are not same etc.
So, using .NET, I created a method which takes the number of layouts needed to be created and the x, y of the those two points. I created the text of the script using C# and after that I run the script using acedPostCommand. And it's works like a charm.
BUT if I want more than 10 layouts, the program is not working anymore because after a little of debugging I found out that the script runs beginning with the line 10.
LAYOUT C layout10 layout11 LAYOUT S layout11 MSPACE -PAN 250,00 0,0 PSPACE
In this situation, without having the previous layouts before layout 10, it's stupid to run the script. I don't understand WHY the script begins running with the line 10 when I run it with acedPostCommand.
I thought that the way I created the script was wrong, but I saved in a scr file the string of the script before sending it to acedPostCommand and it's look alright. I run the script in Autocad using the scr command and it does what it's suppose to do.
SO, the problem is that I can understand why the script runs with the line 10 and not with the line 1. This happens only with b]acedPostCommand[/b] and only I have more than 10 layouts.
I modify the code in all ways possible to be sure I don't a glitch, but I found nothing. It's look alright.
Any suggestions? :)
-
Interesting problem !
You are correct, the script works manually. Interestingly, I used 13 layouts and Layout 9 was at the end ???
What happens when you use a really long script ??
I use Expert 5 for this sort of thing, but that shouldn't make a difference in this particular case.
I assume you get no debug messages and no error messages at the command line ?
I don't use acedPostCommand much, so I'm not familiar with any particular issues. Perhaps someone who has more experience will recognise the cause of your problem
Regards
kdub.
-
Thank you Kerry for your time to look at this problem. :)
Another particular effect:
Let's say I want to have 15 or 17 layouts, Autocad runs the 9th line of the script.
If I want 20 or 25 layouts, Autocad runs the 17th line of the script.
100 or 105 - 97th line of the script
This happens using acedPostCommand.
If I take a long script (having 250 layouts) using the scr command in Autocad all if fine. After 1-2 minutes I have 250 layouts. :)
-
Solved.
I've changed to SendStringToExecute :)