diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a21f2e5..85812fb10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Arc: reverse * BSplineCurve2D: offset * Circle2D: bsplinecurve_intersections, point_distance +* Add dimensionned surface3D ### Fixed @@ -58,7 +59,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * WiriMixin: from points: general method for Wire3D and 2D and for Contour2D and 3D. * ConicalSurface3D, CylindricalSurface3D: plot method - ### Fixed * WireMixin: abscissa (add tolerance as parameter) diff --git a/volmdlr/faces.py b/volmdlr/faces.py index ae3351ae8..3a4595f8d 100644 --- a/volmdlr/faces.py +++ b/volmdlr/faces.py @@ -1523,7 +1523,18 @@ def point2d_to_3d(self, point2d): def point3d_to_2d(self, point3d): return point3d.to_2d(self.frame.origin, self.frame.u, self.frame.v) + def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D): + """ + Computes the dimentioned surface2D associated to the given parametric surface2d. + """ + return dimensionless_surface2d + def contour2d_to_3d(self, contour2d): + """ + Computes the 3D representation of a given contour2D. + + :param contour2d: The given contour2D + """ return contour2d.to_3d(self.frame.origin, self.frame.u, self.frame.v) def contour3d_to_2d(self, contour3d): @@ -1575,7 +1586,7 @@ class PeriodicalSurface(Surface3D): """ Abstract class for surfaces with two-pi periodicity that creates some problems. """ - + def face_from_contours3d(self, contours3d: List[volmdlr.wires.Contour3D], name: str = ""): """ Returns the face generated by a list of contours. Finds out which are outer or inner contours. @@ -1711,7 +1722,15 @@ def linesegment3d_to_2d(self, linesegment3d): end = volmdlr.Point2D(start.x, end.y) return [vme.LineSegment2D(start, end)] - def arc3d_to_2d(self, arc3d): + def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D): + """ + Computes the dimentioned surface2D associated to the given parametric surface2d. + """ + frame = volmdlr.OXY.copy() + frame.u = self.radius + return dimensionless_surface2d.frame_mapping(frame, side='old') + + def arc3d_to_2d(self, arc3d: vme.Arc3D): start = self.point3d_to_2d(arc3d.start) end = self.point3d_to_2d(arc3d.end) @@ -2327,6 +2346,12 @@ def point3d_to_2d(self, point3d): phi = 0.0 return volmdlr.Point2D(theta, phi) + def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D): + frame = volmdlr.OXY.copy() + frame.u = self.R + frame.v = self.r + return dimensionless_surface2d.frame_mapping(frame, side='old') + @classmethod def from_step(cls, arguments, object_dict, **kwargs): """ @@ -3046,6 +3071,12 @@ def point3d_to_2d(self, point3d): return volmdlr.Point2D(theta, phi) + def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D): + frame = volmdlr.OXY.copy() + frame.u = self.radius + frame.v = self.radius + return dimensionless_surface2d.frame_mapping(frame, side='old') + def linesegment2d_to_3d(self, linesegment2d): if linesegment2d.name == "construction": return []