janekpel
janekpel

Reputation: 99

Abaqus scripting: get point

Is there any way to write a script which prompts for point click in Abaqus CAE? I know the function getInput but it works only for strings.

Upvotes: 0

Views: 843

Answers (2)

Vuk
Vuk

Reputation: 11

how do you call this inside? Using RSG you just do the following and the button to select appears:

RsgPickButton(p='DialogBox', text='Select a face:', keyword='myFace', prompt='Pick a face', entitiesToPick='MDB_GEOMETRY|FACES', numberToPick='ONE')

Upvotes: 0

hgazibara
hgazibara

Reputation: 1832

There is a way, but it's not that easy. You need to create a custom GUI procedure. Using simple kernel scripting will not do the job.

You should implement a custom AFXPickStep procedure. More information about the procedure itself can be found in Abaqus documentation: Abaqus GUI Toolkit Reference Guide > All Classes > AFXPickStep.

Here is a small example of a similar procedure which is used to pick nodes in Abaqus Viewer. Adapt it to your own needs.

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,
)

Note that this does not include the kernel script which is needed to process the selected entities.

Upvotes: 2

Related Questions