Jump to content
You must now use your email address to sign in [click for more info] ×

Need Help Placing SVG in Designer At Correct Scale - Comes In Too Large


Recommended Posts

I am testing the SVG export function added to Alibre Design v25 Beta. The files will be used in Shaper Origin CNC router but need to be edited in Affinity Designer to apply color coding to the stroke and fill for Origin to interpret the type of cut to perform. I am also joining the ends of all strokes that make closed figures, otherwise Origin will interpret it as a single line cut.

The issue I am seeing is when I place the exported file from Alibre into a new document in ADe the scale/size is too large. The steps I need to take to get the correct size is:

  1. Start with the Doc settings at 72 DPI.
  2. Place the SVG file in the doc.
  3. Edit the embedded document and copy all the layers.
  4. Switch back to front page and paste the copied layers.
  5. Delete the original Placed file.
  6. Move the file to 0,0.
  7. Change the DPI to 96.

So why doesn't the file come in at the correct size in the first place?

I am attaching a test file and the color coding needed for Shaper Origin. The Smiley file should be 12 inches in diameter, the inset circle is 10.5 inches diameter.

 

 

Origin Color Coding.png

SVG Smiley.SVG

Link to comment
Share on other sites

2 hours ago, HaroldL said:

The Smiley file should be 12 inches in diameter, the inset circle is 10.5 inches diameter.

The file has 16 inches in diameter, aka the outer circle has 16 inches in diameter (and a radius of 8 inches).

Other than that see also related to different apps ...

 

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

So, as I understand it, the issue is that different apps have their own default DPI settings. And without any consistency I need to make some adjustments when importing SVG files into a Designer doc.  It looks like the process I worked will have to become my workflow for editing the SVG files for Origin. BTW, the resulting file is exported at 72 DPI.

Link to comment
Share on other sites

1 hour ago, iconoclast said:

90 DPI

90?

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

Quote

Inkscape 0.92: The default resolution was changed from 90dpi to 96dpi, to match the CSS standard.

 

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

The file is good, as in it has all the sketch figures selected to export and the resulting file works on my Origin. I'm just trying to find a way to import it into Designer without having to jump through hoops.

If I import the file into Inkscape, at its 72 dpi, the file comes in correctly scaled/sized and I don't need to adjust anything. So I don't know if the problem is with the export from Alibre or the way Designer imports.

Alibre has not yet published what the dpi of the exported svg is, so there's that too. Not sure if that would help but would be nice to know.

Link to comment
Share on other sites

On 5/28/2022 at 9:59 PM, v_kyr said:

The file has 16 inches in diameter, aka the outer circle has 16 inches in diameter (and a radius of 8 inches).

When I Open that SVG in Designer, or Place it into another file, the bounding box is 16 in. by 16 in. But it looks empty because all the content seems to be at negative pixel locations, outside the bounding box.

That seems odd, but I can't see that I'm doing anything wrong.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

1 hour ago, walt.farrell said:

When I Open that SVG in Designer, or Place it into another file, the bounding box is 16 in. by 16 in. But it looks empty because all the content seems to be at negative pixel locations, outside the bounding box.

That seems odd, but I can't see that I'm doing anything wrong.

...
<circle stroke-width="0.0529166666666667" fill="none" stroke="black" stroke-linecap="round" cx="0" cy="-0" r="81.124184759848333" />
...
<circle stroke-width="0.0529166666666667" fill="none" stroke="black" stroke-linecap="round" cx="0" cy="-0" r="504" />
<circle stroke-width="0.0529166666666667" fill="none" stroke="black" stroke-linecap="round" cx="0" cy="-0" r="576" />
...

The circles and the rest are all moved towards x & y=0 position (see the circle -> cx="0" cy="0" in above SVG code portions), thus the whole is centered around the upper left/top side (0/0) coordinate in ADe.

kreis.jpg.e92ce2f8bf0f1b612e84854fce2bcd81.jpg  --->   kreis2.jpg.980efe35a85be67309d5c7ff61182d38.jpg

Further, the stroke width used in that SVG code is very tiny (stroke-width="0.0529166666666667").

 

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

1 hour ago, BofG said:

Are you sure there is no way to apply the colours within your CAD software to the sketch?

