ansys / pyansys-geometry Goto Github PK
View Code? Open in Web Editor NEWA Python wrapper for Ansys Geometry Services
Home Page: https://geometry.docs.pyansys.com/
License: MIT License
A Python wrapper for Ansys Geometry Services
Home Page: https://geometry.docs.pyansys.com/
License: MIT License
From conversations with DBU, we should implement the Sketch
class to work with 2D points rather than 3D when sketching.
This is also a resulting task from #96
This task should follow after:
Some of the tasks to be performed are:
Point2D
, Vector2D
...).Sketch
class is adapted to the new shape constructors.We should extract this into a __check_arc_data(...)
method. That way we can call it from potential future setters.
Originally posted by @RobPasMue in #81 (comment)
Minimum constructor:
Point3D origin, Direction dir
Minimum constructor:
Point3D origin, Direction dirX, Direction dirY
Can include Plane concept within Sketch class as well since a Sketch acts against a single plane workspace
SpaceClaim constructors for reference:
Sphere(Point3D origin, Direction dirX, Direction dirY, double radius)
Sphere(Point3D origin, double radius)
Once #1 #2 #3 are ready, we should be in a good position of including a first example on how users are expected to work with the library datamodel objects, regarding:
We should definitely include some examples regarding basic datamodel object usage.
Will be similar to extrude, but does not accept in a distance. CreatePlanarBody grpc endpoing on bodies.proto.
SpaceClaim constructors for reference:
Cylinder(Point3D origin, Direction dirX, Direction dirY, double radius)
Cylinder(Point3D origin, Direction dirZ, double radius)
Now that we have a client in place (#36) we are able to pull up a server and connect to it. We should be able to go through the different shapes implemented, add them to the Sketch and send them over to the server. Then, parse the response and validate that the Sketch
build has been done adequately.
Maybe all of this is contained client side but would be nice to move server side in either this first implementation or future refactors.
Accept in the required inputs to create a box in a method on the Component class. The call to the server should return a Body that will be nested under the Component in context.
Example client script is within BoardCreationCommonHelper for reference.
Drive by observation:
Why are we defining __all__
here?
__all__
defines what's imported when using "star" imports. Since this __all__
already includes all the classes defined in the __init__.py
, it seems redundant.
Let's get a first version of the Geometry client out!
Related tasks:
pint
. Linked to #2Let us use beartype for checking type hints at runtime. This will also simplify most of our check validations.
We need to implement a logger. Follow approach from PyDiscovery and PyMAPDL. This module may be easily migrated from these repositories.
Point3D == Point3D
or Point3d.is_equal(<other point, tol=1E-5)
#35Additional requirements
Point3D()
)Add transformation module for :
An important aspect of CAD libraries are the units. It is expected that, behind the scenes, all objects work in SI units, but users should be able to provide their values in different units. Let's get this module started!
units
moduleConversion
class which will contain a Quantity
(enum) value and a conversion factordatamodel.objects
packageSee the following picture for having an idea of the location of the units
subpackage
Let's rework the existing 3D objects into using as base attributes our PyGeometry *Shape
objects. We may need to open separate issues for each of them:
Following DBU suggestions (thanks to Udo Tremel) we should consider separating all the curves and primitives we have into these two big submodules. Math would contain our actual primitives
submodule whereas SketchCurves
should be in shapes
One of the suggestions of the DBU team is the concept of bounded/unbounded curves. Sketch-related objects should be bounded (i.e. they should have a beginning and an end) whereas unbounded objects (Line(infinite/semi-infinite), circle, ellipse...) should be more like primitives.
Furthermore, all these objects could be used elsewhere. So we should try to remove the "Sketch" concept from these curves and add the concept of Bounded/Unbounded. In fact, Bounded curves could easily extend Unbounded ones, since they would only be specifying starting and end points.
@Revathyvenugopal162 and @MaxJPRey did a really good work implementing the general Python abstract objects we conceived from PyDiscovery. And most of that work is reusable. Let's take it to this repo!
GRPCWrapper
class (and change name to BaseObject
geometry
subpackageAs a developer, I would like an encapsulated abstraction providing:
The Arc
is one of the basic curves we need to be able to create. Basic constructor for DBU is exposed in #13.
Make sure that the signatures of the different shapes signatures (circle, arc, ellipse, line...) are consistent.
Add a function in vector module to find the angle between 2 vectors. Which will useful to for transformations, arc and geometric functionality of perpendicular, parallel lines
Following @jorgepiloto's suggestion, it may be interesting to add a transformations.py
module once the Matrix
class is available, so that we have the capability of creating:
And their operations. All these computations can occur on the client side. Thanks for the suggestion @jorgepiloto!
We are definitely not going to implement the Spline logic on our own. We should look into other libraries to see who has it implemented and wrap around it.
Should handle comparisons with default and defined tolerances like:
Accuracy.length_is_zero(length: float)
Accuracy.length_is_zero(length: float, tolerance: float)
Pull default tolerances from SpaceClaim, such as:
float length_accuracy = 1e-8;
The Frame
will allow us to set our reference system in space. As exposed in #13 it is one of the basic objects the DBU needs. This task should be handled prior to #32.
3D primitive object
constructor options within spaceclaim
Point3D origin, Direction dirX, Direction dirY, double majorRadius, double minorRadius
Point3D origin, Direction dirZ, double majorRadius, double minorRadius
Another important point is the visualization of the different objects inside the datamodel. We should consider using PyVista for this task. Points to be taken into account for this task:
plotting
subpackageScenePlotter
or similar (please don't use my name suggestion ๐): users will be able to pass in several objects and plot them all togetherplot()
function. This function should be defined as abstract in the BaseObject class and implemented downstream in each objectPlease consider the following location for the plotting
subpackage:
The following lines need to be removed.
https://github.com/pyansys/pygeometry/blob/3db2614435903e289779b1028311da25faf8f626/src/ansys/geometry/core/math/vector.py#L256-L257
We can check with is_zero
wherever it is needed. For instance in the arc modules, when getting vectors from points to calculate the angle, the is_zero
can be used.
Once the ansys-api-geometry
package is published (in the PyAnsys private PyPi for now) we can start consuming and removing the existing auto-generated Python files from the repository.
As per DBU request, we should allow to overload operators for VectorXD operations
a * b
a @ b
, or a ^ b
, or a % b
We should also have a three point builder. Basic trigonometry as well. But we may want to leave that for a different PR? Do you see it could be feasible to implement it in this one?
It should be something like:
@classmethod
def from_three_points(start, mid, end):
...
Originally posted by @RobPasMue in #81 (comment)
The Polygon
class is one of the basic classes we need to be able to create. Basic constructor for DBU is exposed in #13.
Consider using their constructor and storing those properties as instance attributes.
For example, would like to evaluate each value of numpy array against a specific tolerance value.
Minimum constructor
Point3D start, Point3D end
As @akaszynski mentioned, most of the capabilities related with units and its methods are the same everywhere but we are duplicating code. Let's consider extending from a common PhysicalQuantity
class (or similar name) that handles units for our base objects.
During our meeting with the DBU we realized that when building a LineSketch
object we are not double checking that (for example):
CreateNamedSelection should most likely be a method on the Design class.
The grpc endpoint is CreateNamedSelection in the namedselection.proto.
Maintain a list of active named selections in the Design instance.
Ellipse
, Circle
and Line
are still pending units support. Work on this.
We are not interested for the moment in adding the poetry.lock
file. However, this file could be uploaded as an artifact in the CI/CD when installing the package.
As @jorgepiloto pointed out, it may be better to just remove support for setters. Specially for complex objects (Shapes, primitives etc) depending on more basic objects (math module). This is open to discussion.
If we remove setter support I'd remove them from all places, including math
subpackage. What do you think @chadqueen @jorgepiloto @MaxJPRey @Revathyvenugopal162.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.