Notifications
Clear all

[Closed] How to pick a group object?

?

fn getRootGroupHead node = if isGroupMember node do
1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Why do we need other nodes when you look for GroupHead.
Your first function is better then last one ei. it’s the same. Denis did not surrender

Just a shot in the darkness
Ok. Good night to both of you.

is a group head a group member?

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Yes if is nested

Good night friend

This is my final attempt


   fn getRootGroupHead node = if isgroupMember node do
   (
   	while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent
   	node
   )
   getRootGroupHead $Box001

Another functions


        fn[b] getRootGroupHead[/b] node = if isgroupMember node do
        (
        	while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent
        )
        fn [b]isReallyGeometry[/b] obj = isKindOf obj GeometryClass and canConvertTo obj Editable_Mesh
        fn [b]getGeometryGroupMembers[/b] grp = if isGroupHead grp do
        (
        	local childrens = execute ("$"+grp.name+"...*")
        	for c in childrens where isReallyGeometry c collect c
        )
        rootGroup = getRootGroupHead $Box001
        geoGroupMembers = getGeometryGroupMembers rootGroup
        
4 Replies
(@denist)
Joined: 11 months ago

Posts: 0

i don’t want disappoint you but both getRootGroupHead and getGeometryGroupMembers are not correct in general case.
#1 what if the node is a group head itself?
#2 what if we have more than one node with the same name as a group head?

(@gazybara)
Joined: 11 months ago

Posts: 0

#1>>>

fn getRootGroupHead node = if isValidNode node do
(
	while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent
)

#2>>> Can I use recursive fn?

(@denist)
Joined: 11 months ago

Posts: 0

#1 wrong again
#2 you can use whatever you want but it doesn’t need a recursion. first time on this forum the best method was shown by LO

(@gazybara)
Joined: 11 months ago

Posts: 0

I not have more ideas for #1
Can you show mystery code and “lo” method

Thanks guys for putting efforts in, I am sick today too.
I wake up 2 o’clock this afternoon and wow 6 pages of responses.
Eat my hat.
Thanks
Jack

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Thanks to Denis this thread has been turned into a battlefield.
If you want to learn something really cool and useful U need to jump here and survive.

dont know about it but …try.only


fn SS_findGroupHead node =
(
if node.parent != undefined then
	(
	if isgrouphead node.parent then return node.parent 
	)
SS_findGroupHead node.parent
)
1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

We already tried with recursive function


fn getRootGroupHead node = if isgroupmember node do
(
	while node != undefined and (not isgrouphead node or isgroupmember node) do (node = node.parent)
	node
)
fn getGeometryGroupMembers node = if isgrouphead node do
(
	for node in (join #() node) where iskindof node geometryclass and canconvertto node editable_mesh collect node 
)

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

fuc…I miss that combo.
U are right. It’s to perfect and simple to be true.
Second one… I don’t know what to say…only I can take my hat off.
Thanks Denis for this lesson.

It’s my turn to thank Denis – thank you.

Page 5 / 6