Exemple #1
1
    def Initialize(self):
        import sys
        PyVersion = sys.version_info[0]
        if PyVersion == 2:
            import a2p_Resources2
        else:
            import a2p_Resources3
        import a2plib
        import a2p_importpart
        import a2p_recursiveUpdatePlanner
        import a2p_convertPart
        import a2p_solversystem
        import a2p_MuxAssembly
        import a2p_partinformation
        import a2p_constraintDialog
        import a2p_constraintcommands
        import a2p_bom # bom == bill of materials == partslist

        if a2plib.getRecursiveUpdateEnabled():
            partCommands = [
                'a2p_ImportPart',
                'a2p_ImportShapeReferenceCommand',
                'a2p_updateImportedParts',
                'a2p_recursiveUpdateImportedPartsCommand',
                'a2p_movePart',
                'a2p_MovePartUnderConstraints',
                'a2p_duplicatePart',
                'a2p_ConvertPart',
                'a2p_editImportedPart',
                'a2p_SaveAndExit_Command',
                ]
        else:
            partCommands = [
                'a2p_ImportPart',
                'a2p_ImportShapeReferenceCommand',
                'a2p_updateImportedParts',
                'a2p_movePart',
                'a2p_MovePartUnderConstraints',
                'a2p_duplicatePart',
                'a2p_ConvertPart',
                'a2p_editImportedPart',
                'a2p_SaveAndExit_Command',
                ]
        
        if a2plib.SHOW_CONSTRAINTS_ON_TOOLBAR:
            constraintCommands = [
                'a2p_ConstraintDialogCommand',
                'a2p_EditConstraintCommand',
                'a2p_DeleteConnectionsCommand',
                'a2p_PointIdentityConstraintCommand',
                'a2p_PointOnLineConstraintCommand',
                'a2p_PointOnPlaneConstraintCommand',
                'a2p_SphericalSurfaceConstraintCommand',
                'a2p_CircularEdgeConnection',
                'a2p_AxialConstraintCommand',
                'a2p_AxisParallelConstraintCommand',
                'a2p_AxisPlaneParallelCommand',
                'a2p_AxisPlaneNormalCommand',
                'a2p_AxisPlaneAngleCommand',
                'a2p_PlanesParallelConstraintCommand',
                'a2p_PlaneCoincidentConstraintCommand',
                'a2p_AngledPlanesConstraintCommand',
                'a2p_CenterOfMassConstraintCommand',
                ]
        else:
            constraintCommands = [
                'a2p_ConstraintDialogCommand',
                'a2p_EditConstraintCommand',
                'a2p_DeleteConnectionsCommand',
                ]
        
        solverCommands = [
            'a2p_SolverCommand',
            'a2p_ToggleAutoSolveCommand',
            'a2p_FlipConstraintDirectionCommand',
            'a2p_Show_Hierarchy_Command'
            ]
        viewCommands = [
            'a2p_isolateCommand',
            'a2p_ViewConnectionsCommand',
            'a2p_Restore_Transparency',
            'a2p_ToggleTransparencyCommand',            
            'a2p_Show_PartLabels_Command',
            'a2p_Show_DOF_info_Command',
            ]
        miscCommands = [
            'a2p_SimpleAssemblyShapeCommand',
            'a2p_repairTreeViewCommand',
            'a2p_CreatePartInformationSheet_Command',
            'a2p_CreatePartlist',
            ]

        self.appendToolbar(
               'A2p_Part',
               partCommands
               )
        self.appendToolbar(
               'A2p_Constraint',
               constraintCommands
               )
        self.appendToolbar(
               'A2p_Solver',
               solverCommands
               )
        self.appendToolbar(
               'A2p_View',
               viewCommands
               )
        self.appendToolbar(
               'A2p_Misc',
               miscCommands
               )

        self.appendMenu(
            'A2plus',
            partCommands
            )
        self.appendMenu(
            ['A2plus', 'Constraint'],
            constraintCommands
            )
        self.appendMenu(
            ['A2plus', 'Solver'],
            solverCommands
            )
        self.appendMenu(
            ['A2plus', 'View'],
            viewCommands
            )
        self.appendMenu(
            ['A2plus', 'Misc'],
            miscCommands
            )            
            
        menuEntries = [
            'a2p_absPath_to_relPath_Command',
            'a2p_MigrateProxiesCommand'
            ]
        self.appendMenu(
            ['A2plus', 'Misc'],
            menuEntries
            )
        FreeCADGui.addIconPath(':/icons')
        
        FreeCADGui.addPreferencePage(
            a2plib.pathOfModule() +
            '/GuiA2p/Resources/ui/a2p_prefs.ui','A2plus'
            )
