Skip to content

Draft: importSVG - Approximation to arcs and lines#29142

Merged
Roy-043 merged 1 commit intoFreeCAD:mainfrom
tarman3:svg_deviation
Apr 15, 2026
Merged

Draft: importSVG - Approximation to arcs and lines#29142
Roy-043 merged 1 commit intoFreeCAD:mainfrom
tarman3:svg_deviation

Conversation

@tarman3
Copy link
Copy Markdown
Contributor

@tarman3 tarman3 commented Apr 7, 2026

Curves Ellipse, Hyperbola, Parabola, BezierCurve and BSplineCurve creates a lot of problems and complicates work process in CAM workbench

  • Shape which looks like circle can be not a real circle and do not contains important information (center point, diameter)
  • Surfaces is not really 'flat' while vertical extrusion from such curves
    Screenshot_20260408_100817_lossy

Suggest to add ability to approximate such edges to Part.Arc(s) and Part.Line(s) while import geometry from svg files

New property svgDeviation is used to adjust accuracy
Value 0.0 disable approximation feature


Note

Method approximateWire() already present in src/Mod/CAM/Path/Op/Util.py,
but I do not know good way to exclude code duplication and do not add additional dependencies between CAM and Draft


Screenshot_20260414_125846_lossy ksnip_20260407-133811_lossy

@github-actions github-actions bot added the Mod: Draft Related to the Draft Workbench label Apr 7, 2026
App.closeDocument(hidden_doc.Name)
except:
FreeCAD.closeDocument(hidden_doc.Name)
except Exception:
@maxwxyz maxwxyz added the Type: Feature FR for improvements or new features label Apr 7, 2026
@maxwxyz maxwxyz added this to the 1.2 milestone Apr 7, 2026
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Apr 7, 2026
@tarman3
Copy link
Copy Markdown
Contributor Author

tarman3 commented Apr 7, 2026

@maxwxyz
Changes in Draft, but related to CAM
Please add label CAM also

Thank you

@maxwxyz maxwxyz added the Mod: CAM Related to the CAM Workbench label Apr 7, 2026
@tarman3 tarman3 marked this pull request as ready for review April 12, 2026 06:44
Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui Outdated
Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui Outdated
Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui Outdated
Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui Outdated
Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui
Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui Outdated
@github-project-automation github-project-automation bot moved this from Merge Meeting to Queue in Merge Queue Apr 13, 2026
@tarman3 tarman3 force-pushed the svg_deviation branch 2 times, most recently from 25ed35b to c617b16 Compare April 13, 2026 13:09
@tarman3 tarman3 requested a review from Roy-043 April 13, 2026 13:15
@Roy-043
Copy link
Copy Markdown
Contributor

Roy-043 commented Apr 13, 2026

I have tested the code now. It works fine for wires, but not for faces. That seems strange to me. Faces ('fills') are quite common in SVG files I think.

@tarman3 tarman3 force-pushed the svg_deviation branch 4 times, most recently from 74661c8 to a357b56 Compare April 13, 2026 18:40
@tarman3 tarman3 marked this pull request as draft April 13, 2026 18:56
@tarman3 tarman3 force-pushed the svg_deviation branch 3 times, most recently from cff98ff to 04f9264 Compare April 14, 2026 06:09
@tarman3
Copy link
Copy Markdown
Contributor Author

tarman3 commented Apr 14, 2026

I have tested the code now. It works fine for wires, but not for faces.

Hope fixed now

@Roy-043
Copy link
Copy Markdown
Contributor

Roy-043 commented Apr 14, 2026

I have taken the liberty of slightly editing the ui file:

  • Adjusted the line breaks of the new tooltip.
  • Removed the "buddy" properties.

Comment thread src/Mod/Draft/Resources/ui/preferences-svg.ui
@Roy-043
Copy link
Copy Markdown
Contributor

Roy-043 commented Apr 14, 2026

Thanks for updating the code to also handle faces. Your solution works fine. Note that there is also a Bullseye face maker. It may be worth testing if it can be used here. It should handle island wires automatically.

Part.makeFace(wires, "Part::FaceMakerBullseye")

@tarman3 tarman3 force-pushed the svg_deviation branch 2 times, most recently from e6523cf to fcdd60e Compare April 14, 2026 10:24
@tarman3
Copy link
Copy Markdown
Contributor Author

tarman3 commented Apr 14, 2026

Thanks
Is something new for me and this solution is much shorter

@tarman3 tarman3 requested a review from Roy-043 April 14, 2026 10:36
@Roy-043 Roy-043 marked this pull request as ready for review April 15, 2026 10:24
@Roy-043 Roy-043 added Approved: Code Quality The PR was checked for code quality and approved Approved: Tested The PR was manually tested and approved labels Apr 15, 2026
@Roy-043 Roy-043 enabled auto-merge (squash) April 15, 2026 10:25
@Roy-043 Roy-043 merged commit 59e1914 into FreeCAD:main Apr 15, 2026
26 of 27 checks passed
@github-project-automation github-project-automation bot moved this from Queue to Done in Merge Queue Apr 15, 2026
@tarman3 tarman3 deleted the svg_deviation branch April 15, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved: Code Quality The PR was checked for code quality and approved Approved: Tested The PR was manually tested and approved Mod: CAM Related to the CAM Workbench Mod: Draft Related to the Draft Workbench Type: Feature FR for improvements or new features

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants