Notifications
Clear all

[Closed] How to pick a group object?

you have to provide two methods – getRootGroupHead and getGeometryGroupMembers
to get this work:


(
	if (node = pickObject()) != undefined do
	(
		if (head = getRootGroupHead node) != undefined do nodes = getGeometryGroupMembers head
		format "head:%
	nodes:%
" head nodes 
	)
)
/*
head:$Dummy:Group003 @ [60.000000,20.000000,12.500000]
	nodes:#($Box:Box001 @ [40.000000,0.000000,0.000000], $Box:Box002 @ [80.000000,0.000000,0.000000], $Box:Box003 @ [40.000000,40.000000,0.000000], $Box:Box004 @ [80.000000,40.000000,0.000000])
*/

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Wow Denis. I never doupted that your solution will not be the best.
First time I see theses two methods getRootGroupHead and getGeometryGroupMembers .
MXS HELP not have explained theses badass methods?

From schematic view

I run this

getGrandParentGroup $Box004
--$Box:Box005 @ [0.000000,0.000000,40.000000]

Why function ignore opened groups?

THESE ARE MY FUNCTIONS!!! ha-ha… you have to write your own. that what i was asking you

do you know how many geometry classes in standard max system are not really geometries?
11 (you check only 1 – TargetObject)

so you need another function to do – isRealGeometry

Now you could have fooled me
I already wrote my but … :). Anyway thanks. This was fun.

do they work correct now?

btw… all three my functions are only one line of code… so they are simple if you know what to do

here is improved test:


delete objects
(
	b0 = box pos:[40,0,0] wirecolor:orange
	b1 = box pos:[80,0,0] wirecolor:orange
	sn = snow()

	g0 = group #(b0,b1,sn)

	b2 = box pos:[40,40,0] wirecolor:green
	b3 = box pos:[80,40,0] wirecolor:green
	mr = mr_Proxy pos:[0,40,0]

	g1 = group #(b2,b3,mr)
	g2 = group #(g0,g1)

	in (box pos:[0,0,40] wirecolor:blue) (g2.parent = box pos:[0,0,80] wirecolor:red)
	for g in #(g0,g1,g2) do setGroupOpen g on
)

Can I use this to find out isRealGeomtry?(I add only two classes for check)


 for o in geometry where canConvertTo o editable_mesh and canConvertTo o editable_poly collect o
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

that’s the right idea… but it’s absolutely enough to check only conversion to editable_mesh
search in geometry is too long… there is a better way

Can you tell me why:
> this works


b0 = box pos:[40,0,0] wirecolor:orange
b1 = box pos:[80,0,0] wirecolor:orange
in (g0 = group #(b0,b1)) (box pos:[0,0,40] wirecolor:blue) 

and this not


b0 = box pos:[40,0,0] wirecolor:orange
b1 = box pos:[80,0,0] wirecolor:orange
in (box pos:[0,0,40] wirecolor:blue) (g0 = group #(b0,b1)) 
4 Replies
(@denist)
Joined: 11 months ago

Posts: 0

there is an eternal bug in group messaging system… it sends some sort of a delayed message… so in the second snippet system doesn’t link group to box because group “is not created” at that time

(@gazybara)
Joined: 11 months ago

Posts: 0

That is useful info. Thanks.
So to return to the isRealGeometry topic.
You told me that is “:“search in geometry is too long… there is a better way
The only way that i know is selection or objects.
Maybe we can select all groups usring helpers
If we named groups correctly then you can use $Group* or $objects/group*

(@denist)
Joined: 11 months ago

Posts: 0

you don’t have to search at all to know that the node is geometryclass…

(@gazybara)
Joined: 11 months ago

Posts: 0

What do you suggest I not uderstand?

Page 2 / 6