[Closed] Is there a script for rotating 90 degree for groups?
I tried this code
rotate $ (angleaxis 90 [0,0,1])
It’s work for 1 object but it cause problem for group of objects.
Any idea to fix that?
The objects inherit the group header transforms and this way the rotation is multiplied.
If this is what you mean then s’d call rotate() only on the group header.
for i in $ where isGroupHead i and i.parent == undefined or not i.parent.isSelected do rotate i 90 z_axis
Thanks for answering, but It doesn’t work
a red line show as this
[color=Red]– Unknown property: “isSelected” in undefined[/color]
I just select a group, and write this code you told me about.
Yes, unpolished code. I just experiment to make the code short and complex at the same time, i.e. to work even if the group head is linked as child. So try this one:
gh = for i in $ where isGroupHead i do
(
if i.parent == undefined then i
else (if not i.parent.isSelected then i else undefined)
)
if gh != undefined do rotate gh 90 z_axis
I’m sorry but didn’t you try it before sending it to me?
This time a blue text written “[color=MediumTurquoise]undefined[/color]” and nothing happen!
we never do
how about this:
for i in selection where (isGroupHead i and not isGroupMember i) or not isGroupMember i do rotate i 90 z_axis
YESSSSSS!!
I almost jumped of my chair when i tried it and it works!
I'm really want to thank you from heart.
I want to ask you, if i want to start learning script, how? and where?
I need some video tutorials if you know some link please guide me.
Thank you again.
No, am not at home, so not tested and presume there is some logic mess.
My attempt here is to make the code working even if the group is linked (part of other hierarchy).
Else without that complication, next CODE also should work:
for i in $ where isGroupHead i and i.parent == undefined do rotate i 90 z_axis
Here is another, also not tested code:
for i in $ where isGroupHead i do
(
gh = if i.parent == undefined then i
else (if not i.parent.isSelected then i else undefined)
if gh != undefined do rotate gh 90 z_axis
)
Marc code looks cool.
Did it will work if the group is linked (has parent)?
@ Waseem – OK, now I test each code here.
The 2nd code has logical mistake but all the rest (including 1st one) works, and to be more correct – by ‘works’ mean – in some cases, not in all, but what so? – that’s true for each peace of code. And while you NOT say what exactly you need, this was “shot-in-the-dark” game playing.
So, finally, you get a lot more than you need, and don’t worry, I don’t ask for your thanksgiving. I not played such games for a 1st times and know how they end from the very beginning.
@ me (reminder note to myself):
Most people stay away from this game, why then I still do that?..