Notifications
Clear all
[Closed] Can't find open group head to close
Oct 29, 2016 10:17 am
I got this annoying error “Can’t find open group head to close” when I want to create assembly. I guess this happen when I change parent of any group member to another object. How we can fix this?
3 Replies
Oct 29, 2016 10:17 am
Now, I realized why this happen. When we link last member of an open group to another object, grouphead dummy will be remain in the scene:
(
fn CreateGroup Objs Name:"GroupHead" SetOpen:false =
(
BeforeGroup = Objects as array
group Objs name:Name
local Head = undefined
for o in Objects where finditem BeforeGroup o == 0 while Head == undefined do Head = o
if isvalidnode Head and SetOpen == true do setGroupOpen Head true
Head
)
delete objects
Obj = sphere()
GroupHead = CreateGroup #(Obj) SetOpen:true
ParentObj = box pos:[100,0,0]
Obj.parent = ParentObj
clearlistener()
assemblyMgr.canassemble objects
)
Oct 29, 2016 10:17 am
This function works but I don’t know why I have to run it multiple times to make it work.
(
fn IsHead Obj =
(
isgrouphead Obj or isopengrouphead Obj
)
fn IsMember Obj =
(
isgroupmember Obj or isopengroupmember Obj
)
fn ClearUnusedGroups =
(
for o in objects where IsMember o and not IsHead (P = o.parent) do
(
detachNodesFromGroup o
o.parent = P
)
for o in objects where IsHead o and o.children.count == 0 do explodegroup o
)
for i = 1 to 4 do ClearUnusedGroups()
clearlistener()
assemblyMgr.canassemble objects
)
Oct 29, 2016 10:17 am
if you read this thread till the end, you get the solution for sure
http://forums.cgsociety.org/showthread.php?f=98&t=1224794&page=1&pp=15