【发布时间】:2019-05-06 07:41:22
【问题描述】:
我正在开发一个 Abaqus/CAE 插件,在这个插件中我使用的是 gui 工具包,并且我有一个使用 PickStep 的按钮,单击该按钮我可以在视口中选择一个 PartInstance .
然后我想将选定的 PartInstance 导出到 .obj 文件,但是当我尝试时,abaqus 显示错误。
这是我的 PICK BUTTON 示例:
# PICK BUTTON 1
pickHf = FXHorizontalFrame(p=col2, opts=0, x=0, y=0, w=0, h=0, pl=0, pr=0, pt=0, pb=0, hs=DEFAULT_SPACING,
vs=DEFAULT_SPACING)
# Note: Set the selector to indicate that this widget should not be
# colored differently from its parent when the 'Color layout managers'
# button is checked in the RSG Dialog Builder dialog.
pickHf.setSelector(99)
label1 = FXLabel(p=pickHf, text='' + ' (None)', ic=None, opts=LAYOUT_CENTER_Y | JUSTIFY_LEFT)
pickHandler1 = DBPickHandler(form, form.uper, 'Select a 3D, discrete and dependent meshed instance', INSTANCES,
1, label1)
icon = afxGetIcon('select', AFX_ICON_SMALL)
FXButton(p=pickHf, text='\tPick Items in Viewport', ic=icon, tgt=pickHandler1, sel=AFXMode.ID_ACTIVATE,
opts=BUTTON_NORMAL | LAYOUT_CENTER_Y, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=1, pb=1)
我将值保存在 ObjectKeyword 中:
self.uper = AFXObjectKeyword(self.cmd, 'uper', True, pickedDefault)
这就是我将 PartInstance 导出到 .obj 的方式:
print 'Uper - ' + uper[0].name
f.write('Uper - '+uper[0].name+'\n')
session.writeOBJFile(fileName='C:/temp/Uper.obj', canvasObjects=(uper[0]))
显示和错误,我也试过这个:
print 'Fixed - ' + fixed[0].name
f.write(fixed[0].name+'\n')
fixedobj = open('Fixed.obj', 'w')
pickle.dump(fixed[0], fixedobj)
fixedobj.close()
但这也不起作用。
我收到此错误:
canvasObjects;找到 PartInstance,期待元组
【问题讨论】:
-
您是否使用 Abaqus PDE 进行插件开发?我只是在寻找古玩,因为我自己也在从事类似的任务。