Abaqus脚本:得到点

时间:2017-08-02 10:53:20

标签: python abaqus

有没有办法在Abaqus CAE中编写一个提示点击的脚本? 我知道函数getInput但它只适用于字符串。

1 个答案:

答案 0 :(得分:2)

有一种方法,但并不容易。您需要创建自定义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,
)

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