liwei19920518 发表于 2020-11-13 16:45:15

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')https://img.jishulink.com/upload/202011/ccf4964c7c4e438e9c03b924501c680c.pnghttps://img.jishulink.com/upload/202011/fd1dde6f7a1b4e4fa997bdbb21d5b776.png


https://www.jishulink.com/platform/static/ueditor/themes/default/images/spacer.gifhttps://www.jishulink.com/platform/static/ueditor/themes/default/images/spacer.gif2. 多对话框(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.dialog1def 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 None3. 案例本案例只是为了演示两种方法的实现,可根据实际需求进行更改。先采用Abaqus中的RSG插件建立两个对话框,分别为Creat Part(保存的图形界面文件和注册文件名称分别为caseDB和case_form)和Example(保存的图形界面文件和注册文件名称分别为test1DB和test1_form),如下:https://img.jishulink.com/upload/202011/cc3b81ff47a643c9988d4b45283b4a56.png
https://img.jishulink.com/upload/202011/5ef2b56bce74441092343d7ea96c2f48.png
3.1 旋转区域实现
caseDB.py文件中相关程序修改如下:https://img.jishulink.com/upload/202011/8521274837874bd6bb63adb73445e035.png
实现的效果如下:
https://img.jishulink.com/upload/202011/e882df47a07e479499eff8fb09baa50e.png
https://img.jishulink.com/upload/202011/5e6739d3f2904ae0b4f2987f6adb6a78.png
https://img.jishulink.com/upload/202011/f32ab07202fa47e1bd7012d5966a208a.png
https://www.jishulink.com/platform/static/ueditor/themes/default/images/spacer.gif备注:此处截图中CONTINUE按钮的label为OK按钮。3.2 多对话框实现caseDB.py文件中相关程序修改如下:https://img.jishulink.com/upload/202011/797b2ecc310d417894bc8f424c394730.png
将test1_form.py中的关键字注册相关程序(如下图),复制到caseform.py文件中,
https://img.jishulink.com/upload/202011/b97a63e7dd8c45fda87fa46d5328d624.png
caseform.py文件中相关程序修改如下:
https://img.jishulink.com/upload/202011/0d665e8b65464b4daf1e8050ee9f0046.png
https://www.jishulink.com/platform/static/ueditor/themes/default/images/spacer.gif实现的效果如下:https://img.jishulink.com/upload/202011/f54c9255e28349e3a2e76aa1ab1e1e08.png
https://www.jishulink.com/platform/static/ueditor/themes/default/images/spacer.gif点击CONTINUE按钮后弹出下图:https://img.jishulink.com/upload/202011/d1939972db5e4641b539405552d0bcd2.png

文章中案例的完整源程序参考链接:http://www.jishulink.com/content/post/1288181

mikevenus 发表于 2020-11-14 17:21:10

这么巧,我今天也琢磨这个。可惜只会写简单的切换,不知道楼主会不会多级切换,就像part模块中的create Part那个对话框,望能赐教。谢谢

a554178555 发表于 2020-11-20 15:56:04

学到了,多谢楼主

liwei19920518 发表于 2020-12-22 13:02:00

mikevenus 发表于 2020-11-14 17:21
这么巧,我今天也琢磨这个。可惜只会写简单的切换,不知道楼主会不会多级切换,就像part模块中的create Par ...

我没有试过这个,大致看了下程序,将hf1=...相关的代码重复一下应该可以实现的,你说的要求也不算是多级切换,只是多个切换。
页: [1]
查看完整版本: Abaqus GUI中旋转区域和多对话框实现方法