def HandleApplyButton(): # Create a Dictionary to store the user defined tool data dictionary = {} # Find the checked button in radio_button_vertical # And store it in the dictionary # Note that this is somewhat safe since only one radio button can be checked vertical_checked_content = [ x for x in vertical_radio_buttons if x.IsChecked == True ][0].Content dictionary["vertical_checked"] = vertical_checked_content # Find the checked button in radio_button_horizontal # And store it in the dictionary horizontal_checked_content = [ x for x in horizontal_radio_buttons if x.IsChecked == True ][0].Content dictionary["horizontal_checked"] = horizontal_checked_content # Call the Apex API script using apex_sdk.runScriptFunction() # argument 1 = the fully qualified path name of your API script # argument 2 = the name of the function in your API script that will receive the Dictionary # argument 3 = the Dictionary containing the UI data apex_sdk.runScriptFunction( os.path.join(current_file_path, r"radio_button.py"), "radio_button", dictionary)
def MeshPartitions(sender, args): dictionary["MeshSize"] = refineSizeTextBox.Text file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'MeshPartitions.py') apex_sdk.runScriptFunction(file=script_path, function="CreateMeshPartitions", args=dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} dictionary["roundRadius"] = input01.Text apex_sdk.runScriptFunction( os.path.join(current_file_path, r"RoundCornersCODE.py"), "roundSelection", dictionary)
def GoAutoMesh(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) dictionary["RefineDiameter"] = refineDiamInput.Text dictionary["FineMeshSize"] = meshRefinementInput.Text dictionary["CoarseMeshSize"] = meshCoarseInput.Text dictionary["FileList"] = "" dictionary["ExtendBead"] = True if not selectedFiles: ans = MessageBox.Show("Please import trajectories first", "Error") elif refineDiamInput.Text == "": ans = MessageBox.Show("Please specify the refinement diameter first", "Error") elif meshRefinementInput.Text == "": ans = MessageBox.Show("Please specify the refinement mesh size first", "Error") elif meshCoarseInput.Text == "": ans = MessageBox.Show("Please specify the coarse mesh size first", "Error") else: for elem in selectedFiles: dictionary["FileList"] += elem dictionary["FileList"] += ',' apex_sdk.runScriptFunction(file=os.path.join(file_path, 'Automesh.py'), function="ArcWeldAutomesh", args=dictionary)
def HandleApplyButton(): # Create a Dictionary to store the user defined tool data dictionary = {} choices = materialComboBox.SelectedValue.ToString().split(":") material = choices[len(choices) - 1].lstrip().rstrip() choices = fastenerTypeComboBox.SelectedValue.ToString().split(":") fastenerType = choices[len(choices) - 1].lstrip().rstrip() choices = distributionTypeComboBox.SelectedValue.ToString().split(":") distributionType = choices[len(choices) - 1].lstrip().rstrip() dictionary["attachWasher"] = attachWasherToggle.IsChecked dictionary["washerFactor"] = washerFactorTextBox.Text dictionary["name"] = nameTextBox.Text dictionary["material"] = material dictionary["fastenerType"] = fastenerType dictionary["distributionType"] = distributionType dictionary["tolerance"] = toleranceTextBox.Text dictionary["maxDiameter"] = maxDiameterTextBox.Text file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'auCreateFasteners_Hole2Hole_3a.py') apex_sdk.runScriptFunction(script_path, "main", dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} dictionary["refDiam"] = input01.Text dictionary["extendRegion"] = chkBox01.IsChecked apex_sdk.runScriptFunction( os.path.join(current_file_path, r"PickEdgeRefinementCODE.py"), "createRefRegion", dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} dictionary["useSolidName"] = chkBox01.IsChecked dictionary["assyName"] = input01.Text apex_sdk.runScriptFunction( os.path.join(current_file_path, r"GroupSelection.py"), "createAssy", dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} # Populate the Dictionary with the user defined tool data you need dictionary["newAssy"] = check01.IsChecked dictionary["searchDistance"] = input01.Text apex_sdk.runScriptFunction(os.path.join(current_file_path, r"FilterTouching.py"), "filterFixture", dictionary)
def BuildJoint(sender, args): dictionary["JointWidth"]= globalWidthInput.Text dictionary["JointLength"]= globalLengthInput.Text dictionary["Thick01"]= thick01Input.Text dictionary["Thick02"]= thick02Input.Text dictionary["MeshForMe"] = chkMesh.IsChecked file_path = os.path.dirname(os.path.realpath(__file__)) script_path= os.path.join(file_path, 'JointCreator_Code.py') apex_sdk.runScriptFunction(file=script_path, function="buildEdgeJoint", args=dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} # Populate the Dictionary with the user defined tool data you need dictionary["MaxNumOfPoints"] = input01.Text apex_sdk.runScriptFunction( os.path.join(current_file_path, r"FixtureDesignCODE.py"), "StiffnessOptimizer", dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} # Populate the Dictionary with the user defined tool data you need dictionary["layerHeight"] = layerHeight.Text dictionary["splitBody"] = chkSplit.IsChecked apex_sdk.runScriptFunction( os.path.join(current_file_path, r"SlicerCODE.py"), "verticalSlicing", dictionary)
def HandleCreateSpots(sender, args): dictionary["RefineDiameter"] = refineSizeTextBox.Text dictionary["FileList"] = "" for elem in selectedFiles: dictionary["FileList"] += elem dictionary["FileList"] += ',' file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'SpotWeld.py') apex_sdk.runScriptFunction(script_path, "CreateSpots", dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} # Populate the Dictionary with the user defined tool data you need dictionary["distance"] = input01.Text dictionary["splitSolids"] = chk01.IsChecked dictionary["splitSurfaces"] = chk02.IsChecked dictionary["suppressVertices"] = chk03.IsChecked apex_sdk.runScriptFunction( os.path.join(current_file_path, r"ExpandSplit.py"), "ExpandSplit", dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} #dictionary["refDiam"] = input01.Text if dialog.ShowDialog(): dictionary["saveToDir"] = str(dialog.SelectedPath) else: dictionary["saveToDir"] = "" dictionary["getNormalDirection"] = chkBox01.IsChecked apex_sdk.runScriptFunction( os.path.join(current_file_path, r"GetTrajectory.py"), "extractTrajectory", dictionary)
def BuildJoint(sender, args): dictionary["HorizWidth"] = horizWidthInput.Text dictionary["HorizLength"] = horizLengthInput.Text dictionary["HorizThick"] = horizThickInput.Text dictionary["VertHeight"] = horizWidthInput.Text dictionary["VertLength"] = horizLengthInput.Text dictionary["VertThick"] = vertThickInput.Text dictionary["MeshForMe"] = chkMesh.IsChecked file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'JointCreator_Code.py') apex_sdk.runScriptFunction(file=script_path, function="buildTJoint", args=dictionary)
def BuildJoint(sender, args): dictionary["HorizWidth"] = horizWidthInput.Text dictionary["HorizLength"] = horizLengthInput.Text dictionary["HorizThick"] = horizThickInput.Text dictionary["VertHeight"] = horizWidthInput.Text dictionary["VertLength"] = horizLengthInput.Text dictionary["VertThick"] = vertThickInput.Text dictionary["MeshForMe"] = chkMesh.IsChecked dictionary["SpotSize"] = spotSize.Text dictionary["OverlapLength"] = sheetOverlap.Text file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'RSWCode.py') apex_sdk.runScriptFunction(file=script_path, function="buildLapShear", args=dictionary)
def BuildJoint(sender, args): horizontal_checked_content = [ x for x in horizontal_radio_buttons if x.IsChecked == True ][0].Content dictionary["Meshing"] = horizontal_checked_content dictionary["Thick01"] = horizThickInput.Text dictionary["Thick02"] = vertThickInput.Text dictionary["SpotSize"] = spotSize.Text dictionary["GapSize"] = gapInput.Text dictionary["CreateGrippers"] = chkCreateGrippers.IsChecked file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'AWSRSWCode.py') apex_sdk.runScriptFunction(file=script_path, function="buildLapShear", args=dictionary)
def CreateBeads(sender, args): dictionary["BeadLeg"] = refineSizeTextBox.Text dictionary["unitType"] = unitType.Text if extendBead.IsChecked == True: dictionary["ExtendBead"] = True else: dictionary["ExtendBead"] = False dictionary["FileList"] = "" for elem in selectedFiles: dictionary["FileList"] += elem dictionary["FileList"] += ',' file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'CreateBeads.py') apex_sdk.runScriptFunction(file=script_path, function="BeadBySweep", args=dictionary)
def ExportBDFData(sender, args): # Create a File open dialog dialog = FolderBrowserDialog() dialog.Title = "Select directory to save the BDF files" # Display the dialog # If it returns anything # get the file name global projectPath if dialog.ShowDialog(): projectPath = dialog.SelectedPath file_path = os.path.dirname(os.path.realpath(__file__)) dictionary["DirPath"] = projectPath script_path = os.path.join(file_path, 'ExportBDF.py') apex_sdk.runScriptFunction(file=script_path, function="ExportBDF", args=dictionary)
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} # Populate the Dictionary with the user defined tool data you need dictionary["distanceLine"] = distanceLine.Text dictionary["angleType"] = angleTypeSelection.Text dictionary["angleValue"] = angleValue.Text dictionary["pointSpacing"] = pointSpacingValue.Text dictionary["meshIt"] = meshCheck.IsChecked if str(dialog.SelectedPath): dictionary["saveToDir"] = str(dialog.SelectedPath) else: dictionary["saveToDir"] = "" apex_sdk.runScriptFunction( os.path.join(current_file_path, r"SlicerCODE.py"), "hatchingLayers", dictionary)
def getCustomToolPropertyContent(): my_Grid = WPFControls.Grid() nRows = 8 nCols = 2 createLayout(my_Grid, nRows, nCols) iRow = iCol = 0 global nameTextBox nameTextBox = createDataBox(my_Grid, "Name: ", "", iRow, iCol) iRow += 1 global fastenerTypeComboBox fastenerTypeComboBox = createComboBox2(my_Grid, "Fastener Type:", ["Flexible", "Bushing", "Rigid"], 0, iRow, iCol) iRow += 1 global distributionTypeComboBox distributionTypeComboBox = createComboBox2(my_Grid, "Distribution:", ["Compliant", "Rigid"], 0, iRow, iCol) iRow += 1 global materialComboBox global matlComboTextBox matlComboTextBlock = createTextBlock(my_Grid, "Material:", iRow, 0) materialComboBox = createComboBox(my_Grid, iRow, 1) iRow += 1 file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'auGetMaterials.py') apex_sdk.runScriptFunction(script_path, "main", callback=getMatls) global toleranceTextBox toleranceTextBox = createDataBox(my_Grid, "Tolerance:", "0.1", iRow, iCol) iRow += 1 global maxDiameterTextBox maxDiameterTextBox = createDataBox(my_Grid, "Max Diameter:", "0.75", iRow, iCol) iRow += 1 global attachWasherToggle, washerFactorTextBlock, washerFactorTextBox attachWasherToggle = createCheckBox(my_Grid, "Attach Shell Mesh Washer", iRow, 0) iRow += 1 attachWasherToggle.Checked += attachWasherHandleCheck attachWasherToggle.Unchecked += attachWasherHandleUnCheck washerFactorTextBlock = createTextBlock(my_Grid, "Washer Factor (>1.0):", iRow, 0) washerFactorTextBox = createTextBox(my_Grid, "1.2", iRow, 1) iRow += 1 washerFactorTextBlock.Visibility = System.Windows.Visibility.Collapsed washerFactorTextBox.Visibility = System.Windows.Visibility.Collapsed return my_Grid
def HandleApplyButton(sender, args): # Create a Dictionary to store the user defined tool data dictionary = {} apex_sdk.runScriptFunction(os.path.join(current_file_path, r"SequenceOptim.py"), "GenerateStudies", dictionary)
def HandlecleanBtn(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'Midsurface.py') apex_sdk.runScriptFunction(file=script_path, function="Midsurface", args=dictionary)
def HandlecleanBtn(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'GetSelectionType.py') apex_sdk.runScriptFunction(file=script_path, function="ShowType")
def HandlecleanBtn(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'CreateRefPlanes.py') apex_sdk.runScriptFunction(file=script_path, function="CreatePlanes", args=dictionary)
def HandlecleanBtn(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'SplitByTrajectories.py') apex_sdk.runScriptFunction(file=script_path, function="SplitByTrajectories", args=dictionary)
def UpdateDataGridData(): apex_sdk.runScriptFunction(os.path.join(current_file_path, r"ElementCount.py"), "prepare_data_grid", callback=UpdateDataGridView)
def HandlecleanBtn(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'RemoveEmpty.py') apex_sdk.runScriptFunction(file=script_path, function="RemoveEmpty", args=dictionary)
def GetSelectionInfo(*args, **kwargs): apex_sdk.runScriptFunction(os.path.join(current_file_path, r"ElementCount.py"), "calcSelected", callback=UpdateDataGridView)
def HandleShowWithoutMesh(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.join(file_path, 'FilterMeshed.py') apex_sdk.runScriptFunction(file=script_path, function="ShowNoMeshed", args=dictionary)