-
Notifications
You must be signed in to change notification settings - Fork 3
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
Pymechanical update1 #69
base: main
Are you sure you want to change the base?
Conversation
Hi @klmcadams , please review . |
I think we should include the version of PyMechanical somewhere... and if it is already there, we should update it to the latest released version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! I added comments with the version of ansys-mechanical-core required to use the code that was added to the cheatsheet. @RobPasMue is this what you were thinking, or were you talking about adding the latest version in the title instead?
app = App(version=241) | ||
print(app) | ||
# BREAK BLOCK | ||
|
||
# Extract the global API entry points (available from built-in Mechanical scripting) | ||
from ansys.mechanical.core import global_variables | ||
# Merge them into your Python global variables | ||
globals().update(global_variables(app)) | ||
# Optional argument for Enums without namespaces | ||
globals().update(global_variables(app),True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
globals().update(global_variables(app),True) | |
# Available in ansys-mechanical-core >= v0.10.3 | |
globals().update(global_variables(app),True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been modified with latest way of updating globals
globals().update(global_variables(app)) | ||
# Optional argument for Enums without namespaces | ||
globals().update(global_variables(app),True) | ||
# Import Python modules shipped with Mechanical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Import Python modules shipped with Mechanical | |
# Import Python modules shipped with Mechanical | |
# Available in ansys-mechanical-core >= v0.10.3 |
globals().update(global_variables(app),True) | ||
# Import Python modules shipped with Mechanical | ||
from ansys.mechanical.core.embedding import add_mechanical_python_libraries | ||
add_mechanical_python_libraries(241) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments -
-
I don't see where these libraries are used.
-
better to make the version number a variable so that the same number is guaranteed to be used by
add_mechanical_python_libraries()
andapp = App()
Hi @RobPasMue @koubaa , Do you think we can minor version too on the header (like pyAEDT cheatsheet does. snapshot below)? |
fixed a typo.
added add_mechanical_python_libraries
added Enum argument on globals() and modified the example code accordingly