Hello,
I am trying to set component sizing variables (bounds and step size for Detailed Sizing) and the fastener diameter through a python script.
Setting the sizing variables works fine but I am not able to set the fastener diameter.
I am able to get the fastener diameter by simply running:
def get_fastener(project, component, variable_ID):
# Get the fastener diameter variable.
JointComponent = component.Hole(1)
D_fast = JointComponent.FastenerDiameter*(0.0254)
return D_fast
My code to set the sizing variables and the diameter is as follows:
def set_sizing_variable(project, component, variable_ID, min, max, step_size):
# Given the project, component, and variable ID, set the min thickness, max thickness, and step_size.
# Get the group associated with the component
group = project.Groups.GetGroup(component.GroupId)
# Get the group concept IDs.
concept_IDs = group.GetConcepts()
# For each concept, set the variable (if applicable).
variables = group.Variables
variable = variables.GetVariable(1, 8)
variable.MinBound = min/(0.0254) # Convert to inches
variable.MaxBound = max/(0.0254) # Convert to inches
variable.StepSize = step_size/(0.0254) # Convert to inches
group.Save()
def set_fastener(project, component, variable_ID, D_fast, id):
# Set the fastener diameter variable.
JointComponent = component.Hole(1)
JointComponent.HasHole = True # In fact this is already set to True because I can get the fastener diameter
JointComponent.FastenerDiameter = D_fast/(0.0254)
component.Save()
As stated the set_sizing_variable function works correctly but the set_fastener function does not update the Bolted Joint Analysis.
Is there also a way to set the Head Diameter and Countersunk Depth of the fastener, I cannot find any reference to those in the manual.
Can anybody help me to get this working?
Regards,
Gertjan