Exemple #1
0
def DirectoryOpenDialog(initialDirectory=None):
    dlg = FolderBrowserDialog()
    dlg.ShowNewFolderButton = True
    if initialDirectory:
        dlg.SelectedPath = initialDirectory #Path.GetFileName(initialFile)
    if dlg.ShowDialog() != DialogResult.Cancel:
        return dlg.SelectedPath 
Exemple #2
0
def get_output_directory():
    folder_dialog = FolderBrowserDialog()
    folder_dialog.ShowNewFolderButton = True
    folder_dialog.Description = 'Output directory for R scripts'
    if folder_dialog.ShowDialog() != DialogResult.OK:
        return None
    return folder_dialog.SelectedPath
Exemple #3
0
def getCustomToolPropertyContent():
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    currRow = 0

    # -- Horizontal sheet definition
    IDLbl = WPFControls.TextBlock()
    IDLbl.Text = "Hatching definition"
    WPFControls.Grid.SetRow(IDLbl, currRow)
    IDLbl.FontSize = 11

    # Create label and input field
    currRow += 1
    layerLbl = WPFControls.TextBlock()
    layerLbl.Text = "   Trajec. spacing (mm): "
    WPFControls.Grid.SetRow(layerLbl, currRow)
    WPFControls.Grid.SetColumn(layerLbl, 0)

    global distanceLine
    distanceLine = WPFControls.TextBox()
    WPFControls.Grid.SetRow(distanceLine, currRow)
    WPFControls.Grid.SetColumn(distanceLine, 1)

    # Create label and input field
    currRow += 1
    pointSpacing = WPFControls.TextBlock()
    pointSpacing.Text = "   Point spacing (mm):"
    WPFControls.Grid.SetRow(pointSpacing, currRow)
    WPFControls.Grid.SetColumn(pointSpacing, 0)

    global pointSpacingValue
    pointSpacingValue = WPFControls.TextBox()
    WPFControls.Grid.SetRow(pointSpacingValue, currRow)
    WPFControls.Grid.SetColumn(pointSpacingValue, 1)

    # Type of angular cut
    currRow += 1
    angleCutType = WPFControls.TextBlock()
    angleCutType.Text = "   Angular cut:"
    WPFControls.Grid.SetRow(angleCutType, currRow)
    WPFControls.Grid.SetColumn(angleCutType, 0)

    # Create a Combo box
    global angleTypeSelection
    angleTypeSelection = WPFControls.ComboBox()

    item1 = WPFControls.ComboBoxItem()
    item1.Content = "Single angle"
    angleTypeSelection.Items.Add(item1)

    item2 = WPFControls.ComboBoxItem()
    item2.Content = "Incremental"
    angleTypeSelection.Items.Add(item2)

    item3 = WPFControls.ComboBoxItem()
    item3.Content = "Cycle through"
    angleTypeSelection.Items.Add(item3)

    angleTypeSelection.SelectedIndex = "0"
    WPFControls.Grid.SetRow(angleTypeSelection, currRow)
    WPFControls.Grid.SetColumn(angleTypeSelection, 1)
    #angleTypeSelection.SelectionChanged += HandleAngleSelection

    # Create label and input field
    currRow += 1
    global angleLbl
    angleLbl = WPFControls.TextBlock()
    angleLbl.Text = "   Angle (deg):"
    WPFControls.Grid.SetRow(angleLbl, currRow)
    WPFControls.Grid.SetColumn(angleLbl, 0)

    global angleValue
    angleValue = WPFControls.TextBox()
    WPFControls.Grid.SetRow(angleValue, currRow)
    WPFControls.Grid.SetColumn(angleValue, 1)

    # Create checkbox to ask for mesh
    currRow += 1
    global meshCheck
    meshCheck = WPFControls.CheckBox()
    meshCheck.Content = "Mesh the layers for me"
    meshCheck.Height = 25
    WPFControls.Grid.SetRow(meshCheck, currRow)
    WPFControls.Grid.SetColumn(meshCheck, 0)
    WPFControls.Grid.SetColumnSpan(meshCheck, 3)

    # Create a button
    currRow += 1
    getDirectory = WPFControls.Button()
    getDirectory.Content = "Select directory to save"
    WPFControls.Grid.SetRow(getDirectory, currRow)
    WPFControls.Grid.SetColumn(getDirectory, 0)
    getDirectory.Height = 30
    WPFControls.Grid.SetColumnSpan(getDirectory, 3)
    getDirectory.Click += HandleGetDir

    global dialog
    dialog = FolderBrowserDialog()
    dialog.Description = "Choose where to save trajectories"
    dialog.ShowNewFolderButton = True

    # Create a button
    currRow += 1
    goSlice = WPFControls.Button()
    goSlice.Content = "Create hatching"
    WPFControls.Grid.SetRow(goSlice, currRow)
    WPFControls.Grid.SetColumn(goSlice, 0)
    goSlice.Height = 30
    WPFControls.Grid.SetColumnSpan(goSlice, 3)

    # Link a function to the Button "Click" event
    # This function will be called every time the Button is clicked
    goSlice.Click += HandleApplyButton

    # Add the controls to the Grid
    my_Grid.Children.Add(IDLbl)
    my_Grid.Children.Add(layerLbl)
    my_Grid.Children.Add(distanceLine)
    my_Grid.Children.Add(pointSpacing)
    my_Grid.Children.Add(pointSpacingValue)

    my_Grid.Children.Add(angleCutType)
    my_Grid.Children.Add(angleTypeSelection)
    my_Grid.Children.Add(angleLbl)
    my_Grid.Children.Add(angleValue)

    my_Grid.Children.Add(getDirectory)

    my_Grid.Children.Add(meshCheck)
    my_Grid.Children.Add(goSlice)

    # Return the Grid
    return my_Grid
