Hi
I am using TexGen to create unit cell weaves for my 3rd year project. I am creating a python script for layered weaves and exporting these to test the macro structural properties.
I am having some problems with the rotate function Rotate (WXYZ (), XYZ ()). I believe the second part is the point at which the rotation occurs but what is the first bit?
I would appreciate some help on this. I am new to TexGen and coding in general
Chris
Rotation of a yarn
Moderators: Martin, Developers
Re: Rotation of a yarn
Hi Chris,
The WXYZ is a quaternion ( see here: http://en.wikipedia.org/wiki/Quaternion ... l_rotation )
The documentation for creating a quaternion from either a normalised axis and angle, a new coordinate system or euler angles is here: http://texgen.sourceforge.net/api/struc ... x_y_z.html. You need to decide how best to specify your rotation, create your quaternion from this and then use it in the Rotate function.
Hope that helps,
Louise
The WXYZ is a quaternion ( see here: http://en.wikipedia.org/wiki/Quaternion ... l_rotation )
The documentation for creating a quaternion from either a normalised axis and angle, a new coordinate system or euler angles is here: http://texgen.sourceforge.net/api/struc ... x_y_z.html. You need to decide how best to specify your rotation, create your quaternion from this and then use it in the Rotate function.
Hope that helps,
Louise
Re: Rotation of a yarn
Louise
Thank you for your help but it would seem I still have a problem
This is the code I wrote however it produces an error
Yarn.Rotate(WXYZ(XYZ, double Angle), XYZ(1,0,0.225))
^
SyntaxError: invalid syntax
Apologies for bugging you
Thank you for your help but it would seem I still have a problem
Code: Select all
Angle=math.radians(12)
Yarn = CYarn(Textile.GetYarn(0))
Yarn.Rotate(WXYZ(XYZ, double Angle), XYZ(1,0,0.225))
Yarn.Translate(XYZ(0, 0, 0.3))
Textile.AddYarn(Yarn)File \2d weave.py", line 13
Yarn.Rotate(WXYZ(XYZ, double Angle), XYZ(1,0,0.225))
^
SyntaxError: invalid syntax
with the triangle under Angle
Apologies for bugging you
Re: Rotation of a yarn
Hi Chris,
You need to take the double out of the Rotate call. You also need to define the XYZ either in the same way as you've done the second one in the call or by defining an XYZ variable and using that.
Louise
You need to take the double out of the Rotate call. You also need to define the XYZ either in the same way as you've done the second one in the call or by defining an XYZ variable and using that.
Louise