Git Product home page Git Product logo

pyansys-geometry's Issues

Adapt Sketch to use 2D objects when drawing/sketching

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:

  • Ensure that all shapes (i.e. 2D objects) are generated from purely 2D elements (i.e. Point2D, Vector2D...).
  • Ensure that the Sketch class is adapted to the new shape constructors.
  • Ensure that when requesting the 3D points, these are generated properly (for plotting, sending over to the server...).
  • Ensure that the examples are properly adapted, as well as the documentation.
  • We should delegate the generation of plotting points to PyVista. And only handle on our side those points that are important for the Shape itself (i.e. box == 4 corner points)

Add primitive 3D Plane model

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

Add sphere 3D geometry primitive

SpaceClaim constructors for reference:

Sphere(Point3D origin, Direction dirX, Direction dirY, double radius)
Sphere(Point3D origin, double radius)

Send over a Sketch to the server

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.

  • Figure out how to send the sketch.
  • Wrap the gRPC stubs to send the information in an orderly manner.
  • Validate that the different sketch elements are created consistently on the server side.

API documentation is not linking correctly

It looks like we may have an issue... Sphinx does not link correctly to our package classes amongst themselves.

For example:
image

Here, Point3D should be clickable. Let's try and solve this.

Add ``Box`` shape to ``ansys.geometry.core.shapes`` subpackage

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.

PyGeometry first draft

Let's get a first version of the Geometry client out!

Related tasks:

  • Create a base repository + docs repos for getting things started
  • Implement basic entity objects. Linked to #13
  • Implement units handling using pint. Linked to #2
  • Create a plotting module for visualizing the entity objects. Linked to #3
  • Create a math/algebra module for operations with entity objects. Linked to #13
  • Conceive a simple client to connect to a gRPC server. Linked to #36
  • Add tests
  • Add documentation: API reference automatically generated + basic PyAnsys sections. Linked to #5
  • Add examples. Linked to #4

Implement logger

We need to implement a logger. Follow approach from PyDiscovery and PyMAPDL. This module may be easily migrated from these repositories.

Classes to prototype

Basic Math Capabilities

  • Point #16
  • Vector3D #18
  • VectorUV #18
  • Direction (Unit Vector) #16
  • Matrix #40

2D Geometry

3D Geometry

Misc

  • BBox #21 (NOT A PRIORITY)
  • Interval #22 (NOT A PRIORITY)
  • Frame #51
  • Accuracy (operation tolerance (e.g. Point3D == Point3D or Point3d.is_equal(<other point, tol=1E-5) #35

Units

  • Metric
  • Imperial
  • pint

Additional requirements

  • Null state (e.g. initialized with Point3D())

Start the ``units`` subpackage

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!

  • Implement the units module
  • Create a `Quantity`` (enum) class handling the units accepted
  • Create a Conversion class which will contain a Quantity (enum) value and a conversion factor
  • Implement units inside the datamodel.objects package
  • All units inside the objects must be stored in SI, but users will be able to provide different Quantity values. Conversions should be handled in construction and representation. Inside operations and operations between objects will always take place in SI
  • Add testing (must be intensive, this is a critical module)
  • Add documentation

See the following picture for having an idea of the location of the units subpackage
image

Differentiate between ``BoundedCurves`` and ``UnboundedCurves``

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.

Move ``ansys.discovery.core.models.geometry`` package to PyGeometry

@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!

  • Migrate the base GRPCWrapper class (and change name to BaseObject
  • Migrate the geometry subpackage
  • Remove all gRPC pydiscovery-specific implementations (i.e. the _update_message/_from_message implementations)
  • Structure it as proposed in the first meeting we had (see image below)
  • Include testing
  • Add classes to the documentation

image

Add connection module exposing grpc server implementation

As a developer, I would like an encapsulated abstraction providing:

gRPC abstraction layer

  • Stateless pass-through wrapper layer to grpc stubs with method signatures derived from ansys.geometry.core model entities

Server connection management

  • Management of existing connections
  • Reconnect management
  • Establish connection to specific endpoint

Create ``Arc`` curve

The Arc is one of the basic curves we need to be able to create. Basic constructor for DBU is exposed in #13.

  • The arc should extend from a Circle if possible since it is basically a subset of points
  • Allowing to create an arc from three points as @MaxJPRey suggested in #13 is also a possibility. Consider creating this @classmethod as well.

Add method to find angle between 2 vectors.

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

Implement ``transformations`` module

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:

  • Scale matrices
  • Translation matrices
  • Rotation matrices

And their operations. All these computations can occur on the client side. Thanks for the suggestion @jorgepiloto!

Implement the Spline object

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.

Add Accuracy class for equivalency evaluations

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;

Create ``Frame`` class

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.

  • Consider using the DBU constructor - its inputs should be stored as instance attributes.
  • Consider other potential constructors (if any)
  • Consider migrating PyDiscovery implementation for ease of task (there is already a Frame class there)

Add Torus Geometry 3D primitive

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

Implement ``plotting`` subpackage

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:

  • Implement the plotting subpackage
  • Consider the creation of a ScenePlotter or similar (please don't use my name suggestion ๐Ÿ˜„): users will be able to pass in several objects and plot them all together
  • All datamodel objects should implement a plot() function. This function should be defined as abstract in the BaseObject class and implemented downstream in each object
  • Create a PyGeometry plotting theme so that we do not use the default PyVista theme
  • Add documentation
  • Add testing

Please consider the following location for the plotting subpackage:
image

Overload ``VectorXD`` operators

As per DBU request, we should allow to overload operators for VectorXD operations

  • Dot product: a * b
  • Cross product: a @ b, or a ^ b, or a % b

Create a three point builder for arc shape.

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)

Add `Polygon` curve

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.

Increase robustness of ``Line``

During our meeting with the DBU we realized that when building a LineSketch object we are not double checking that (for example):

  • The points are not the same
  • The units of the points should be checked (if they are different, fall back to PyGeometry's default units)
  • ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.