Exemple #4
0
def getCustomToolPropertyContent():
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    #my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    currRow = 0

    # Create input field
    currRow += 1
    lbl01 = WPFControls.TextBlock()
    lbl01.Text = "Region diam. (mm):"
    WPFControls.Grid.SetRow(lbl01, currRow)
    WPFControls.Grid.SetColumn(lbl01, 0)

    global input01
    input01 = WPFControls.TextBox()
    WPFControls.Grid.SetRow(input01, currRow)
    WPFControls.Grid.SetColumn(input01, 1)

    # Create checkbox to extend the weld bead
    currRow += 1
    global chkBox01
    chkBox01 = WPFControls.CheckBox()
    chkBox01.Content = "Calculate normal directions"
    chkBox01.Height = 20
    WPFControls.Grid.SetRow(chkBox01, currRow)
    WPFControls.Grid.SetColumn(chkBox01, 0)
    chkBox01.IsChecked = System.Nullable[System.Boolean](True)
    #WPFControls.Grid.SetColumnSpan(chkBox01, 2)

    # Create a button
    currRow += 2
    goButton = WPFControls.Button()
    goButton.Content = "Get trajectory from selected edge"
    WPFControls.Grid.SetRow(goButton, currRow)
    WPFControls.Grid.SetColumn(goButton, 0)
    goButton.Height = 30
    WPFControls.Grid.SetColumnSpan(goButton, 2)

    # Link a function to the Button "Click" event
    # This function will be called every time the Button is clicked
    goButton.Click += HandleApplyButton

    global dialog
    dialog = FolderBrowserDialog()
    dialog.Description = "Directory where to save trajectories"
    dialog.ShowNewFolderButton = True

    #my_Grid.Children.Add(lbl01)
    #my_Grid.Children.Add(input01)
    my_Grid.Children.Add(chkBox01)

    my_Grid.Children.Add(goButton)

    # Return the Grid
    return my_Grid