Exemple #2
0
    def Initialize(self):
        from a2p_translateUtils import QT_TRANSLATE_NOOP
        from a2p_translateUtils import translate
        from a2p_translateUtils import tr_

        import sys
        PyVersion = sys.version_info[0]
        if PyVersion == 2:
            import a2p_Resources2
        else:
            import a2p_Resources3
        import a2plib

        # add translations path
        FreeCADGui.addLanguagePath(a2plib.getLanguagePath())
        FreeCADGui.updateLocale()
        print("languagePath of A2plus Workbench is: {}".format(
            a2plib.getLanguagePath()))

        import a2p_importpart
        import a2p_recursiveUpdatePlanner
        import a2p_convertPart
        import a2p_solversystem
        import a2p_MuxAssembly
        import a2p_partinformation
        import a2p_constraintDialog
        import a2p_constraintcommands
        import a2p_bom  # bom == bill of materials == partslist
        import a2p_constraintServices
        import a2p_searchConstraintConflicts
        import CD_A2plusupdater  # for Constraint Diagnostic function
        if a2plib.getRecursiveUpdateEnabled():
            partCommands = [
                'a2p_ImportPart',
                'a2p_ImportShapeReferenceCommand',
                'a2p_updateImportedParts',
                'a2p_recursiveUpdateImportedPartsCommand',
                'a2p_movePart',
                'a2p_MovePartUnderConstraints',
                'a2p_duplicatePart',
                'a2p_ConvertPart',
                'a2p_editImportedPart',
                'a2p_SaveAndExit_Command',
            ]
        else:
            partCommands = [
                'a2p_ImportPart',
                'a2p_ImportShapeReferenceCommand',
                'a2p_updateImportedParts',
                'a2p_movePart',
                'a2p_MovePartUnderConstraints',
                'a2p_duplicatePart',
                'a2p_ConvertPart',
                'a2p_editImportedPart',
                'a2p_SaveAndExit_Command',
            ]

        if a2plib.SHOW_CONSTRAINTS_ON_TOOLBAR:
            constraintCommands = [
                'a2p_ConstraintDialogCommand',
                'a2p_EditConstraintCommand',
                'a2p_reAdjustConstraintDirectionsCommand',
                'a2p_DeleteConnectionsCommand',
                'a2p_PointIdentityConstraintCommand',
                'a2p_PointOnLineConstraintCommand',
                'a2p_PointOnPlaneConstraintCommand',
                'a2p_SphericalSurfaceConstraintCommand',
                'a2p_CircularEdgeConnection',
                'a2p_AxialConstraintCommand',
                'a2p_AxisParallelConstraintCommand',
                'a2p_AxisPlaneParallelCommand',
                'a2p_AxisPlaneNormalCommand',
                'a2p_AxisPlaneAngleCommand',
                'a2p_PlanesParallelConstraintCommand',
                'a2p_PlaneCoincidentConstraintCommand',
                'a2p_AngledPlanesConstraintCommand',
                'a2p_CenterOfMassConstraintCommand',
            ]
        else:
            constraintCommands = [
                'a2p_ConstraintDialogCommand',
                'a2p_EditConstraintCommand',
                'a2p_reAdjustConstraintDirectionsCommand',
                'a2p_DeleteConnectionsCommand',
            ]

        if a2plib.GRAPHICALDEBUG:
            solverCommands = [
                'a2p_SolverCommand', 'a2p_ToggleAutoSolveCommand',
                'a2p_FlipConstraintDirectionCommand',
                'a2p_Show_Hierarchy_Command',
                'a2p_SearchConstraintConflictsCommand',
                'a2p_cleanUpDebug3dCommand'
            ]
        else:
            solverCommands = [
                'a2p_SolverCommand', 'a2p_ToggleAutoSolveCommand',
                'a2p_FlipConstraintDirectionCommand',
                'a2p_Show_Hierarchy_Command',
                'a2p_SearchConstraintConflictsCommand'
            ]
        viewCommands = [
            'a2p_isolateCommand',
            'a2p_ViewConnectionsCommand',
            'a2p_Restore_Transparency',
            'a2p_ToggleTransparencyCommand',
            'a2p_Show_PartLabels_Command',
            'a2p_Show_DOF_info_Command',
        ]
        miscCommands = [
            'a2p_SimpleAssemblyShapeCommand',
            'a2p_repairTreeViewCommand',
            'a2p_CreatePartInformationSheet_Command',
            'a2p_CreatePartlist',
        ]

        self.appendToolbar('A2p_Part', partCommands)
        self.appendToolbar('A2p_Constraint', constraintCommands)
        self.appendToolbar('A2p_Solver', solverCommands)
        self.appendToolbar('A2p_View', viewCommands)
        self.appendToolbar('A2p_Misc', miscCommands)

        self.appendMenu('A2plus', partCommands)
        self.appendMenu(
            ['A2plus', translate("A2plus_appendMenu", 'Constraint')],
            constraintCommands)
        self.appendMenu(
            ['A2plus', translate("A2plus_appendMenu", 'Solver')],
            solverCommands)
        self.appendMenu(
            ['A2plus', translate("A2plus_appendMenu", 'View')], viewCommands)
        self.appendMenu(
            ['A2plus', translate("A2plus_appendMenu", 'Misc')], miscCommands)

        menuEntries = [
            'a2p_absPath_to_relPath_Command', 'a2p_MigrateProxiesCommand'
        ]
        self.appendMenu(['A2plus', 'Misc'], menuEntries)
        FreeCADGui.addIconPath(':/icons')

        FreeCADGui.addPreferencePage(
            a2plib.pathOfModule() + '/GuiA2p/Resources/ui/a2p_prefs.ui',
            'A2plus')

        DiagnosticCommands = [
            'rnp_Constraint_Viewer',
            'rnp_Update_A2pParts',
        ]

        self.appendToolbar('A2Diagnostics', DiagnosticCommands)