I can define some custom colors in Alibre but I would still need to open the file in Designer to join curves and apply fill color.

 

1 hour ago, BofG said:

Why are they not using absolute units? SVG is perfectly capable of having everything defined in SI or Imperial units.

It might be a good idea to ask Alibre / on their forums the above questions.

I have been submitting issues related to this and other issues found in the Beta. Since this is Alibre's first implementation of SVG Export/Import I suspect there will be some additions or changes to the process. I'll pose the question on the feedback forum to see if SI/Imperial units are feasible. I've already asked about a user selectable export setting but have not heard back from them yet.

Link to comment
Share on other sites

I found out that Alibre is exporting the svg at 96 dpi. So I started to write up a description of the issue I am still seeing but decided to record a video and post that here instead to save me a bunch of typos.

So here is what's happening when I import the svg in to Designer. I had a bit of a brain freeze and called "layers" "files", so we got that too.

 

Link to comment
Share on other sites

You seem to have started recording after you had already added the SVG file to your document.

If that's true, please show us everything from the very beginning, starting with creating the document.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

I possibly found a solution. It's a bit tricky, I confess, and I don't really understand why it works that way:

Create a new document in the size and with the dpi your exported svg has. Then use the "Place Image Tool" to place the svg in that document with just one click. Align it to the center. If you click several times on that imported svg with the Move or the Node Tool, you can release every element of the svg. And the document and its content has the same size and resolution as the svg. Sounds a bit weird, but for me it works.

Link to comment
Share on other sites

3 hours ago, HaroldL said:

I found out that Alibre is exporting the svg at 96 dpi. ...

That doesn't play any role here, since SVG is a web based vector format and it doesn't transport any PPI/DVI settings. Meaning, if you would export from Alibre or Affinity from a setup 72 dpi, 96 dpi, or 300 dpi document, the generated SVG file and it's code will still always look the same for the SVG used sizes/dimensions. - Thus when opening such a plain SVG file (you can inspect this when opening a SVG file inside a text editor) there is no indication/definition in the SVG code under what initial app's document settings (in terms of used doc ppi/dpi) it might has been created!

So when you open/load with Affinity here a SVG file, it doesn't really know under what document ppi/dpi settings that one has been initially created/exported! Instead it uses it's own default doc dpi setting when opening SVG files, which seems to be initially here always then 72 dpi and not 96 dpi (...Inkscape in contrast might use for example initially 96 dpi here for it's app docs).

You can easily test that with Affinity by creating 72/96/300 dpi docs which you then export as SVG. Afterwards load the exported SVGs back into Affinity and look at it's document settings. - Additionally open the generated/exported SVG files with a text editor and compare the generated SVG code inside those SVG files.

BTW in your video you've used an embedded SVG file, aka you seem to have used File -> Place ... to load the SVG file into an Affinity document. - Instead you can always also just directly open (via File -> Open ...) plain SVG files in Affinity, so they are not placed/treated inside as embedded SVG files!

 

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

18 hours ago, v_kyr said:

That doesn't play any role here, since SVG is a web based vector format and it doesn't transport any PPI/DVI settings. Meaning, if you would export from Alibre or Affinity from a setup 72 dpi, 96 dpi, or 300 dpi document, the generated SVG file and it's code will still always look the same for the SVG used sizes/dimensions. - Thus when opening such a plain SVG file (you can inspect this when opening a SVG file inside a text editor) there is no indication/definition in the SVG code under what initial app's document settings (in terms of used doc ppi/dpi) it might has been created!

I could be wrong but I think the dpi has to play a role. I looked at the file in Notepad and noted the width and height. Dividing those numbers by the known size of the part in Alibre (width = 8.0", height = 4.5") gives me the dpi (96) the file was exported as even if it wasn't included in the SVG. The SVG that I export out of Designer doesn't only have to "look" right it has to export an exact size for the CNC router so it can follow a defined path as it cuts material.

52127994_AlibreExportSVG.png.430518a963b6ae4a6c1332c14611a7e2.png

 

18 hours ago, v_kyr said:

BTW in your video you've used an embedded SVG file, aka you seem to have used File -> Place ... to load the SVG file into an Affinity document. - Instead you can always also just directly open (via File -> Open ...) plain SVG files in Affinity, so they are not placed/treated inside as embedded SVG files!

I think this is the key that I was looking for, Thank you.  I was thinking that I could create a template with the correct dpi setting, like I did in Inkscape, then just drop the exported Alibre SVG into it. I could then apply the stroke and fill colors as needed to prep the file for Origin. Apparently not.

By "opening" the Alibre exported SVG, instead of "Placing" it in an open doc, it has reduced my headache a lot. Now, after opening the file I edit the Doc setup and change document units to Inches and change dpi to 96. Then I select all the curves and move them to 0,0, change the stoke width and apply the styles I need, where they're needed then export the SVG to Origin. Still some work but a lot easier than my previous workflow.

 

Link to comment
Share on other sites

23 hours ago, walt.farrell said:

You seem to have started recording after you had already added the SVG file to your document.

If that's true, please show us everything from the very beginning, starting with creating the document.

The only thing I did before starting to record the video was:

  1. Select File>New
  2. Select the 17 X 22 ANSI template
  3. Change the dpi to 96
  4. Select Landscape orientation
  5. Select File>Place
  6. Select the SVG from the dialog that opened
  7. Placed the SVG on the doc as it was shown in the video.

At the time I didn't think any of that was critical enough to record but I should have included it for completeness.

Thanks.

Link to comment
Share on other sites

24 minutes ago, HaroldL said:

I looked at the file in Notepad and noted the width and height. Dividing those numbers by the known size of the part in Alibre (width = 8.0", height = 4.5") gives me the dpi (96) the file was exported as even if it wasn't included in the SVG.

Look into the SVG specs and do a websearch after the topic for SVG and PPI/DPI and read what you will find about that theme there then in terms of this, (for example: "svg does dpi play a role", "svg and dpi" etc.). - Also take a look through this Github postings here then to see the common SVG + DPI related problems.

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

31 minutes ago, HaroldL said:

Placed the SVG on the doc as it was shown in the video.

That's an important step, though, with two ways you could do it:

1. Click in the document after selecting the file, and let Designer put it in at native size/resolution; or 

2. Drag the tool on the canvas to place the image at the size you want.

When I've tried approach 1 with your SVG file it comes in with the file content outside the document, though the bounding box is within the document.

 

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

One final post on this, First thanks for all the commen@ts/suggestions. I think the one that solved the issue for me was the one from @v_kyr suggesting to just open the file instead of using Place from the file menu.

The latest word from Alibre is that they are using 96 dpi to export the svg to match the latest CSS standard of 96 dpi. It should be noted though that the svg files that are exported from Alibre are not used on the web, they are intended for programming a CNC machine and in my case that is the Shaper Origin.

@v_kyr, I looked up the links you posted and only the one for GitHub had anything related to CAD or CNC the others were concerned about web images, as far as I could tell. But maybe I wasn't looking in the right places.

@walt.farrell, Your suggestions sound like using the Place command from the File menu. When I followed, or tried to, those steps the file was still oversized and needed to edit the embedded document as I was doing before.

And finally, @iconoclast, when I double clicked on the embedded document it only placed me in the embedded document window so I could edit the strokes. I still needed to exit the embedded doc and return to the main doc which was still out of scale/size. So though it looked promising it wasn't what I needed.

So in the end I have found a workflow to process the files that I need. So unless and until I need some other advice on using Designer, Thanks for your help.

Link to comment
Share on other sites

1 hour ago, HaroldL said:

Your suggestions sound like using the Place command from the File menu. When I followed, or tried to, those steps the file was still oversized and needed to edit the embedded document as I was doing before.

If you weren't using Place, then what did you mean when you said that you "placed the SVG in the document"?

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

1 hour ago, HaroldL said:

I looked up the links you posted and only the one for GitHub had anything related to CAD or CNC the others were concerned about web images, as far as I could tell.

That's the main point here, SVG is first of all meant for web based vector graphics and thus not a full blown replacement for the in CAD/CAM/CNC used DWG format etc. - See also the SVG specification 2 here. Note however that Affinity's SVG implementation is so far only halfway/partly conform to the SVG 1.1 spec instead!

An excerpt from the SVG spec ...

Quote

1.1. About SVG

This specification defines the features and syntax for Scalable Vector Graphics (SVG).

SVG is a language for describing two-dimensional graphics. As a standalone format or when mixed with other XML, it uses the XML syntax [xml]. SVG code used inside HTML documents uses the HTML syntax [HTML]. SVG allows for three types of graphic objects: vector graphic shapes (e.g., paths consisting of straight lines and curves), images and text. Graphical objects can be grouped, styled, transformed and composited. The feature set includes nested transformations, clipping paths, alpha masks, filter effects and template objects.

SVG drawings can be interactive and dynamic. Animations can be defined and triggered either declaratively (i.e., by embedding SVG animation elements in SVG content) or via scripting.

Sophisticated applications of SVG are possible by use of a supplemental scripting language which accesses SVG Document Object Model (DOM), which provides complete access to all elements, attributes and properties. A rich set of event handlers can be assigned to any SVG graphical object. Within a web page, the same scripts can work on both HTML and SVG elements. Scripting.

SVG is useful for rich graphical presentation of information, including a number of accessibility features that, used correctly, ensure the content can be used by the widest possible audience. But a direct link to source data, where possible, is helpful for many people to understand the content provided.

1.2. Compatibility with other standards efforts

SVG leverages and integrates with other W3C specifications and standards efforts, as described in the following:

  • SVG can be integrated with HTML either by using SVG in HTML or by using HTML in SVG, in both cases either by inclusion or reference.
  • SVG is an application of XML and is compatible with XML 1.0 and with the Namespaces in XML specification. However, when SVG content is included in HTML document, the HTML syntax applies and may not be compatible with XML. See SVG Integration for details.
  • SVG content is styled with CSS. See Styling with CSS for details.
  • SVG includes a complete Document Object Model (DOM) and extends DOM4. The SVG DOM has a high level of compatibility and consistency with the HTML DOM. Additionally, the SVG DOM supports and incorporates many of the facilities described in the CSS object model and event handling [dom-level-2-style] [uievents].
  • SVG incorporates some features and approaches that are part of SMIL 3, including the switch element and the systemLanguage attribute.
  • SVG is compatible with W3C work on internationalization. References (W3C and otherwise) include: [UNICODE] and [charmod].
  • SVG is compatible with W3C work on Web Accessibility. See Accessibility Support.

Note too that, even the SVG format is widely used by a lot of third party software for vector based import/export/exchange it's not everywhere implemented in the same full manner according to the SVG specs. The best SVG implementations, those which are most conform to the SVG specs, can -no surprise- be found in webbrowser engines. Beside those Inkscape is also relative conform to the SVG specs, at least when interpreting SVG code, since it uses SVG internally.

Most other software here instead, often just only supports a limited subset of what the full SVG specs defines and thus is often also relative error proune in terms of SVG syntax parsing and interpretation!

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

On 5/28/2022 at 7:51 PM, HaroldL said:

I am attaching a test file and the color coding needed for Shaper Origin. The Smiley file should be 12 inches in diameter, the inset circle is 10.5 inches diameter.

So there is something going on with the 72 to 96 dpi conversion. But there is also something funky with the center point placement.

I made two very simple changes (see image) to the SVG text code  (not sure it that's less or more or a hassle 😉).
Now it opens in Affinity (72dpi) at the correct 12" and it's now centered. 
(As a little bonus I did a universal "replace all" of the stroke weight (0.0529166666666667) to .5. So now at least you can see the darn thing 😄)
Now, all you have to do is change the dpi to 96 and do whatever line joining needs to be done.

You can also now use the Place command.
Create a 12"x12" (or any size) document at 96 (or whatever) dpi. Place it right in the middle. Should be fine. 👍

Changed SVG attached.

1148345112_ScreenShot2022-06-03at4_04_21PM.png.7a468e620bebf89f10434086a54e4391.png

SVG Smiley omt.SVG

Link to comment
Share on other sites

On 5/28/2022 at 4:51 PM, HaroldL said:

The files will be used in Shaper Origin CNC router

Have you checked with the Shaper forum? You could also ask about the Alibre software there, could be someone has experience.

https://community.shapertools.com/c/design-software/other-software/14

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.