In WB Mechanical scripting, how can I change the transformation angles of an external data file?
Landon Mitchell Kanner
Member, Employee, GitHub-issue-creator Posts: 319
✭✭✭✭
in Structures
Here is my project page schematic:
I want to change the Rigid Transformation angles:
From the Mechanical model where it is use:
Tagged:
0
Answers
-
import System from System.Threading import * def RunWBJN(cmds): def Internal_RunWBJN(): import wbjn wbjn.ExecuteCommand(ExtAPI,cmds) thread = System.Threading.Thread(System.Threading.ThreadStart(Internal_RunWBJN)) thread.Start() def SetImportedLoadRotations(ImportedLoadGroup,XY,YZ,ZX): coord = ImportedLoadGroup.Source.Split(':')[0] WBcmds = ''' coord = "$coord" import clr clr.AddReference("Ans.UI") import Ansys.UI view1 = Ansys.UI.UIManager.Instance.GetActiveWorkspace().GetView(Ansys.ProjectSchematic.View.ProjectSchematicView.ViewName) coord_map = dict(view1.CoordinateMap) coord_map2 = {Ansys.UI.IDManager.GetAlphabeticLabelFromCoordinate(coord_map[key]):key for key in coord_map} setup1 = coord_map2[coord] externalLoadData1 = setup1.GetExternalLoadData() externalLoadFileData1 = externalLoadData1.GetExternalLoadFileData(Name="ExternalLoadFileData") externalLoadFileDataProperty1 = externalLoadFileData1.GetDataProperty() externalLoadFileDataProperty1.ThetaXYUnit = '$XY.Unit' externalLoadFileDataProperty1.ThetaYZUnit = '$YZ.Unit' externalLoadFileDataProperty1.ThetaZXUnit = '$ZX.Unit' externalLoadFileDataProperty1.ThetaXY = $XY.Value externalLoadFileDataProperty1.ThetaYZ = $YZ.Value externalLoadFileDataProperty1.ThetaZX = $ZX.Value '''.replace('$coord',coord).replace('$XY.Unit',XY.Unit).replace('$YZ.Unit',YZ.Unit).replace('$ZX.Unit',ZX.Unit).replace('$XY.Value',str(XY.Value)).replace('$YZ.Value',str(YZ.Value)).replace('$ZX.Value',str(ZX.Value))#,YZ.Unit,ZX.Unit,XY.Value,YZ.Value,ZX.Value) print WBcmds RunWBJN(WBcmds) impload = ExtAPI.DataModel.GetObjectsByType(Ansys.ACT.Automation.Mechanical.ImportedLoads.ImportedLoadGroup)[0] XY = Quantity(30,'degree') YZ = Quantity(0.2,'radian') ZX = Quantity(0.3,'radian') SetImportedLoadRotations(impload,XY,YZ,ZX)
0