Adding nonlinear bushing joints via Mechanical scripting
I would like to create nonlinear bushing joints with Mechanical scripting. When I turn on recording, I can see the commands to insert a joint, set the type and scoping, but it does not show the command to run the stiffness entries to tabular in Mechanical so nonlinear coefficients can be entered.
I understand that nonlinear stiffness behavior can be activated via APDL command snippet, which can be added via scripting. This worked for me in the past for a revolute joint, where I was able to insert a revolute joint with default 0 stiffness, then overwrite its stiffness behavior via APDL snippet. The issue with bushing joint is that Mechanical writes out a "TB,JOIN,_jid,,,STIFF" line to the input file by default when the bushing joint object is inserted (this is not the case for a revolute joint). Since the STIFF keyword cannot co-exist with the JNS keywords needed for nonlinear stiffness coefficients, I cannot overwrite it via APDL snippet either.
Any suggestions and comments are welcome!
Answers
-
Hello,
I think something in this like should work. However, please be aware that InternalObject is "not officially supported", so you may encounter some unexpected behavior.
joints = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Joint) bush=joints[0] bush.InternalObject.ActiveNonlinearCell(0,0) #First Cell, Next Cells (1,1),(2,2) bush.InternalObject.JointNonlinearCell("_EnggData_Table",1,1) paneTabular = ExtAPI.UserInterface.GetPane(MechanicalPanelEnum.TabularData) control = paneTabular.ControlUnknown #Displacements cell = control.cell(2,2) control.TriggerBeforeEdit(cell) cell.Text = str(1) #Cell Value cell.Refresh() control.TriggerAfterEdit(cell) control.InsertRow cell = control.cell(3,2) control.TriggerBeforeEdit(cell) cell.Text = str(2) #Cell Value cell.Refresh() control.TriggerAfterEdit(cell) #Forces cell = control.cell(2,3) control.TriggerBeforeEdit(cell) cell.Text = str(10) #Cell Value cell.Refresh() control.TriggerAfterEdit(cell) control.InsertRow cell = control.cell(3,2) control.TriggerBeforeEdit(cell) cell.Text = str(20) #Cell Value cell.Refresh() control.TriggerAfterEdit(cell)
0