Select a filter that only partially selects on a specific layer

Select a filter that only partially selects on a specific layer

anycganycgJ8A6A
Advocate Advocate
1,666 Views
9 Replies
Message 1 of 10

Select a filter that only partially selects on a specific layer

anycganycgJ8A6A
Advocate
Advocate

Good morning
I am going to ask today despite my curiosity.
I want you to look good.

 

 

like CAD


i would like to Select a filter that only partially object selects on a specific layer
It's possible to script as a CAD without using the select by name interface
I looked for the manual but I can not find it.
I do not know how to select only some objects on that layer

pls can you help me again ~

0 Likes
Accepted solutions (2)
1,667 Views
9 Replies
Replies (9)
Message 2 of 10

denisT.MaxDoctor
Advisor
Advisor
fn selectByLayer layer: =
(
fn layerFilter node layer:layer =
(
node.layer == layer
)
selectByName title:"Pick Nodes" buttonText:"Pick" filter:layerFilter
)
-- selectByLayer layer:(layermanager.getlayer 1)

fn selectByLayerName name: =
(
fn layerFilter node name:name =
(
stricmp node.layer.name name == 0
)
selectByName title:"Pick Nodes" buttonText:"Pick" filter:layerFilter
)
-- selectByLayerName name:#0

of course you can combine several filters ...

Message 3 of 10

anycganycgJ8A6A
Advocate
Advocate

Good source too thank you too ~~~~~
But the problem is that there are thousands of objects
There's a problem with choosing what I want.
So, without the select by interface
I want to select it in the viewport

For example

There are multiple layers.
I want to work with the layer name "ddd"
The remaining layers are freeze
Then I can select the "ddd" layered objects in the viewport
However,
  It is a problem to unfreeze the remaining layers after selecting

 

is that possible ~~?

0 Likes
Message 4 of 10

denisT.MaxDoctor
Advisor
Advisor

are you talking about a permanent filter which once set allows select nodes in viewport just from specified layer?

or you need a function that goes into specified filter selection mode?

Message 5 of 10

anycganycgJ8A6A
Advocate
Advocate

Thank you for your reply though it's busy.
I want code.
My lack of English expressions would make you feel uncomfortable.
Please understand it

0 Likes
Message 6 of 10

denisT.MaxDoctor
Advisor
Advisor

unfortunately without c++ sdk you can't write Select Filter that might be used in Selection Filters list in main toolbar.

 

 

Message 7 of 10

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

try this little tool. it might for you or at least give an idea how it might be organized:

try(destroydialog SelectInActiveLayer) catch()
rollout SelectInActiveLayer "Select In Active Layer" width:200
(
	fn layerFilter = 
	(
		--format "selection changed...\n"
		
		desel = for node in selection as array where node.layer != LayerManager.current collect node
		if desel.count > 0 do undo off
		(
			disablerefmsgs()
			deselect desel
			enablerefmsgs()
		)
	)
	
	checkbutton activate_bt "Activate" width:182 align:#right offset:[4,0]
	on activate_bt changed state do undo off
	(
		if state then
		(
			callbacks.removescripts id:#layer_filter
			callbacks.addscript #selectionSetChanged "::SelectInActiveLayer.layerFilter()" id:#layer_filter
			layerFilter()
		)
		else 
		(
			callbacks.removescripts id:#layer_filter
		)
	)
	on SelectInActiveLayer close do callbacks.removescripts id:#layer_filter
)
createdialog SelectInActiveLayer

 in activated mode it has to allow node selecting in the active (current) layer only

Message 8 of 10

anycganycgJ8A6A
Advocate
Advocate

wow
This is what I want.
Thank you very much
Unfortunately, it's often down
I'm afraid I'll be a lot worried about big projects

0 Likes
Message 9 of 10

denisT.MaxDoctor
Advisor
Advisor
Accepted solution
try(destroydialog SelectInActiveLayer) catch()
rollout SelectInActiveLayer "Select In Active Layer" width:200
(
	fn layerFilter = 
	(
		--format "selection changed...\n"
		
		desel = for node in selection as array where node.layer != LayerManager.current collect node
		if desel.count > 0 do undo off
		(
			callbacks.removescripts id:#layer_filter
			deselect desel
			callbacks.addscript #selectionSetChanged "::SelectInActiveLayer.layerFilter()" id:#layer_filter
		)
	)
	
	checkbutton activate_bt "Activate" width:182 align:#right offset:[4,0]
	on activate_bt changed state do undo off
	(
		if state then
		(
			callbacks.removescripts id:#layer_filter
			callbacks.addscript #selectionSetChanged "::SelectInActiveLayer.layerFilter()" id:#layer_filter
			layerFilter()
		)
		else 
		(
			callbacks.removescripts id:#layer_filter
		)
	)
	on SelectInActiveLayer close do callbacks.removescripts id:#layer_filter
)
createdialog SelectInActiveLayer

take this version. it might be more stable.

 

if any answer to your questions solves your problem please don't forget to tag it as "SOLVED". It helps other people to search and find solutions for the same or similar problems 

Message 10 of 10

anycganycgJ8A6A
Advocate
Advocate

wow
I had no idea what this would be.
wow
It's really great of you
You are not a max doctor
From now on you are max god
I really appreciate it once again.

0 Likes