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

Draft: snap intersection hangs indefinitely freecad #13797

Open
2 tasks done
alafr opened this issue May 2, 2024 · 3 comments
Open
2 tasks done

Draft: snap intersection hangs indefinitely freecad #13797

alafr opened this issue May 2, 2024 · 3 comments
Labels
3rd party: OCC Bug This issue or PR is related to a bug Snapping WB Draft Related to the Draft Workbench WB Part Related to the Part Workbench

Comments

@alafr
Copy link
Contributor

alafr commented May 2, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

Open attached file
View > Fit All
Enable Draft snap on intersection
Draw a line and approach the shape
Freecad hangs indefinitely

snap intersection bug.zip

Full version info

OS: Windows 10 build 19045
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37094 (Git)
Build type: Release
Branch: alaf-test
Hash: 779c8949d37ae996cc59a11d373fa518b8a0d094
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: French/France (fr_FR)
Installed mods: 
  * ArchTextures
  * BIM
  * Curves 0.6.14
  * Defeaturing 1.2.1
  * DynamicData 2.60.0
  * Trails 2022.1.0


[code]
OS: Windows 10 build 19045
Word size of FreeCAD: 64-bit
Version: 0.21.2.33771 (Git)
Build type: Release
Branch: releases/FreeCAD-0-21
Hash: b9bfa5c5507506e4515816414cd27f4851d00489
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: French/France (fr_FR)
Installed mods: 
  * ArchTextures
  * BIM
  * Curves 0.6.14
  * Defeaturing 1.2.1
  * DynamicData 2.60.0
  * Trails 2022.1.0
[/code]

Subproject(s) affected?

Draft

Anything else?

The problem happens in edge1.distToShape(edge2) here
Snap works fine if I replace

        dist, pts, geom = edge1.distToShape(edge2)
        sol = []
        if round(dist, precision()) == 0:
            for p in pts:
                if p[0] not in sol:
                    sol.append(p[0])
        return sol

with

        sol = []
        section = edge1.section(edge2)
        for vertex in section.Vertexes:
            sol.append(vertex.Point)
        return sol

Of course fixing distToShape would be better

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maxwxyz maxwxyz added Bug This issue or PR is related to a bug WB Draft Related to the Draft Workbench Snapping labels May 2, 2024
@Roy-043
Copy link
Contributor

Roy-043 commented May 2, 2024

This is not a Draft issue as such. I suspect it is the degree of the B-splines (the edges are B-splines with a degree of 1) that is the culprit.

@Roy-043 Roy-043 added WB Part Related to the Part Workbench 3rd party: OCC labels May 2, 2024
@alafr
Copy link
Contributor Author

alafr commented May 2, 2024

Those lines are a section between a plane and a ruled surface. Here is their parametric history:
snap intersection bug history.zip

There is no issue with 1 degree Bsplines created in Draft.

@Roy-043
Copy link
Contributor

Roy-043 commented May 3, 2024

You are right. The number of knots is large, that may be the cause instead.
sub.Curve.NbKnots => 947

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party: OCC Bug This issue or PR is related to a bug Snapping WB Draft Related to the Draft Workbench WB Part Related to the Part Workbench
Projects
None yet
Development

No branches or pull requests

3 participants