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

Add support for viewBox #12

Open
amcewen opened this issue May 12, 2021 · 6 comments
Open

Add support for viewBox #12

amcewen opened this issue May 12, 2021 · 6 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@amcewen
Copy link
Contributor

amcewen commented May 12, 2021

(feature request) At present the viewBox attribute of the svg elements is ignored, which can result in things ending up the wrong size.

@amcewen
Copy link
Contributor Author

amcewen commented May 12, 2021

I've got a working (for the handful of SVGs I've tried it with) implementation on my fork.

I'm not sure if the parsing out of the numbers in the viewBox element is robust enough (lines 48-53 in that commit) - is there an example elsewhere in the parser I can crib for parsing numbers that can include negative and exponentials?

Also having a brain fade on running the tests. How should I be trying to run them? I'm getting an error at the moment...

adrian@DeltaS4:~/sandbox/github/SvgToGcode/testing$ python3 automated_testing.py 
Traceback (most recent call last):
  File "automated_testing.py", line 2, in <module>
    from testing import comparison_tests, other_tests
ModuleNotFoundError: No module named 'testing'

Happy to submit a PR once I've worked out how to test things 😀

@PadLex
Copy link
Owner

PadLex commented May 13, 2021

Hey, thank you for doing all this!

I really should do a better job of documenting the testing process 😅. In this case, I'm guessing the issue is that the working directory is named SvgToGcode as opposed to svg_to_gcode. Once you get the tests working you can add an svg containing the most overcomplicated combination of viewbox's you can think of to the example folder.

Let me know if you have any luck.

@PadLex PadLex added documentation Improvements or additions to documentation enhancement New feature or request labels May 13, 2021
@amcewen
Copy link
Contributor Author

amcewen commented May 13, 2021

Thanks. Seems to need me to add the repo's root folder to my PYTHONPATH (or in my case, define a PYTHONPATH first 😄) Got the tests running now, which has shown I forgot to add default values for the rotation centre in #13 🤦

Will fix that, and find an example of the viewbox stuff later.

@PadLex
Copy link
Owner

PadLex commented May 13, 2021

How odd, I wonder why that would be. Glad the tests are doing their job though. Good luck!

@PadLex
Copy link
Owner

PadLex commented Jun 16, 2021

Hey there, any success with view boxes?

@amcewen
Copy link
Contributor Author

amcewen commented Jul 16, 2021

Hello! Got snowed under with other stuff, so hadn't had chance to pull together a test file until today.

Running the tests it fails on hiking.svg, but that seems to be caused by #18.

Mindful of submitting a PR to fix too many issues (and on getting sidelined before I get the PR submitted) I'll submit one to fix both this and #13 anyway, with the failing hiking.svg (but new test files for viewBox and the rotation).

(I can work them up into separate PRs if need be, but it'll need to annoying git wrangling I'm hoping I can get away without 😁)

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 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants