Hi all,
I wrote this script regarding this post:
https://qcad.org/rsforum/viewtopic.php?t=9355
And it is already very helpful.
The tool will activate the layer that the entities in selection have in common.
Therefor it requires a selection upfront.
It will report an ambiguous selection disregarding the actual current layer being ambiguous with others in the selection.
It does not re-activate a current active layer but will report that the selection is on the current layer.
Setting a layer active is a two step process, it requires an extra action to fully undo.
With 'Y' there are not many options left for the shortcut (b, g, j, q, x).
Opted for the key sequence 'YJ' what doesn't seem to conflict.
Had some hiccups in coding it ...
For one, creating subfolders including the hierarchy separator ' ... ' acts weird.
And for PRO users it will now also expand the layer tree so that the active layer is at least visible.
The reasons for that are:
- On reloading a drawing all main level parents are collapsed.
Sublayers only may retain their expanded/collapsed state.
- A drawing may open without the current active sublayer visible.
- Expanding/collapsing a level in the Layer List is also setting it active.
The tool should work for CE users just the same. Can anyone confirm that?
Initially intended as a tool in the Layer menu but reverted back to the Misc .. Layer menu.
Details are in the scripts what are textual files.
Scrolling the Layer List would be a nice addition but that is beyond my capabilities .
The 5 files in the zipper can be installed in your QCAD installation path under ...\scripts\Misc\MiscLayer\ActivateLayerFromSelection\
Or in the local data location, see Changelog ... 3.26.2 (2021/04/15):
https://www.ribbonsoft.com/en/documentation/changelog
The folder construction is mandatory, the path to the main script itself should read:
...\scripts\Misc\MiscLayer\ActivateLayerFromSelection\ActivateLayerFromSelection.js
Andrew may include this in a future release of QCAD.
In such a case one would delete these installed files and additional the emptied folders.
Andrew may also decide to implement it as a Layer tool, details are in the initialization file.
In such a case one must remove those that are installed in the Misc menu to avoid conflicts.
Regards,
CVH
Activate Layer From Selection
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Activate Layer From Selection
Thanks.
I'd propose to implement this as part of the context menu instead:
- User right-clicks entity
- Context menu shows "Activate layer of entity"
Is there an advantage of the implementation based on the current selection?
I'd propose to implement this as part of the context menu instead:
- User right-clicks entity
- Context menu shows "Activate layer of entity"
Is there an advantage of the implementation based on the current selection?
-
- Premier Member
- Posts: 474
- Joined: Mon Sep 30, 2019 6:21 am
- Location: Melbourne - Australia
Re: Activate Layer From Selection
I'll 2nd that Andrew, I've been using this with hotkeys YJ..
And nice work CVH.. Very useful indeed..
Cheers
John
And nice work CVH.. Very useful indeed..
Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]
-
- Premier Member
- Posts: 474
- Joined: Mon Sep 30, 2019 6:21 am
- Location: Melbourne - Australia
Re: Activate Layer From Selection
I think if a drawing had a few layers and using the same colour it would be beneficial selecting 1st..just my 2 cents worth. Is there an advantage of the implementation based on the current selection?
Cheers
John
PS Thinking more about this could you cover both options
Right click on selection and just right click change layer
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]
Re: Activate Layer From Selection
The context menu option does not depend on the selection at all. The layer of the entity that is right-clicked is activated independent of the current selection.
-
- Premier Member
- Posts: 474
- Joined: Mon Sep 30, 2019 6:21 am
- Location: Melbourne - Australia
Re: Activate Layer From Selection
I see now what you mean
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]
Re: Activate Layer From Selection
Andrew,
In my case several entities can be stacked on the same spot each the same or with just that tiny difference with other trials.
In general I do not delete many things, I set aside or isolate.
I used to Alt-Select, read the layer property and lookup the layer in question to activate it.
This can be complicated by being created in a foreign language.
When all sub levels are expanded it may even turn out that it was already active.
If I have to expand parent levels I also activate them, any original focus is lost.
All not really a problem until I decide to undo my last drawing action.
Now I do Alt-Select and YJ.
Bonus: It only adds 2 steps to undo.
Why the multi selection and disregarding the current.
I use it to continue drawing on the common 'other layer' than what is now the current.
The layer property will then show '*VARIES*' and one can not expand that field for more info or select any without actually moving them.
Depending on a proper selection I can now even toggle back and forth.
I also use the tool to display all the parent structure of the (sub-)layer that I left visible when I reload a drawing.
Regards,
CVH