[Closed] [Array] Select by mat problem
Hi there!
Maybe someone around knows, what this type of error means, after executing this script
disableSceneRedraw()
--> initialize the array, the objects without texture are moved into
mymtlobjArray = #()
--select $*
--> filter all objects that have no material assigned
mymtlobjArray = for obj in geometry where obj.material == undefined collect obj
--> filter all objects with an "Architectural" material applied
appendmyobj = for obj in geometry where ClassOf obj.material == Architectural collect obj
--> extend the object array by the objects with the arch-mat
append mymtlobjArray appendmyobj
enableSceneRedraw()
--> select all objects without a material, based on the content of the filter array
select mymtlobjArray
OK
#()
#($Box:Box02 @ [-62.240959,20.287041,0.000000], $Box:Box04 @ [-43.562508,64.090004,0.000000], $Box:Box06 @ [-50.397369,-4.926552,0.000000], $Box:Box08 @ [-77.898979,-9.254555,0.000000], $Box:Box10 @ [-21.882240,27.967003,0.000000], $Box:Box12 @ [-8.495033,-19.857262,0.000000], $Box:Box21 @ [77.100807,-36.565620,0.000000], $Box:Box23 @ [77.143135,25.526955,0.000000], $Box:Box24 @ [67.666718,47.461906,0.000000])
#($Editable_Mesh:Layer:A_F_Fassade_1 @ [452.737579,-194.608612,6.574999])
#($Box:Box02 @ [-62.240959,20.287041,0.000000], $Box:Box04 @ [-43.562508,64.090004,0.000000], $Box:Box06 @ [-50.397369,-4.926552,0.000000], $Box:Box08 @ [-77.898979,-9.254555,0.000000], $Box:Box10 @ [-21.882240,27.967003,0.000000], $Box:Box12 @ [-8.495033,-19.857262,0.000000], $Box:Box21 @ [77.100807,-36.565620,0.000000], $Box:Box23 @ [77.143135,25.526955,0.000000], $Box:Box24 @ [67.666718,47.461906,0.000000], #($Editable_Mesh:Layer:A_F_Fassade_1 @ [452.737579,-194.608612,6.574999]))
OK
-- Runtime error: operation requires a collection of nodes, got: #($Editable_Mesh:Layer:A_F_Fassade_1 @ [452.737579,-194.608612,6.574999])
OK
Well, the array appendmyobj is a collection, or not`? :shrug:
First of all, you could shorten that script into something like this:
select (for o in geometry where o.material == undefined or isKindOf o.material Architectural collect o)
and about that error, I think I’ll need to see the scene to understand whats going on.
But try the shorter version, maybe it will work…
Your script works well and is way shorter than my one. I should’ve had this idea also, ‘cos my script does finally the same.
Thank you for your help. I will try this aswell.
–
I found the error, and it’s now working.
..
join mymtlobjArray appendmyobj
..
I’d to use join instead of append :curious:
OK, I’ve got it,
The problem was that you tried to append an array into an array of nodes…
The result would give you something like that:
#(node1, node2, node3, #(node4, node5))
instead of a simple array of nodes like that:
#(node1, node2, node3, node4, node5)
an array has to have all components from the same type.
This is why the other method ‘join’ worked but the append didn’t.