• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

script for layer selection and design

gargois

Guest
Hello everyone,
I'm new to the forum. I also tried to look into the discussion archive, but I couldn't find anything about my case.
what I want to do is a script that allows me to do these steps:
1- Select a layer already created es."linea_1";
2- draw a circumference defining coordinates and radius;
3- select another layer already created e.g.linea_2";
4- draw a spline;
5- Select another layer already created "text";
6- write the text.

I can currently draw the circumference, spline and write the text, but I can't select the layer and concatenate all the functions in one script.

I bring back the various scripts I use and that individually work well.
draw circumference:
_circle 0.000,0.000,0.00 4.00

draw spline:
splines
-2.927422,-2.927422,0.000000
start tangenza -1
-2.632559,2.632559,0.000000
2.746403,2.746403,0.000000
3.027124,-3.027124,0.000000
Shut up!
end

write the text
_
-4.000000,28.000000
_
@1,1
0.80%
0
circle-1

I thank all those who will give me information in advance.
 
to set the layer
-layer (the - serves to use command line options when the launched command uses a window)
Current current
name of the layer
 
to set the layer
-layer (the - serves to use command line options when the launched command uses a window)
Current current
name of the layer
Thank you for the answer. I tried and managed to run the command for layer selection.
Now if I want to concatenate everything?
1- Select a layer already created es."linea_1";
2- draw a circumference defining coordinates and radius;
3- select another layer already created e.g.linea_2";
4- draw a spline;
5- Select another layer already created "text";
6- write the text.

I tried this way, but instead of making the spline draws another circumference and then exits the autocad closing screen. What's wrong?
"
-current layer line_1

_circle 0.000,0.000,0.00 4.00

-current layer line_2

splines
-2.927422,-2.927422,0.000000
start tangenza -1
-2.632559,2.632559,0.000000
2.746403,2.746403,0.000000
3.027124,-3.027124,0.000000
Shut up!
end
"
 
after the command of the circle does not need an empty line that acts as a sending because the sequence of the command circle closes with the definition of the radius
 
First of all mistakes with that end
Thank you both. I modified by eliminating end and row after the circumference command."-layer current line_1

_circle 0.000,0.000,0.00 4.00
-current layer line_2

splines
-2.927422,-2.927422,0.000000
start tangenza -1
-2.632559,2.632559,0.000000
2.746403,2.746403,0.000000
3.027124,-3.027124,0.000000
close.
if I copy what written in the autocad command bar works correctly, while, if I create a .txt file and change the extension in .scr as soon as I start it comes out "key word of the invalid option" and appear the command line options connected to the -layer.
 
to correctly create a script downloads that pr.esente in the forum http://www.cad3d.it/forum1/threads/6107-creare-file-script?p=49370&viewfull=1#post49370. works both as a script for single file and as a script for multiple files
I to check what was wrong with your post #3 version I created a scr file and had no problem.
the scr file is sufficient to drag it inside the autocad sheet.
However if you have doubts and problems on a file it is always better to attach it so that you can actually check how it is done and not have to reproduce it
 
to correctly create a script downloads that pr.esente in the forum http://www.cad3d.it/forum1/threads/6107-creare-file-script?p=49370&viewfull=1#post49370. works both as a script for single file and as a script for multiple files
I to check what was wrong with your post #3 version I created a scr file and had no problem.
the scr file is sufficient to drag it inside the autocad sheet.
However if you have doubts and problems on a file it is always better to attach it so that you can actually check how it is done and not have to reproduce it
Yes, you're right it becomes complicated to give a hand without attaching the file.
I solved the initial problem that gave me the error on layer selection, it was too much space. like everything solved one problem comes out another. this time I attach the .dwg file with the layers already created and the .txt file with the script I use. If I copy the text and take it to the whole of the command bar it works correctly without errors, while, converting it into .scr format and recalling it from autocad by error on the definition of the tangent. I tried different solutions, but I couldn't understand the problem.
 

Attachments

First of all, as from script does not appear the request for start tangency or tolerance eliminates that line.
then interpose between the circle and the spline the deactivation of the object snap that otherwise mimics the spline towards the center of the circle by distorting the pass points, then enter the rowssnap
off
in the end if you need to reactivate the object snap with the reverse commandsnap
on
 
I did the corrections as you said and always only works by copying the text directly into the command line, while when starting the script does not work. now after specifying the first point wants the tangent. I honestly don't understand why there's this difference. I attach the new script.
View attachment 002_script.txt
 
I specified you have to delete the tangent line
also did not turn off the snap

in practice is equal to before

instead of writing it in the command line to see that it does not work as scripts, composes the script directly and verify it
1 write the file scr
2 open it with note block
3 make changes and saves without closing notes block
4 drag the scr file into the autocad file
repeat point 3 and 4 until you are satisfied
 
I specified you have to delete the tangent line
also did not turn off the snap

in practice is equal to before

instead of writing it in the command line to see that it does not work as scripts, composes the script directly and verify it
1 write the file scr
2 open it with note block
3 make changes and saves without closing notes block
4 drag the scr file into the autocad file
repeat point 3 and 4 until you are satisfied
You're right, I was wrong to attach the file. Now it works without problems the script, however every time the start comes out a different spline and not what I need, for this reason I set the initial tangent just to avoid problems. I attach the script and the .dwg file where it is reported in red as it should be my spline and in blue one of the many spline that comes out.
I also added text writing and works properly.
 

Attachments

I certainly did wrong to indicate the command to disable. It is not snap (which attaches the cursor to the grid, as you see at the end of the cycle that goes to snaps), but osnap (which attaches the cursor to certain positions of the entities present as centers, intersections, average points...).
if in your model these hooks are not present you do not need to use it, otherwise when you write it you place the sign - so as to inhibit the appearance of the window.
this has little to do with the result; Steppoints are also correct in the script version.
I didn't understand what this staggering was, but I noticed that by changing the properties of the spline from script, bringing it from closed to open and closed again, the form is correct.
then at the end of the creation of the spline should be inserted the series of commands that:
select spline
the edita
opens
and closes
 
I tried to edit the spline by opening it and then closing it again, but it only works for some spline created that do not differ much from my result. Why does every time the script starts out a different spline? Why if I take the script into the command bar works perfectly?
 
the speech of the different spline I think depends on the active osnap command. make the change I have indicated to you (from snap off a -osnap off) and should work properly.
I have never used spline in autocad so I am approaching for the first time to the question.
 
Thank you for your help. That is the problem. At least now the same spline always comes out and I can edit, open and close. Although it seems not too clean as a process, however it works. I also attach the script in case you have to give me some other indication.
 

Attachments

Unfortunately the script on which I tried and on which you gave me suggestions contains only a portion of the whole script, as, I must repeat the circumference, the spline and the text n times. the command published spline works only with the selection of a spline :frown:. Do you have any other ideas about this?
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top