Copy to Layer
I frequently want to copy objects from one layer to another. This is done in Autocad by "copytolayer". I cannot find anything similar in Bricscad. To copy between layers I resort to copying an item a set distance, changing its layer properties and then moving it back the same distance. This is time consuming and irritating. Anyone got a means of doing it in Briscad?
Comments
-
You could make a scripted menu command to do it:
Ctrl-C, Ctrl-V, Enter, Selgrips, Enter, P, Enter
And then just select the target layer from the pull-down list.
Or, if you'd rather type the layer name:
Ctrl-C, Ctrl-V, Enter, Change, Enter, L, Enter, Enter, P, Enter, LA, Enter
Or you could use lisp to make a custom command that duplicates a selection set in place and leaves the duplicate highlighted:(defun c:CTL ( / ss1)
(setq ss1 (ssget))
(if ss1 (progn
(command "copyclip" ss1 "")
(command "pasteclip" "")
(sssetfirst nil (ssget "P"))
))
)0 -
I've written two lisp programs which might interest you :
- lay_sel : let's you select your entities and after you're done with it, you select another entity
on which layer you want the first selection to be moved.
- lay_cur : puts the selection on the current layer
I'm affraid it's all in German I tranlated it only roughly.
;lay_sel
;verschiebt die ausgewählten Objekte auf einen Layer nach Wahl
(defun c:lay_sel ( / auswahl auswahl anzahl eldaten elname lay_0 zaehler)
(setq auswahl (ssget))
(if auswahl
(progn
(setq anzahl (sslength auswahl)); anzahl Elemente wurden gewählt
(setq lay_0 (entget (car (entsel "\nChoose entity on target layer :"))))
(if lay_0
(progn
(setq zaehler 0)
(setq lay_0 (cdr (assoc 8 lay_0)))
(while (< zaehler anzahl)
(setq elname (ssname auswahl zaehler)); Entity-Name ermitteln
(setq eldaten (entget elname)); Entity-Daten ermitteln
(setq eldaten (subst (cons 8 lay_0)(assoc 8 eldaten) eldaten));Layer austauschen
(entmod eldaten)
(setq zaehler (1+ zaehler)); jetzt wird der Index um 1 erhöht
); while
); progn
);if
);progn
(princ "\nnothing selected ! ")
);if
);defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;lay_cur
;verschiebt die ausgewählten Objekte auf den aktuellen Layer
(defun c:lay_cur ( / auswahl auswahl anzahl eldaten elname lay_0 zaehler)
(setq auswahl (ssget))
(if auswahl
(progn
(setq anzahl (sslength auswahl)); anzahl Elemente wurden gewählt
(setq lay_0 (getvar "clayer"))
(setq zaehler 0)
(while (< zaehler anzahl)
(setq elname (ssname auswahl zaehler)); Entity-Name ermitteln
(setq eldaten (entget elname)); Entity-Daten ermitteln
(setq eldaten (subst (cons 8 lay_0)(assoc 8 eldaten) eldaten));Layer austauschen
(entmod eldaten)
(setq zaehler (1+ zaehler)); jetzt wird der Index um 1 erhöht
); while
);progn
(princ "\nnothing selected ! ")
);if
);defun0 -
Hi,
I had some time to kill this summer and I made a implementation of it in VBA. That was for the fun of programming it.
You'll be able to get it at TheSwamp.org as here we cannot share such files, and for that you'll need to register (free)
http://www.theswamp.org/index.php?topic=30139.0
Gerrit
0 -
Thank you Gerrit, I have joined Swamp and downloaded your zip file. I even managed to do everything you said and can now copy to layer and move to layer with ease. Wonderful! I hope Bricsys will get this incorporated directly in Bricscad. It is such an important drawing aid.
I noted the comments on Swamp that an Autocad user should be able to effectively "cut and paste" the function into Bricscad so it shouldn't be difficult if that is right.
0 -
> to copy between layers I resort to copying an item a set distance,
> changing its layer properties and then moving it back the same distance.
> This is time consuming and irritating. Anyone got a means of doing it in
> Briscad?OK, you found some programmed solutions, buit this is a case where no programm is necessary.
You don't need to copy with an offset. Just copy the object with basepoint 0,0 and destination point 0,0, so that the copy will stay on the same place. And then change the layer of the previous selection set (i.e. with command _chprop, when asked to select objects you just reply _p for the previous selsction set). That's all.
0 -
Thomas, you don't need to type a 0,0 basepoint or destination point. Just use Ctrl-C (Copyclip) and Ctrl-V (Pasteclip) (or Copy and Paste in the right-click context menus), and then hit Enter instead of specifying a destination point.
And "Selgrips P" selects and highlights the newly pasted copy of the selection set. That allows you to specify the layer by using the pull-down list, instead of typing the layer name as you would have to do with "Chprop P LA."0 -
> And "Selgrips P" selects and highlights the newly pasted copy of the selection set.
Interesting - in AutoCAD this command does not exist. However: highlighted and selected is the previous selection set, and not the newly pasted copy. But this difference would be rather irrelevant for most users.
It would be simple to create a command that would really highlight/select all new entities that have been created by the last command(s). I'll do that and post the source code here later.
0 -
> I'll do that and post the source code here later.
Done.
See the thread "ssHistory" above.
0 -
quote: Interesting - in AutoCAD this command does not exist. However: highlighted and selected is the previous selection set, and not the newly pasted copy. But this difference would be rather irrelevant for most users.
Yes, it's a minor point, but in fact it is the newly pasted set that's selected and highlighted. You can prove that by pasting to a new location, by clicking on a point instead of hitting Enter. Selgrips P highlights the set in the new location. With the Copy command, the original set is selected and highlighted, but with Copyclip and Pasteclip it's the new set. That's an irregularity, but an excellent choice, in my opinion. It's very convenient when copying and pasting objects from one tab to another, or from one drawing file to another.
quote: It would be simple to create a command that would really highlight/select all new entities that have been created by the last command(s).
(defun c:SP () (sssetfirst nil (ssget "P")) )
(defun c:SL () (sssetfirst nil (ssget "L")) )I use those, but I don't need them very often, since I've written custom versions of all the commands so that every drawing operation leaves the newly created object selected and highlighted, and every editing operation leaves the previous selection set still selected and highlighted. I use it in combination with PICKADD=0.
0 -
Boy I wish I understood half of what you guys are saying. I'm only a struggling architect not a programmer. I can drive a car but haven't a clue about customising.... It's hard enough for me to add a partial cui or mnu file! (And I am terrified I'm going to screw that up!).
I wish the programme kept commands going until I chose to drop them. I wish the programme kept selections until I choose to drop the selection. Seems like some of you have found out how to change things to do this. I wish is was an option to choose in the basic setup system. Are you listening Bricsys?
Thanks anyway, at least I have a means of copying or moving to layer that I can use with ease and no writing long commands.... (which I hate).
Simon
0 -
Hi Simon,
I'm glad you are able to use it and I'm sorry if installing has been difficult.
And I'm sure nobody meant to intimidate you... There are simply many ways to perform CAD-tasks and some of us go for the most efficient way, while for others a familiar feel is more important.
Gerrit
0