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

Bevel Tool Supporting Lines For Constrained Points #389

Open
TheMakerTales opened this issue Jun 8, 2023 · 5 comments
Open

Bevel Tool Supporting Lines For Constrained Points #389

TheMakerTales opened this issue Jun 8, 2023 · 5 comments
Labels
Bounty - Small https://www.cadsketcher.com/cad-sketcher-bounty-board
Milestone

Comments

@TheMakerTales
Copy link
Collaborator

Currently, when adding a bevel to a point that already has a dimensional constant it's behavior is this:

Capture1

Let's add some supporting construction like creation for point that are beveled that are already constrained in some way like this:

Capture

I'm unsure if this should be "automatic" behavior, toggleable or modifier key initiated i.e. pressing shift while using the bevel tool

@TheMakerTales TheMakerTales added this to the 1.0 Release milestone Jun 8, 2023
@TheMakerTales
Copy link
Collaborator Author

Just to be clear the resulting construction lines should be parallel to the original line thus supporting lines in any orientation.

@hlorus hlorus added the Bounty - Small https://www.cadsketcher.com/cad-sketcher-bounty-board label Dec 11, 2023
@TimStrauven
Copy link
Contributor

TimStrauven commented Apr 18, 2024

This behavior is linked to:
Cannot set Distance constraint to horizontal or vertical for lines [BUG] #459
It should be half solved if the PR on it is accepted:
Checks for duplicate constraints. #461

The reason it happened is also because the distance constraint is set onto the line instead of its endpoints.
New behavior after merge of that PR would look like this:
image

So if the bevel tool would then add a coincident from the point to each line (and as TheMakerTales suggested maybe the two construction lines) it should be solved as well I think.

@TimStrauven
Copy link
Contributor

If you add the following else statement to "operators/bevel.py" at line 138 after the existing if statement it seems to do what it is supposed to:

        # Remove original point if not referenced
        if not is_entity_referenced(point, context):
            context.scene.sketcher.entities.remove(point.slvs_index)
        else:
            ssc.add_coincident(point, seg1, sketch)
            ssc.add_coincident(point, seg2, sketch)

This works for keeping the reference to arcs as well:
image

If the construction lines need to be added as well extra checks need to be done on the entities since that should not be done on arcs but only lines.

@hlorus
Copy link
Owner

hlorus commented Apr 19, 2024

Good catch, can you open a PR?

@TimStrauven
Copy link
Contributor

TimStrauven commented Apr 19, 2024

If you also want the lines to be added, this seems to work well and I think it fully covers the initial request:

        # Remove original point if not referenced
        if not is_entity_referenced(point, context):
            context.scene.sketcher.entities.remove(point.slvs_index)
        else:
            ssc.add_coincident(point, seg1, sketch)
            ssc.add_coincident(point, seg2, sketch)

            # add reference construction lines
            sse = context.scene.sketcher.entities
            for i in range(0, 2):
                if isinstance(self.connected[i], SlvsLine2D):
                    target = sse.add_line_2d(point, self.points[i], sketch)
                    target.construction = True
                elif isinstance(self.connected[i], SlvsArc):
                    target = sse.add_arc(sketch.wp.nm, self.connected[i].ct, self.points[i], point, sketch)
                    target.construction = True
                    if target.angle > HALF_TURN:
                        target.invert_direction = True

image
image
image
image

Would you prefer it this way or rather without the construction lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bounty - Small https://www.cadsketcher.com/cad-sketcher-bounty-board
Projects
None yet
Development

No branches or pull requests

3 participants