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

Dui3 124 receiving curves arcs ellipses nurbs curves #3521

Merged

Conversation

KatKatKateryna
Copy link
Contributor

Description & motivation

Changes:

To-do before merge:

Screenshots:

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

@clairekuang clairekuang self-assigned this Jun 25, 2024
@clairekuang
Copy link
Member

Just a general comment: it would be good to align the ArcGIS converter project to have the same structure as the other DUI3 connectors: [Connector] > ToSpeckle / ToHost > [Speckle namespace, eg Geometry] / Raw > converter. Currently ArcGIS is organized like ArcGIS > [ArcGIS type, eg Feature] > converter (for to host, to speckle, and raw)


if (angleStart == null || fullAngle == null || radius == null)
if (
target.plane.normal.x != 0 || target.plane.normal.y != 0 || target.plane.xdir.z != 0 || target.plane.ydir.z != 0
Copy link
Member

Choose a reason for hiding this comment

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

Here it looks like you're checking for xy planarity on the world xy plane: if arcgis can't support xy planar curves on other planes (z is non-zero), then the exception message should be more specific since 2d arc can mean planar arcs on planes in any 3d orientation

Copy link
Member

Choose a reason for hiding this comment

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

Also, just a caution that we can't guarantee that the plane property is always accurate: the absolute safest way to test for planarity is to check the start and end points

@@ -28,6 +28,12 @@ public ACG.Polyline Convert(SOG.Circle target)
{
throw new SpeckleConversionException("Conversion failed: Circle doesn't have a radius");
}
if (
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as for arcs

Copy link
Member

Choose a reason for hiding this comment

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

Since there's no direct conversion from Speckle Curve to a native element and you're just converting the displayvalue, my preference is to remove this converter and use fallback conversion for Speckle Curves.

if (target.firstRadius == null || target.secondRadius == null)
{
throw new SpeckleConversionException("Conversion failed: Ellipse doesn't have 1st and 2nd radius");
throw new ArgumentException("Invalid Ellipse provided");
Copy link
Member

@clairekuang clairekuang Jun 27, 2024

Choose a reason for hiding this comment

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

More specific exception here: "Ellipse is missing a first or second radius" eg

);

pointsOriginal.Add(pointOnEllipse);
throw new ArgumentException("Only 2d-Ellipse shape is supported");
Copy link
Member

Choose a reason for hiding this comment

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

same comment as arc/circle

{
pointsOriginal.Add(pointsOriginal[0]);
majorAxeRadius = (double)target.secondRadius;
Copy link
Member

Choose a reason for hiding this comment

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

typo, majorAxisRadius


// reverse new segment if needed
if (points.Count > 0 && newPts.Count > 0 && points[^1] != newPts[0] && points[^1] == newPts[^1])
if (
Copy link
Member

Choose a reason for hiding this comment

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

This should take into account the edge case where the first segment is reversed - super annoying but can't assume that the first polycurve segment endpoint is correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this line is checking for this edge case, no?

Copy link
Member

Choose a reason for hiding this comment

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

concluded that we should throw here if segments are incorrectly oriented, instead of attempting to reverse them

Copy link
Member

@AlanRynne AlanRynne 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 fine code-wise, but won't this heavily conflict with your other PRs?

Not sure we should be keeping an order of merging @KatKatKateryna

@KatKatKateryna
Copy link
Contributor Author

@AlanRynne only 1 draft PR is waiting for these changes, will only affect several files. The other PRs are not touching converters. After @clairekuang approves requested changes, can be safely merged (blocked atm)

@KatKatKateryna KatKatKateryna enabled auto-merge (squash) July 1, 2024 16:54
@KatKatKateryna KatKatKateryna merged commit a71d37d into dui3/alpha Jul 1, 2024
33 checks passed
@KatKatKateryna KatKatKateryna deleted the DUI3-124-Receiving-Curves-Arcs-Ellipses-Nurbs-Curves branch July 1, 2024 17:40
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.

3 participants