Closed ekostson closed 4 months ago
The reporting feature only works in UI mode, PyMechanical embedding is batch mode only.
The right 1:1 comparison to see if something should run in embedding (i.e. to positively state that it runs in Mechanical) is to run Mechanical by command line in batch mode and pass the input script in. You can use the ansys-mechanical
script that is shipped with PyMechanical to facilitate that.
Closing, we don't support jscript.
🔍 Before submitting the issue
🐞 Description of the bug
Hello - I used the code (https://discuss.ansys.com/discussion/1084/how-to-generate-the-report-preview - which works inside wb mech. script console), but gives an error inside pymech. (as we said it runs fine inside wb mech):
PublishType = {"SingleFile": 1, "FiguresSubFolder": 2, "SingleFolder": 3} cmd = """DS.Script.doReportPreviewWindow();""" cmd1 = """DS.Script.doReportRegenerate();""" cmd2 = """DS.Script.publishReport("{0}",{1});""".format(r"D:/Data/sample.htm", PublishType["FiguresSubFolder"]) ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(cmd) ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(cmd1) ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(cmd2)
📝 Steps to reproduce
See above
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
2023 R2
🐍 Which Python version are you using?
3.10.10 (anyhow the pymech script example bolted flange with internal pressure works, only when the jscript is added it does not work and gives the error)
📦 Installed packages