Esempio n. 1
0
def create_menu():
    """Create the Formex menu."""
    MenuData = [
        ("&Bbox", [
            ('&Show Bbox Planes', showBbox),
            ('&Remove Bbox Planes', removeBbox),
        ]),
        ("&Transform", [
            ("&Scale Selection", scaleSelection),
            ("&Scale non-uniformly", scale3Selection),
            ("&Translate", translateSelection),
            ("&Center", centerSelection),
            ("&Rotate", rotateSelection),
            ("&Rotate Around", rotateAround),
            ("&Roll Axes", rollAxes),
        ]),
        ("&Clip/Cut", [
            ("&Clip", clipSelection),
            ("&Cut With Plane", cutSelection),
        ]),
        ("&Undo Last Changes", selection.undoChanges),
        ("---", None),
        ("&Concatenate Selection", concatenateSelection),
        ("&Partition Selection", partitionSelection),
        ("&Create Parts", createParts),
        ("&Sectionize Selection", sectionizeSelection),
        ("---", None),
        ("&Fly", fly),
        ("---", None),
        ("&Reload menu", reload_menu),
        ("&Close", close_menu),
    ]
    return menu.Menu(_menu, items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 2
0
def create_menu(before='help'):
    """Create the menu."""
    MenuData = [
        ("&Select drawable", selection.ask),
        ("&Set grid", create_grid),
        ("&Remove grid", remove_grid),
        ("---", None),
        ("&Toggle Preview", toggle_preview, {
            'checkable': True
        }),
        ("---", None),
        (
            "&Create Nurbs Curve ",
            [
                ("Interactive", createInteractive),
                ("From Control Polygon", fromControlPolygon),
                ("Convert PolyLine", fromPolyLine),
                #            ("Convert BezierSpline",fromBezierSpline),
            ]),
        ("---", None),
        ("&Reload Menu", reload_menu),
        ("&Close Menu", close_menu),
        ("Test menu", test_menu),
    ]
    w = menu.Menu(_menu, items=MenuData, parent=pf.GUI.menu, before=before)
    return w
Esempio n. 3
0
def create_menu():
    """Create the DXF menu."""
    MenuData = [
        ("&Read DXF file", importDxf),
        ("&Read DXFTEXT file", importDxfText),
        ("&Convert DXF to DXFTEXT", convertDxf, dict(tooltip="Parse a .dxf file and output a .dxftext script.")),
        ("&Read DXF without saving the DXFTEXT", importDxf),
        ("---", None),
        ("&Write DXF file", exportDxf),
        ("&Write DXFTEXT file", exportDxfText),
         ("---", None),
        ("&Pick DXF selection", pickSelection),
        ("&Convert to Formex", convertToFormex),
        ("&Renumber DXF entities", renumberDxf),
        ("&Edit DXF entities", editParts),
        ("&Split Arcs", splitArcs),
        ("&Split Lines", splitLines),
       #("&Clip by property",clipByProp),
        #("&Partition by connection",partition),
        ("---", None),
        ("&Print DXF selection", printSelection),
        ("&Draw DXF entities", drawDxf),
        ("&Toggle drawing property numbers", toggleProps),
        ("&Toggle drawing property colors", toggleColors),
        ("---", None),
        ("&Close Menu", close_menu),
        ]
    return menu.Menu(_menu, items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 4
0
def create_menu():
    """Create the Jobs menu."""
    MenuData = [
        ("&About", about),
        ("&Configure Job Plugin", configure),
        ("&Run local Abaqus job", runLocalAbaqus),
        ("&Run local Calculix job", runLocalCalculix),
        ("&Submit Abaqus Job", submitToCluster),
        ("&Kill Cluster Job", killClusterJob),
        ("&List available results on server", checkResultsOnServer),
        ("&Get results from server", getResultsFromServer),
        ("&Execute remote command", remoteCommand),
        ("---", None),
        ("&Reload Menu", reload_menu),
        ("&Close Menu", close_menu),
        ]
    return menu.Menu(_menu, items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 5
0
def create_menu():
    """Create the Postproc menu."""
    MenuData = [
        #        ("&Translate Abaqus .fil to FeResult database",P.postABQ),
        ("&Read FeResult Database", importDB),
        ("&Read CalculiX results", importCalculix),
        ("&Read Flavia Database", importFlavia),
        ("&Select FeResult Data", selectDB),
        #        ("&Forget FeResult Data",P.selection.forget),
        ("---", None),
        ("Show Geometry", showModel),
        #        ("Select Step/Inc",P.selectStepInc),
        #        ("Show Results",P.postProc),
        ("Results Dialog", open_dialog),
        ("---", None),
        ("&Reload menu", reload_menu),
        ("&Close menu", close_menu),
    ]
    return menu.Menu(_menu, items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 6
0
def create_menu():
    """Create the %s menu.""" % _menu_
    MenuData = [
        ("&Run through example", example),
        ("---", None),
        ("&1.  Import Bifurcation Geometry", importGeometry),
        ("&2.  Input Central Point", inputCentralPoint),
        ("&3.  Input Helper Lines", inputControlLines),
        ("&4a. Input Slicing Parameters", inputSlicingParameters),
        ("&4b.  Create Center Lines", centerlines),
        ("&5. Slice the bifurcation", sliceIt),
        ("&6.  Create Spline Mesh", splineIt),
        ("&7a. Input Longitudinal Seeds", inputLongitudinalSeeds),
        ("&7b. Seed Longitudinal Splines", seedLongitudinalSplines),
        ("&8a. Input Meshing Parameters", inputMeshingParameters),
        ("&8b. Sweeping Mesher", sweepingMesher),
        ("&9. Write mesh to file", writeMeshFile),
        ("---", None),
        ("&Create Surface Mesh", surfMesh),
        ("---", None),
        ("&Draw", [
            ("&All", drawAll),
            ("&Surface", drawSurface),
            ("&Helper Lines", drawHelperLines),
            ("&Control Lines", drawControlLines),
            ("&Central Point", drawCentralPoint),
            ("&Center Lines2D", drawCenterLines),
            ("&Center Lines3D", drawAxisSplines),
            ("&Cross Sections", drawCrossSections),
            ("&Cross Splines", drawCrossSplines),
            ("&Long Splines", drawLongSplines),
            #("&SurfaceMesh", drawSurfaceMesh),
            ("&Surface Spline_Mesh", drawSurfMesh),
            ("Set Draw Options", inputDrawOptions),
            ]),
        ("---", None),
        ("&Fly Along Center Lines", flyThru),
        ("---", None),
        ("&Close Menu", close_menu),
        ]
    return menu.Menu(_menu_, items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 7
0
def create_menu():
    """Create the Hesperia menu."""
    MenuData = [
        ("&How To Use", howto),
        ("---", None),
        ("&Create Geometry", createGeometry),
        ("&Assign Properties", assignProperties),
        ("&Export Properties", exportProperties),
        ("&Select Properties", selectProperties),
        ("&Save Properties", saveProperties),
        ("&Read Properties", readProperties),
        ("---", None),
        ("&Create Frame Model", createFrameModel),
        ("&Create Shell Model", createShellModel),
        ("---", None),
        ("&Write Abaqus input file", createAbaqusInput),
        ("&Run Calpy Analysis", runCalpyAnalysis),
        ("&Show Calpy Results", postCalpy),
        ("---", None),
        ("&Close Menu", close_menu),
        ]
    return menu.Menu('Hesperia', items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 8
0
def create_menu():
    """Create the FeEx menu."""
    MenuData = [
        ("&Delete All", deleteAll),
        ("&Create Rectangular Part", createRectPart),
        ("&Create QuadrilateralPart", createQuadPart),
        ## ("&Convert to Quadratic-8", convertQuadratic),
        ## ("&Convert to Quadratic-9", convertQuadratic9),
        ("&Show All", drawParts),
        ("---", None),
        ("&Merge Parts into Model", createModel),
        ("&Show Merged Model", drawModel),
        ("&Show Calpy Numbers", drawCalpy),
        ("&Print model", printModel),
        ("---", None),
        ("&Add material properties", setMaterial),
        ("&Add boundary conditions", setBoundary),
        ("&Add concentrated loads", setCLoad),
        ("&Add edge loads", setELoad),
        ("&Delete all material properties", deleteAllMats),
        ("&Delete all boundary conditions", deleteAllBcons),
        ("&Delete all concentrated loads", deleteAllCLoads),
        ("&Delete all edge loads", deleteAllELoads),
        ("&Print property database", printDB),
        ("---", None),
        ("&Create Abaqus/Calculix input file", createAbaqusInput),
        ("&Create Calix input file", createCalixInput),
        ("&Run Calpy analysis", runCalpyAnalysis),
        ("---", None),
        ("&Import all", importAll),
        ("&Export all", exportAll),
        ("&Autorun example", autoRun),
        ("&Autorun quadratic example", autoRun2),
        ("&Autoconv example", autoConv),
        ("---", None),
        ("&Close Menu", close_menu),
    ]
    return menu.Menu('FeEx', items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 9
0
def create_menu():
    """Create the Tools menu."""
    _init_()
    MenuData = [
        ('Global &Variables', [
            ('  &List All', printall),
            ('  &Select', database.ask),
            ('  &Print Value', printval),
            ('  &Print BBox', printbbox),
            ('  &Draw', _drawables.ask),
            ('  &Create', create),
            ('  &Change Value', edit),
            ('  &Rename', rename_),
            ('  &Keep', keep_),
            ('  &Delete', forget_),
            ('  &Delete All', delete_all),
            ]),
        ("---", None),
        ('&Execute pyFormex command', command),
        ("&DOS to Unix", dos2unix, dict(tooltip="Convert a text file from DOS to Unix line terminators")),
        ("&Unix to DOS", unix2dos),
        ("Send &Mail", sendMail),
        ("---", None),
        ("&Create Plane", [
            ("Coordinates",
                [("Point and normal", createPlaneCoordsPointNormal),
                ("Three points", createPlaneCoords3Points),
                ]),
            ("Visually",
                [("Three points", createPlaneVisual3Points),
                ]),
            ]),
        ("&Select Plane", planes.ask),
        ("&Draw Selection", planes.draw),
        ("&Forget Selection", planes.forget),
        ("---", None),
        ("Show an &Image file on the canvas", showImage),
        ("Show an &Image file as Formex", showImage3D),
        ("---", None),
        ('&Pick', [
            ("&Actors", pick_actors),
            ("&Elements", pick_elements),
            ("&Points", pick_points),
            ("&Edges", pick_edges),
            ]),
        ('&With picked', [
            ('&Create Report', report_selection),
            ('&Set Property', setprop_selection),
            ('&Grow', grow_selection),
            ('&Partition', partition_selection),
            ('&Get Partition', get_partition),
            ('&Export', export_selection),
            ('&Focus', focus_selection),
            ('&Actor dialog', actor_dialog),
            ]),
        ('&Edit Points', edit_points),
        ("&Remove Highlights", removeHighlight),
        ("---", None),
        ('&Query', [
            ('&Actors', query_actors),
            ('&Elements', query_elements),
            ('&Points', query_points),
            ('&Edges', query_edges),
            ('&Distances', query_distances),
            ('&Angle', query_angle),
            ('&Point 2D', query_point2D),
            ('&Distances 2D', query_distances2D),
            ('&Angles 2D', query_angles2D),
            ('&Point labels',pointlabels),
            ('&Create points',create_points),
            ]),
        ("---", None),
        ('&Reload', reload_menu),
        ("&Close", close_menu),
        ]
    return menu.Menu(_menu, items=MenuData, parent=pf.GUI.menu, before='help')
Esempio n. 10
0
def createAppMenu(mode='app', parent=None, before=None):
    """Create the menu(s) with pyFormex apps

    This creates a menu with all examples distributed with pyFormex.
    By default, this menu is put in the top menu bar with menu label 'Examples'.

    The user can add his own app directories through the configuration
    settings. In that case the 'Examples' menu and menus for all the
    configured app paths will be gathered in a top level popup menu labeled
    'Apps'.

    The menu will be placed in the top menu bar before the specified item.
    If a menu item named 'Examples' or 'Apps' already exists, it is
    replaced.
    """
    Mode = mode.capitalize()
    appmenu = menu.Menu('&%s' % Mode, parent=parent, before=before)
    appmenu.mode = mode
    if mode == 'app':
        appdirs = [(d.name, d.path) for d in pf.appdirs]
    else:
        appdirs = pf.cfg['scriptdirs']

    history = AppMenu('History',
                      files=pf.cfg['gui/%shistory' % mode],
                      max=pf.cfg['gui/history_max'],
                      mode=mode,
                      parent=appmenu,
                      runall=False)

    # Fill in missing default locations : this enables the user
    # to keep the pyFormex installed examples in his config
    guessName = lambda n, s: s if len(s) > 0 else pf.cfg['%sdir' % n.lower()]
    appdirs = [(d[0], guessName(*d)) for d in appdirs]
    appdirs = [d for d in appdirs
               if d[1] is not None and len(d[1]) > 0]  # may be removed?
    appdirs = [d for d in appdirs if os.path.exists(d[1])]
    for name, path in appdirs:
        pf.debug("Loading menu %s from %s" % (name, path), pf.DEBUG.MENU)
        m = AppMenu(name,
                    path,
                    mode=mode,
                    autoplay=True,
                    parent=appmenu,
                    runall=True)

    setattr(pf.GUI, '%shistory' % mode, history)

    appmenu.insertItems([
        ('---', None),
        (_('&Configure %s Paths' % Mode), setDirs, {
            'data': '%sdirs' % mode
        }),
        (_('&Reload %s Menu' % Mode), reloadMenu, {
            'data': mode
        }),
    ])
    if mode == 'app':
        appmenu.insertItems([
            (_('&List loaded Apps'), script.printLoadedApps),
            (_('&Unload Current App'), menu.unloadCurrentApp),
        ])

    return appmenu