microsoft / microsoft/maker.js
Import with `fromSVGPathData` breaks circle/arc.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 302
- Avg merge
- 21h 28m
- Merged PRs (30d)
- 5
Description
What is happening
When using fromSVGPathData to generate a model from the string M77.497 2.497a75 75 0 0 1 0 150 75 75 0 0 1 0-150z, makerJS incorrectly imports the shape as a half-circle. It produces the following pathdata:
{ paths:
{ p_1:
Arc {
radius: 75,
origin: [Array],
startAngle: 270,
endAngle: 450,
type: 'arc' },
p_2: Line { type: 'line', origin: [Array], end: [Array] } } }
When exported to DXF this shows:

What is expected
In the browser (tested on chrome, firefox, latest), the PathData M77.497 2.497a75 75 0 0 1 0 150 75 75 0 0 1 0-150z produces a full circle:

Also, adding an extra a in the PathData string results in the same shape in the browser, and a correct full circle model in MakerJS:
Bad: M77.497 2.497a75 75 0 0 1 0 150 75 75 0 0 1 0-150z
Good: M77.497 2.497a75 75 0 0 1 0 150 a 75 75 0 0 1 0-150z
MakerJS converts the pathData with the extra a to a model correctly:
{ paths:
{ p_1:
Arc {
radius: 75,
origin: [Array],
startAngle: 270,
endAngle: 450,
type: 'arc' },
p_2:
Arc {
radius: 75,
origin: [Array],
startAngle: 90,
endAngle: 270,
type: 'arc' } } }
Samples
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the fromSVGPathData entry point and reproduce the reported path M77.497 2.497a75 75 0 0 1 0 150 75 75 0 0 1 0-150z, comparing it with the version containing an extra a. Done means the original path imports as a full circle with two Arc paths and exports correctly to DXF, matching the browser result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100