cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

[SVG] The user should be able to provide the units of measurement for an svg

Open giannissc opened this issue 2 years ago • 7 comments
trafficstars

Closes: #1323

CC: @voneiden

giannissc avatar Apr 25 '23 11:04 giannissc

How does this relate to this existing draft PR?

jmwright avatar Apr 25 '23 11:04 jmwright

Codecov Report

Merging #1325 (c85154e) into master (3b9ead1) will decrease coverage by 0.11%. The diff coverage is 100.00%.

:exclamation: Current head c85154e differs from pull request most recent head f63eccf. Consider uploading reports for the commit f63eccf to get more accurate results

@@            Coverage Diff             @@
##           master    #1325      +/-   ##
==========================================
- Coverage   94.24%   94.14%   -0.11%     
==========================================
  Files          26       26              
  Lines        5495     5485      -10     
  Branches      932      929       -3     
==========================================
- Hits         5179     5164      -15     
- Misses        187      189       +2     
- Partials      129      132       +3     
Impacted Files Coverage Δ
cadquery/occ_impl/exporters/svg.py 91.81% <100.00%> (-4.85%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Apr 25 '23 11:04 codecov[bot]

I wasn't actually aware of that PR @jmwright

giannissc avatar Apr 25 '23 11:04 giannissc

Since this is such a small and straightforward change should we get this merged? @voneiden, @jmwright

giannissc avatar May 02 '23 12:05 giannissc

@lorenzncode what do you think? Do you want to finish your PR first?

adam-urbanczyk avatar May 02 '23 17:05 adam-urbanczyk

I find this PR breaks SVG export with exporters.export. For example in the following width is not respected.

cq.exporters.export(result, "out.svg", opt={"width":100})

This PR adds a units parameter but I don't see where the units are put to use. In #1317 it looks like the idea is to influence scaling.

I'd also like to have optional control of the scale and that is one of the features of #1277.

lorenzncode avatar May 05 '23 01:05 lorenzncode

Right now this has nothing to do with scaling. uom is used internally to set the scaling factor. What I changed here is the ability of the user to explicitly set the unit of measure instead of the current heuristic which works like this: <0.1 must be inches and >10 must be millimeter. I am preparing a separate PR for the scaling changing for which I will be taking a look at your PR to combine them @lorenzncode

giannissc avatar May 05 '23 07:05 giannissc