Abaqus GUI中旋轉區域和多對話框實現方法

本文介紹如何在Abaqus GUI程序設計中實現旋轉區域和多個對話框功能。

先了解下幫助文檔中相關內容的介紹:

1. 旋轉區域Rotating regions

The FXSwitcher widget manages children that are positioned on top of each other.

FXSwitcher allows you to select which child should be shown by either sending it a message or calling its setCurrent method. When sending a message, you must set the message ID to FXSwitcher.ID_OPEN_FIRST for the first child. You must then increment the message ID from that value for the subsequent children, as shown in the following example. For example,

sw = FXSwitcher(parent)

FXRadioButton(hf, 'Option 1', sw, FXSwitcher.ID_OPEN_FIRST)

FXRadioButton(hf, 'Option 2', sw, FXSwitcher.ID_OPEN_FIRST+1)

hf1 = FXHorizontalFrame(sw)    

FXButton(hf1, 'Button 1')

FXButton(hf1, 'Button 2')

hf2 = FXHorizontalFrame(sw)

FXButton(hf2, 'Button 3')

FXButton(hf2, 'Button 4')

1.png Abaqus GUI中旋轉區域和多對話框實現方法的圖2

Abaqus GUI中旋轉區域和多對話框實現方法的圖3Abaqus GUI中旋轉區域和多對話框實現方法的圖4

2. 多對話框(Multiple dialogs

If your mode contains more than one dialog box, you must write the getNextDialog method in addition to the getFirstDialog method.

The previous dialog box is passed into the getNextDialog method so that you can determine where the user is in the sequence of dialog boxes and act accordingly. The getNextDialog method should return the next dialog box in the sequence, or it should return None to indicate that it has finished collecting input from the user. An example is as follows:

def getFirstDialog(self):

    self.dialog1 = PlateDB1(self)

    return self.dialog1

def getNextDialog(self, previousDb):

    if previousDb == self.dialog1:

        self.dialog2 = PlateDB2(self)

        return self.dialog2        

    elif previousDb == self.dialog2:

        self.dialog3 = PlateDB3(self)

        return self.dialog3

    else:

        return None

3. 案例

本案例只是為了演示兩種方法的實現,可根據實際需求進行更改。先采用Abaqus中的RSG插件建立兩個對話框,分別為Creat Part(保存的圖形界面文件和注冊文件名稱分別為caseDB和case_form)和Example(保存的圖形界面文件和注冊文件名稱分別為test1DB和test1_form),如下: 

3.png
4.png

3.1 旋轉區域實現

caseDB.py文件中相關程序修改如下:

5.png

實現的效果如下:

6.png
7.png
8.png

Abaqus GUI中旋轉區域和多對話框實現方法的圖11

備注:此處截圖中CONTINUE按鈕的label為OK按鈕。

3.2 多對話框實現

caseDB.py文件中相關程序修改如下:

9.png

將test1_form.py中的關鍵字注冊相關程序(如下圖),復制到caseform.py文件中,

10.png

caseform.py文件中相關程序修改如下:

11.png

Abaqus GUI中旋轉區域和多對話框實現方法的圖15

實現的效果如下:

12.png

Abaqus GUI中旋轉區域和多對話框實現方法的圖17

點擊CONTINUE按鈕后彈出下圖:

13.png

本案例的源程序如附件所示(由于格式限制,附件將文件的后綴.py改為了.txt,使用時,直接改回.py即可)。

以下內容為付費內容,請購買后觀看

   5人購買

腳本源程序

App下載
技術鄰APP
工程師必備
  • 項目客服
  • 培訓客服
  • 平臺客服

TOP

18
13
2