Create and rotate coordinate system
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 864
✭✭✭✭
How can I create and rotate a coordinate system in Mechanical through scripting?
Tagged:
0
Answers
-
Setting the value of the rotation is not straightforward. Below is an example:
testCS = ExtAPI.DataModel.Project.Model.CoordinateSystems.AddCoordinateSystem() testCS.CoordinateSystemType = CoordinateSystemTypeEnum.Cylindrical testCS.OriginX = Quantity(0,"m") testCS.OriginY = Quantity(0,"m") testCS.OriginZ = Quantity(0,"m") testCS.PrimaryAxisDefineBy = CoordinateSystemAlignmentType.GlobalZ testCS.AddTransformation(TransformationType.Rotation,CoordinateSystemAxisType.PositiveZAxis) testCS.SetTransformationValue(1,45)
To flip the CS, one can use:
test.AddTransformation(TransformationType.Flip,CoordinateSystemAxisType.NegativeXAxis) testCS.SetTransformationValue(1,4)
where the second value ranges from 1 to 6 and accounts for +X, +Y, +Z, -X, -Y, -Z respectively.
0