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

create with only one multiple layer command with progressive suffix

  • Thread starter Thread starter Zoro7610
  • Start date Start date

Zoro7610

Guest
Good day everyone is new to the forum.
I looked around and noticed that there are real field experts. I unfortunately do not know the lisp language even if with autocad at work I use some command. I wanted to kindly ask if there was a way to create n layers (n = quantity to be inserted by hand) that have the name consisting of "a base" and then a "progressive number". For example:


...etc.. .

_
...etc.. .


I looked a little around the site but unfortunately I couldn't find a similar application.

Meanwhile I thank you in advance for any straight.
Have a good day.
 
without disturbing the great lisp, you can create an icon and associate it with the following macro:
^c^c_-la^m_m^mr$and01^ m _ m ^ mr$and02^ m _ m ^ ml$ast01^ m _ m ^ ml$ast02^ m ^ mor you can create a known block script.

both solutions also work with autocad lt, while the lisp is managed only by so-called "full" versions.
p.s.if you have many progressive layers, hand editing a macro or script becomes ostic: It is therefore appropriate to use excel or similar to generate automatic progression, then copy and paste everything into a text editor (I recommend the Swiss knive knowntab light).

:
 
the quickest solution to me is to create a script, as it says above the Irish
...or you can create a known block script...
but using excel and then paste everything into the notepad.
the speed of using excel is in the fact that just write you in a column only these first two lines
-layern
r$and01
n
r$and02
and drag them into block (excluding the line where the command is written) until they reach the desired number of layers. excel will automatically duplize you with the progressive.
then make a simple copy-paste in the notepad and save with scan extension.
longer to say than to do.
 
-layern
r$and01
n
r$and02
Let me make it more universal, regardless of the autocad language:
_-layer
_m
r$and01
_m
r$and02
...
smile.gif
 
Come on, come on, shake up excel or create a macro with all the difficulties.
are 4 rows of lisp (which should still be refined, be clear), but are 4 rows...
 
Let me make it more universal, regardless of the autocad language:
...
I had not read the addition you had made before my suggestion:
p.s.if you have many progressive layers, hand editing a macro or script becomes ostic: It is therefore appropriate to use excel or similar to generate automatic progression, then copy and paste everything into a text editor (I recommend the Swiss knive knowntab light).
Come on, come on, shake up excel or create a macro with all the difficulties.
are 4 rows of lisp (which should still be refined, be clear), but are 4 rows...
be... certainly better the lisp. we tried! :biggrin:
 
It should work. :smile:
Code:
(defun c:crealay (/ n_lay pref_lay start_lay suff nome_lay)
    (setq n_lay (getint "numero dei layer da creare:  "))
    (setq pref_lay (getstring "\nprefisso per nome layer:  "))
    (setq start_lay (getint "\nsuffisso iniziale:  "))
    (repeat n_lay
	(if (> start_lay 9) (setq suff (rtos start_lay 2 0)))
	(if (< start_lay 10) (setq suff (strcat "0" (rtos start_lay 2 0))))	
	(setq nome_lay (strcat pref_lay suff))
	(entmake (list
		     (cons 0 "layer") (cons 100 "acdbsymboltablerecord")
		     (cons 100 "acdblayertablerecord") (cons 2 nome_lay)
		     (cons 6 "continuous")  (cons 70 0)	
	)	 )
	(setq start_lay (1+ start_lay))
    )
)
edit
I didn't see the peppe mail lisp, should I start worrying? :tongue::tongue:
 
Well, I don't know how to thank you guys. I was right away the time of lunch and just back I noticed with a lot of pleasure and wonder that you solved the problem.
Thank you very much giuseppe mauro for the lisp that wrote me.
That's exactly what I needed.

Thanks again
 
I didn't see the peppe mail lisp, should I start worrying? :tongue::tongue:
No, no, no, no, no, no, no, no, no, no, no, no.
I wanted to insert something like lay_9 if layers less than 10, lay_09 if layers less than 100, lay_009 if less than 1000 and so on, but I met some obstacle of concatenation (also because I wrote it jet)
Maybe together we get something out of the posters:
 
variant to the use of excel (or other electronic sheet) without going through a script.
in excel:
write in 2 adjacent horizontal cells
liv1,(vigorgular)
horizontally drag the block of the 2 boxes until it is necessary
Select and join all cells in one cell
copy cell content

pass to autocad:
-layer.
new
paste the previous content
sending

definitely the lisp language is more elegant and allows to insert other parameters, but you need to handle it safely, otherwise it is time lost.
 
lay_09 if layer less than 100,...
It is the instruction that I put into my own, regardless of the fact that the layers were > 9, as it is the example that indicated gold in his first post:

(if (< start_lay 10) (setq suff (strcat) "0" (rtos start_lay 2 0))

You can change yours in that sense, while honestly I haven't even thought about the limit of 1000, just to imagine having to handle them makes me shiver. :tongue:
 
Well, mine is currently calibrated (unintentionally) up to 1000. in fact if you put more than a thousand layers, warn you and exit
 
under autocad 2006, the list of layers separated from commas does not act, sin.

:
strange; by memory it seemed like it was an almost original option; In addition,
I found this quote from ellen finkelstein in a manual on autocad2004: "to simultaneously create different layers, click
new and type all the names of the desired layers, separated by a comma"; and if you say so...
Hi.
 
@ josephI'm sorry, you're right. csv list works with _new suboption, while I stubbornly came up with _make.
@mastri lisparI found out that both of the files proposed have the same bug: they block if the name of the layer contains a space...

:
 
That's true. :redface:::redface:

so it should work.
Code:
(defun c:crealay (/ n_lay pref_lay start_lay suff nome_lay)
    (setq n_lay (getint "numero dei layer da creare:  "))
    (setq pref_lay (getstring t "\nprefisso per nome layer:  "))
    (setq start_lay (getint "\nsuffisso iniziale:  "))
    (repeat n_lay
	(if (> start_lay 9) (setq suff (rtos start_lay 2 0)))
	(if (< start_lay 10) (setq suff (strcat "0" (rtos start_lay 2 0))))	
	(setq nome_lay (strcat pref_lay suff))
	(entmake (list
		     (cons 0 "layer") (cons 100 "acdbsymboltablerecord")
		     (cons 100 "acdblayertablerecord") (cons 2 nome_lay)
		     (cons 6 "continuous")  (cons 70 0)	
	)	 )
	(setq start_lay (1+ start_lay))
    )
)
 
Thank you, brother, but there's still one thing left: impose that the user may enter only higher or equal to zero, while now it also accepts negative values (and therefore out of progression).

:
 

Forum statistics

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

Members online

No members online now.
Back
Top