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

Scale in 2 dimensions changes a Rectangle from PLANE to BSPLINE #167

Closed
bernhard-42 opened this issue Mar 9, 2023 · 2 comments
Closed

Comments

@bernhard-42
Copy link
Collaborator

with bd.BuildSketch() as s:
    bd.Rectangle(1,2)
    bd.Scale(by=(2,1,0))

returns

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [3], line 5
      3 with bd.BuildSketch() as s:
      4     bd.Rectangle(1,2)
----> 5     bd.Scale(by=(2,1,0))

File ~/Development/build123d/src/build123d/build_generic.py:520, in Scale.__init__(self, by, mode, *objects)
    515         new_object = obj_at_origin.transform_geometry(scale_matrix).locate(
    516             current_location
    517         )
    518     new_objects.append(new_object)
--> 520 context._add_to_context(*new_objects, mode=mode)
    522 super().__init__(Compound.make_compound(new_objects).wrapped)

File ~/Development/build123d/src/build123d/build_sketch.py:140, in BuildSketch._add_to_context(self, mode, *objects)
    138         obj.position = obj.position - Vector(0, 0, obj.position.Z)
    139     if isinstance(obj, Face) and not obj.is_coplanar(Plane.XY):
--> 140         raise ValueError("Face not coplanar with sketch")
    142 pre_vertices = (
    143     set()
    144     if self.sketch_local is None
    145     else set(self.sketch_local.vertices())
    146 )
    147 pre_edges = (
    148     set() if self.sketch_local is None else set(self.sketch_local.edges())
    149 )

ValueError: Face not coplanar with sketch

If you debug it, you see that it is coplanar, however a BSPLINE instead of a PLANE.

I think it is the same problem as #80

@gumyr
Copy link
Owner

gumyr commented Mar 10, 2023

Thanks! It's a pain that transform_geometry changes the object the way it does. I'll have to change Face.is_coplanar() to not use the geometry.

@gumyr
Copy link
Owner

gumyr commented Mar 11, 2023

Fixed with 8b3141b

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

No branches or pull requests

2 participants