-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential workflow : pymechanical + pydynamicreporting #23
Comments
##Prerequisites print("User Inputs") ##Import Python Modules print("Import Python Modules") ##Define constants and create subfolders print("Define constants and create subfolders") if os.path.exists(adr_db_directory): try: os.mkdir(adr_db_directory) if os.path.exists(export_directory): try: os.mkdir(export_directory) print(" Section Completed") ##Start ADR service print("Start ADR service") try: session_guid = adr_service.start(create_db=True) server=adr_service.serverobj ##Launch Mechanical and import Mechanical scripting variables print("Launch Mechanical and import Mechanical scripting variables") ##Define Mechanical helper functions print("Define Mechanical helper functions") export_directory = wbjn.ExecuteCommand(ExtAPI,'returnValue(GetUserFilesDirectory())')filename = os.path.join(export_directory,'{}.avz'.format(obj.Name)) def ExportPNG(obj,export_directory): print(" Mechanical helper functions created.") ##Define ADR helper functions print("Define ADR helper functions") def PushAVZ(avz,adr_service,tags='',name='Scene_from_AVZ'): def PushPNG(file,adr_service,tags='',name='Image_from_PNG'): def ExportPDF(adr_service,report,filename,version=241): print("ADR helper functions created.") ##Create Report Items and push them to ADR print("Create Report Items and push them to ADR") mesh = ExtAPI.DataModel.Project.Model.Mesh results =ExtAPI.DataModel.GetObjectsByType(Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory.Result) print(" Section Completed") adr_service.visualize_report() print("Create tree items and push them to ADR") MaterialTree = [(dict(key='root', name='Material Data', value=None, children=partList,state="collapsed"))] timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S') adr_service.visualize_report() print(adr_service.url) ##Create the report templates print("Create the dynamic report template") template_13=server.create_template(name="Logo", parent=template_00, report_type="Layout:basic") template_02=server.create_template(name="TOC", parent=template_00, report_type="Layout:toc") Table of Contents Geometry template_03=server.create_template(name="Mesh", parent=template_00, report_type="Layout:panel") Mesh template_05=server.create_template(name="FEA Details", parent=template_00, report_type="Layout:panel") FEA Details Materials Static Structural Total Deformation template_08=server.create_template(name="table", parent=template_14, report_type="Layout:basic") template_11=server.create_template(name="Equivalent Stress", parent=template_10, report_type="Layout:basic") Equivalent Stress template_09=server.create_template(name="table", parent=template_11, report_type="Layout:basic") print("Create the static report template") template_13=server.create_template(name="Logo", parent=template_00, report_type="Layout:basic") template_02=server.create_template(name="TOC", parent=template_00, report_type="Layout:toc") Table of Contents Geometry template_03=server.create_template(name="Mesh", parent=template_00, report_type="Layout:panel") Mesh template_05=server.create_template(name="FEA Details", parent=template_00, report_type="Layout:panel") FEA Details Materials Static Structural Total Deformation template_08=server.create_template(name="table", parent=template_14, report_type="Layout:basic") template_11=server.create_template(name="Equivalent Stress", parent=template_10, report_type="Layout:basic") Equivalent Stress template_09=server.create_template(name="table", parent=template_11, report_type="Layout:basic") ##View the reports print("View the reports") static_report = adr_service.get_report(report_name='Mechanical Basic Report (Static)') ##Clean up print("Stop the Nexus server and close Mechanical") |
for more information ref
The text was updated successfully, but these errors were encountered: