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

Wire_obj ^ 2 should throw an error, I think #763

Open
KilowattSynthesis opened this issue Nov 5, 2024 · 4 comments
Open

Wire_obj ^ 2 should throw an error, I think #763

KilowattSynthesis opened this issue Nov 5, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@KilowattSynthesis
Copy link

My understanding is that the caret operator, which is an overload for Wire.location_at() (or any other object which inherits from Mixin1D), accepts an argument where 0 <= distance <= 1 when position_mode = PositionMode.PARAMETER (the default).

If this is true, calling the caret operator with a 2nd-operand greater than 1 should be invalid, and should raise an error instead of acting silently.

This will help people's understanding of what the function does, and may help catch bugs as well.

@gumyr gumyr added the wontfix This will not be worked on label Nov 5, 2024
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Nov 5, 2024
@gumyr
Copy link
Owner

gumyr commented Nov 5, 2024

No. Although normally u, v values have the range of 0.0 - 1.0 one can legitimately use values outside of this range as the underlying curve object is valid beyond these end points.

@KilowattSynthesis
Copy link
Author

Maybe this is a documentation request then, which explains how that works.

What happens when one does polyline ^ 2? Does it just extend the closest-to-the-end line segment?

@gumyr
Copy link
Owner

gumyr commented Nov 5, 2024

Let's try and find out:

from build123d import *
from ocp_vscode import show_all

path1 = Polyline((0, 1, 0), (4, 1, 0), (4, 4, 0))
p1 = path1 ^ -1
p2 = path1 ^ 2

path2 = Spline((-2, 6), (0, 2), (2, 6))
p3 = path2 @ -1
p4 = path2 @ 2

show_all()

image

Within the kernel all lines are represented by an OCCT Geom_Curve which is "trimmed" to a given start and end point. When a user asks for u values outside of 0.0-1.0 they are simply requesting values on the base Geom_Curve.

Maybe a user would like to align text to a line and it goes a little off one or both ends - allowing values outside of the 0.0 to 1.0 range enables this. I don't recommend users do this unless they understand what they are doing though.

@KilowattSynthesis
Copy link
Author

Thanks, I think that's a helpful example. Would be awesome to be able to create a similar clear example that could go in the docs!

@gumyr gumyr added documentation Improvements or additions to documentation and removed wontfix This will not be worked on labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants