2017-08-02 247 views

回答

1

有一种方法,但并不那么容易。您需要创建一个自定义的GUI过程。使用简单的内核脚本将无法完成这项工作。

您应该执行自定义AFXPickStep过程。关于程序本身的更多信息可以在Abaqus文档中找到:Abaqus GUI Toolkit Reference Guide > All Classes > AFXPickStep

下面是一个类似过程的小例子,用于在Abaqus Viewer中选择节点。适应您的需求。

import abaqusConstants 
import abaqusGui 


class PickNodesProcedure(abaqusGui.AFXProcedure): 

    def __init__(self, owner): 
     abaqusGui.AFXProcedure.__init__(self, owner) 

     self.cmd = abaqusGui.AFXGuiCommand(
      mode=self, 
      method='pick', 
      objectName='node_set', 
      registerQuery=abaqusGui.FALSE 
     ) 

     self.nodesKw = abaqusGui.AFXObjectKeyword(
      command=self.cmd, 
      name='node', 
      isRequired=abaqusGui.TRUE 
     ) 

    def activate(self): 
     return abaqusGui.AFXProcedure.activate(self) 

    def getFirstStep(self): 
     self.pickStep = abaqusGui.AFXPickStep(
      owner=self, 
      keyword=self.nodesKw, 
      prompt="Pick nodes", 
      entitiesToPick=abaqusGui.NODES, 
      numberToPick=abaqusGui.ONE, 
      sequenceStyle=abaqusGui.TUPLE 
     ) 
     return self.pickStep 

    def getLoopStep(self): 
     return self.pickStep 


toolset = abaqusGui.getAFXApp().getAFXMainWindow().getPluginToolset() 

toolset.registerGuiMenuButton(
    buttonText='Pick Nodes', 
    object=PickNodesProcedure(toolset), 
    kernelInitString='import kernel_module', 
    applicableModules=abaqusConstants.ALL, 
) 

请注意,这不包括处理所选实体所需的内核脚本。

+0

谢谢。我会尽力 – janekpel