Skip to content
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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Pymechanical update1 #69

wants to merge 3 commits into from

Conversation

rs-bh-n
Copy link
Collaborator

@rs-bh-n rs-bh-n commented Feb 27, 2024

fixed a typo.
added add_mechanical_python_libraries
added Enum argument on globals() and modified the example code accordingly

@rs-bh-n rs-bh-n marked this pull request as draft February 27, 2024 06:46
@rs-bh-n rs-bh-n requested a review from klmcadams February 27, 2024 06:47
@rs-bh-n rs-bh-n marked this pull request as ready for review February 27, 2024 06:50
@rs-bh-n
Copy link
Collaborator Author

rs-bh-n commented Feb 27, 2024

Hi @klmcadams ,

please review .

@RobPasMue
Copy link
Member

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

Copy link

@klmcadams klmcadams left a 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
globals().update(global_variables(app),True)
# Available in ansys-mechanical-core >= v0.10.3
globals().update(global_variables(app),True)

Copy link
Contributor

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Import Python modules shipped with Mechanical
# Import Python modules shipped with Mechanical
# Available in ansys-mechanical-core >= v0.10.3

@klmcadams klmcadams requested a review from koubaa February 27, 2024 14:50
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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments -

  1. I don't see where these libraries are used.

  2. better to make the version number a variable so that the same number is guaranteed to be used by add_mechanical_python_libraries() and app = App()

@rs-bh-n
Copy link
Collaborator Author

rs-bh-n commented Mar 13, 2024

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

Hi @RobPasMue @koubaa , Do you think we can minor version too on the header (like pyAEDT cheatsheet does. snapshot below)?
image

@rs-bh-n rs-bh-n marked this pull request as draft April 15, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants