我正在寻找从结果ABAQUS/Viewer打印3D PDF的方法。这样可以很容易地将结果与其他对仿真结果感兴趣但无法访问ABAQUS的人员交流。如何从ABAQUS/Viewer打印3D PDF?
4
A
回答
6
最好的方法是导出一个vrml文件并使用Tetra4D或pdf3D和Adobe Acrobat专业版进行转换。 3D pdf可以看起来非常好。但是,商业软件每年的费用超过800英镑。我创建了一个Python脚本来直接从Abaqus/CAE & Viewer中创建一个3D PDF,它使用2个开源工具:1)Meshlab(http://www.meshlab.net/)创建U3D文件,2)MiKTeX(https://miktex.org/)将U3D文件转换为PDF格式。输出不像Tetra4D那样光亮,但它的工作原理。我没有用最新版本的Meshlab来试用。只需从Abaqus/CAE或Abaqus/Viewer运行该脚本即可。
# Abaqus CAE/Viewer Python Script to create a 3D pdf directly from Abaqus/CAE or Abaqus/Viewer.
# You must first install meshlab (meshlabserver.exe)and MiKTeX (pdflatex.exe)
# Edit this script to reflect the installed locations of meshlabserver.exe and pdflatex.exe
# It will export a stl or obj file the mesh of current viewport and convert into 3D pdf
# Or run in Abaqus/viewer and it will create a VRML file and convert to 3D pdf.
# If contours are displayed in Abaqus Viewer, then it will create a contour 3D pdf
from abaqus import *
from abaqusConstants import *
from viewerModules import *
import os
import subprocess
import sys
# -----------------------------------------------------------------------------
pdfName='try'
meshlab_path="C:/Program Files/VCG/MeshLab/meshlabserver.exe"
pdfLatex_path="C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/pdflatex.exe"
# -----------------------------------------------------------------------------
currView=session.viewports[session.currentViewportName]
try: # for Abaqus Viewer
cOdbD=currView.odbDisplay
odb = session.odbs[cOdbD.name]
name=odb.name.split(r'/')[-1].replace('.odb','')
module='Vis'
except: # Abaqus CAE
#name=currView.displayedObject.modelName
import stlExport_kernel
name = repr(currView.displayedObject).split('[')[-1].split(']')[0][1:-1] # allows for either main or visulation modules
module='CAE'
print module
if module=='CAE':
#All instances must be meshed
cOdbD=None
try:
ext='.stl'
stlExport_kernel.STLExport(moduleName='Assembly', stlFileName=pdfName + ext, stlFileType='BINARY')
except:
try:
ext='.obj'
session.writeOBJFile(fileName=os.path.join(directory,pdfName + ext), canvasObjects= (currView,))
except:
print 'Either your assembly is not fully meshed or something else'
directory=(os.getcwd())
else: # Abaqus/Viewer
if cOdbD.viewCut:
session.graphicsOptions.setValues(antiAlias=OFF) # Better with anti aliasing off
odb = session.odbs[cOdbD.name]
directory=odb.path.replace(odb.path.split('/')[-1],'').replace('/','\\')
# Turn off most of the stuff in the viewport
currView.viewportAnnotationOptions.setValues(triad=OFF,
legend=OFF, title=OFF, state=OFF, annotations=OFF, compass=OFF)
ext='.wrl'
session.writeVrmlFile(fileName=os.path.join(directory,pdfName + ext),
compression=0, canvasObjects= (currView,))
pdfFilePath=os.path.join(directory,pdfName+'-out.pdf')
if os.path.isfile(pdfFilePath):
os.remove(pdfFilePath)
#Check file was deleted
if os.path.isfile(pdfFilePath):
print "Aborted because pdf file of same name cant be deleted. Please close programs which it might be open in"
1/0 #a dodgy way to exit program
# Invoke meshlab to convert to a .u3d file
if cOdbD: #If in Abaqus/viewer
if 'CONTOURS' in repr(cOdbD.display.plotState[0]): # If contours are displayed. Output contoured pdf
p=subprocess.Popen([meshlab_path,'-i',pdfName + ext, '-o',pdfName + '.u3d','-m','vc']) #'vn fn fc vt'
else:
p=subprocess.Popen([meshlab_path,'-i',pdfName + ext, '-o',pdfName + '.u3d'])
else:
p=subprocess.Popen([meshlab_path,'-i',pdfName + ext, '-o',pdfName + '.u3d'])
p.communicate() # Wait for meshlab to finish
file_fullPathName=os.path.join(directory, pdfName + '.tex')
#Read the .tex file which meshlab has just created
with open(file_fullPathName, 'r') as texFile:
lines = texFile.read()
#Edit the .tex file
lines=lines.replace("\usepackage[3D]{movie15}","\\usepackage[3D]{movie15}\n\\usepackage[margin=-2.2in]{geometry}")
if cOdbD:
if 'CONTOURS' in repr(cOdbD.display.plotState[0]):
lines=lines.replace("3Dlights=CAD,","3Dlights=CAD,\n\t3Drender=SolidWireframe,")
lines=lines.replace("\n\end{document}","{---------------------------------------------------------------------------------Click above! MB1 - rotate, MB2 wheel or MB3 - zoom, Ctrl-MB1 - pan--------------}\n\\end{document}")
file_fullPathName=os.path.join(directory, pdfName + '-out.tex')
with open(file_fullPathName, "w") as outp:
outp.write(lines)
p=subprocess.Popen([
pdfLatex_path,
pdfName + '-out.tex',
])
p.communicate()
print 'Conversion to pdf complete'
print file_fullPathName
1
打印使用TECPLOT 360的Abaqus * .odb结果的最简单的方法这是阅读的Abaqus * .odb文件,你可以用任何决议案获得* .TIF和* .PNG结果,你可以还可以在3D中旋转模型并更改字体和所有您需要的东西。
相关问题
- 1. 从FLEX打印PDF
- 2. 从javascript打印PDF
- 3. 如何从iframe中打印pdf?
- 4. 如何从网页上打印PDF
- 5. 如何从无线打印机打印PDF文件?
- 6. 如何显示pdf或打印pdf
- 7. 从django表格打印PDF
- 8. 从ASP.NET批量打印PDF
- 9. 从Qt打印PDF文件
- 10. 打印PDF双面打印
- 11. 如何打印C#3D交错数组
- 12. PDF打印 - APEX
- 13. Ghostscript PDF打印
- 14. 如何在打印PDF时不使用Bluebeam打开revu PDF的
- 15. 如何使用Python从横向打印PDF文件到打印机?
- 16. 如何打印PDF文件在Java中与打印对话框
- 17. 如何在PDF文件上打印打印机型号
- 18. 如何在打印时设置打印机设置PDF
- 19. 如何在Qt5中打印PDF到打印机
- 20. 如何使用不带打印机的默认打印机(VB Net)打印PDF
- 21. PDF.js如何打印多页PDF?
- 22. 如何打印MVC3“页面”为pdf
- 23. 如何在PDF上打印GridView?
- 24. 如何打印ajaxtoolkit饼图(pdf格式)?
- 25. 如何使用Prolog打印PDF文件
- 26. 如何以横向模式打印PDF
- 27. Windows如何批量打印PDF文档?
- 28. 如何打印PDF在角2
- 29. 如何将.MSG打印为PDF
- 30. JavaScript - 如何手动打印PDF?
我刚刚试过你的解决方案,并确认它的工作原理,我对结果非常满意。 谢谢! – CodeCupboard
@churchwalk很高兴你很高兴。我无法找到使用阴影处理AbaqusViewer轮廓出口的方法。但它看起来还不错。 – DougR
出于兴趣,这个方法可以用于在PowerPoint演示文稿中创建3D图像吗? – CodeCupboard