knippex Posted April 13 Share Posted April 13 Hello everyone, I would like to create electronic components for my projects (Arduino) so that I can use them in a software program. To do this, the external dimensions must fit. I have already created it in Affinity Designer and have external dimensions of 20x25mm. After exporting as SVG, whether as a document, as an artboard or as a slice, I always have different dimensions afterwards. Even when I open it again in Affinity, my original 20mm becomes something around 80mm. Can any of you help me how to export such files correctly? Iam also interested in whether it is possible to automatically adapt an artboard or a slice to a selection. I have to leave the layers as they are for the software to export and not group them. This means that slicing, for example, does not work properly. I will be grateful for any tips. Many thanks in advance and best regards from Germany 🙂. Quote Link to comment Share on other sites More sharing options...
Hangman Posted April 13 Share Posted April 13 Hi @knippex and welcome to the forums, Affinity apps don't export SVG files using user units which is a big problem for many users when importing SVG files into CAD, Plot, Laser Cut and a myriad of other software... W3C Specs say SVG should use 96 dpi but both Affinity and Adobe apps incorrectly use 72 dpi, unlike Inkscape and Corel which correctly use 96 dpi... There is also a bug, listed as AF-2692 in the SVG export window when exporting SVG files from Affinity apps where the 'Use dpi' entry fails to honour the dpi entered. The size of your exported SVG suggests your Affinity Document uses 300 dpi, (300 / 96) x 100 = 312.50% | 20 mm + 312.50% = 82.5 mm which sounds like what you're seeing. There are two workarounds: Workaround One - Set your Document Setup to 96 dpi and export to SVG with 'Use document resolution' selected in the export window Workaround Two - Edit your exported SVG file in a text editor and change the width and height from 100% to the respective user units, i.e., change <svg width="100%" height="100%" viewBox="0 0 237 296" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> <rect x="0" y="0" width="236.22" height="295.276" style="fill:#fff120;"/> </svg> to <svg width="20mm" height="25mm" viewBox="0 0 237 296" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> <rect x="0" y="0" width="236.22" height="295.276" style="fill:#fff120;"/> </svg> Note: The SVG will still open at the incorrect size when reopened in Affinity apps because Affinity apps interpret the SVG at 72 dpi instead of 96 dpi but assuming the Arduino software uses 96 dpi as its base the SVG exported from Affinity apps 'should' appear at the correct size... I hope that helps... let us know if the workarounds work for you and if not let us know the outcome you see. 56 minutes ago, knippex said: I am also interested in whether it is possible to automatically adapt an artboard or a slice to a selection. I have to leave the layers as they are for the software to export and not group them. This means that slicing, for example, does not work properly. I think the answer is 'yes' but could you elaborate a little with a simple example of what you're trying to achieve so we can better help you? NotMyFault 1 Quote Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse Link to comment Share on other sites More sharing options...
knippex Posted April 13 Author Share Posted April 13 (edited) Hello @Hangman, thank you very much for the quick reply and the help you offered. I first tried to export the component with 96 dpi. This was to large so I decided to export with 90 dpi. This is the result of 90 dpi. Left original file, right the export file. However, when I import these 90 dpi into Fritzing, the dimensions are displayed correctly. I want to export it for the Fritzing software to build my own plans for my Arduino Projects. To adjust the XML, does the component have to be exactly the same size as the background? Because this is the second problem described, which I will go into in more detail in a moment. These are my export settings in Designer. Are they okay for my project? Perhaps you can recommend other settings. My second concern is the slice or artboard tool. I have a graphic in the screenshot. I would like to make the slice as small as possible. Is there a trick for drawing the slice exactly around the outer edges? Perhaps a keyboard shortcut or something similar? I know grouping would help, but it doesn't work if there are several groups or elements. Thank you at all. Edited April 13 by knippex Quote Link to comment Share on other sites More sharing options...
Hangman Posted April 13 Share Posted April 13 Bizarrely it seems that Fritzing does indeed use 90 dpi which explains why you needed to use 90 dpi to achieve the correct size on import... When creating a New Document or under Document Setup, ensure the DPI is set to 90 dpi (rather than 300 dpi or any other value)... If e.g., you have your Document dpi set to 300 dpi and then select 90 dpi in the SVG export settings the exported file will be incorrect owing to the bug mentioned earlier. 1 hour ago, knippex said: To adjust the XML, does the component have to be exactly the same size as the background? No, the document dimensions can be anything you want as long as the document dpi is 90. Generally, only graphic elements on the canvas will be exported when exporting to SVG rather than the whole document. You can make a quick test to see how the SVG imports into Fritzing, whether using the dimensions of the document or the graphics in the document. If Fritzing does bring import the SVG using document dimensions then if all your graphics are contained within your grey background you can select all the layers in the Layer panel (or group them and select the Group) and then when exporting to SVG select 'Selection Only' from the Area dropdown. This assumes all your graphic bounding boxes are contained within the bounding box of the background, if they're not owing to rotated shapes then select the background and connector layers and choose 'Selection Area' from the Area dropdown. 1 hour ago, knippex said: These are my export settings in Designer. Are they okay for my project? Perhaps you can recommend other settings. They look perfect... 2 hours ago, knippex said: I have a graphic in the screenshot. I would like to make the slice as small as possible. Is there a trick for drawing the slice exactly around the outer edges? When exporting using the Export Persona everything has to be perfectly pixel-aligned, i.e., using integer values otherwise the exported slice will be rounded up to the nearest pixel... The problem you'll likely have is that when converting e.g., 25 mm x 31 mm @ 90 dpi to pixels you end up with 70.866142 px x 109.847022 px which means any Slice will be rounded up 71 px x 110 px. The graphic also needs to have perfectly pixel-aligned X and Y values otherwise this will further compound the size of the slice again due to pixel rounding... A larger slice may not matter when importing your SVG because of the transparent background but you'll need to do a couple of test exports to see whether this works for your needs. Your slice shown in the screengrab indicates that your document dpi is set to 300 dpi rather than 90 dpi because the slice is 282 px x 423 px. I'm not entirely sure why there is so much additional space around your graphic... I recreated the graphic using a 90 dpi canvas and this is what I see when creating a slice from it... As you can see because 25 mm x 31 mm @ 90 dpi translates to 70.866142 px x 109.847022 px, the size of the slice is rounded up to the nearest integer value, 71 px x 110 px. Grouping everything should still be okay, it may have something to do with how the graphic is structured. I'd be happy to take a look if you're able to upload your Designer file. Hopefully, I can then determine what is causing the additional space around the slice... I hope this helps but feel free to ask any questions... I've attached the quick version I created, it may not be perfect but will allow you to see the Document settings and how it exports as a slice... Note: The file has been created in Designer v2.4.2 PCB.afdesign Quote Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse Link to comment Share on other sites More sharing options...
bbrother Posted April 13 Share Posted April 13 3 hours ago, knippex said: I would like to make the slice as small as possible. Is there a trick for drawing the slice exactly around the outer edges? 3 hours ago, knippex said: Perhaps a keyboard shortcut or something similar? 3 hours ago, knippex said: I know grouping would help, but it doesn't work if there are several groups or elements. Welcome in the forum @knippex You can have multiple levels of groups. This means that you can group elements that you have already grouped before into a parent group. Just grab all elements that are a part of that electronic component design no matter if they are single or grouped and make another group that will hold them all. After that there should be no problem in the "Slices panel" to create a slice that size fits exactly around the edges of the component. You just need to select the top most layer in the stack of groups that holds all the parts of design. See the video bellow↓ ADe_create_slice.mp4 Quote Link to comment Share on other sites More sharing options...
knippex Posted April 13 Author Share Posted April 13 @Hangman The basic idea is to have a large "work surface" where I have many sample elements next to each other. Then I will create my new component in a free area. Here I now can copy the sub-elements from the other template files quickly and easily. Then I simply slice my component, export it and I'm done. I can then copy this file from project to project and just replace the last element created with my new one. @Hangman, @bbrother My problem with slicing is that I cannot slice elements that are not grouped together. If I select individual elements and then click on the slice button, see below, it slices all elements individually. Then I wanted to use the slice tool to simply make my frame large and hoped that there might be a way to make this frame snap to the outer edges or something similar. But unfortunately I can't get any further. When I group the individual elements, it works as it should. But as far as I have read, the elements should be ungrouped when exported so that the software can read them in cleanly. Here I tried to select individual elements and pressed slice. But as you can see, the result is not a large slice but a single slice for each element. @Hangman @bbrother It's nice to see that you reply to me so quickly. Super community thanks for the help so far. ☺️ Hangman 1 Quote Link to comment Share on other sites More sharing options...
Hangman Posted April 13 Share Posted April 13 1 hour ago, knippex said: The basic idea is to have a large "work surface" where I have many sample elements next to each other. Then I will create my new component in a free area. Here I now can copy the sub-elements from the other template files quickly and easily. You may want to consider using Assets to store your components which you can split into various relevant categories that way they'll be available to every new document you create... 1 hour ago, knippex said: My problem with slicing is that I cannot slice elements that are not grouped together. If I select individual elements and then click on the slice button, see below, it slices all elements individually. With everything ungrouped, don't select any layers, that way, when you go to the Slices panel only the graphic itself will appear where you can select it and export that as a single slice... Note: you won't see any blue slice bounding box added to the graphic and the SVG will export using the document dimensions but with a transparent background so you may wish to set your document dimensions to match the size of the graphic which is where having all your components saved as Assets would be beneficial rather than having a large canvas to store the components. 1 hour ago, knippex said: Then I wanted to use the slice tool to simply make my frame large and hoped that there might be a way to make this frame snap to the outer edges or something similar. But unfortunately I can't get any further. Logically the frame should effectively snap to the outer edges, but without seeing your artwork I can't tell what's preventing this from happening. See if the above option works when nothing is grouped and let us know how you get on... Quote Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse Link to comment Share on other sites More sharing options...
knippex Posted April 13 Author Share Posted April 13 @Hangman Thank you very much, the assets are great, I will use them that way. And regarding the slice, automatically creating a slice of several selected individual elements that are not grouped does not seem to be possible. I know this from the CAD area, where you can create an enclosing rectangle around several elements. If I draw a slice manually, I can move it, but it snaps to pixels but not to the outer edge of my graphic. Quote Link to comment Share on other sites More sharing options...
Hangman Posted April 13 Share Posted April 13 25 minutes ago, knippex said: If I draw a slice manually, I can move it, but it snaps to pixels but not to the outer edge of my graphic. If drawing a slice manually then, yes, it will snap to pixels rather than the edge of your graphic if your graphic is not perfectly pixel-aligned using integer pixel values for both its dimensions and x and y coordinates (as mentioned above)... That's just the way the Export Persona works in the Affinity apps... I believe this is because SVG is based on XML, which is pixel-based, though I'm sure someone will correct me if this is not the case... If you change the document units to pixels your exported graphics' dimensions will be rounded up to the nearest whole pixel for both width and height considering the x and y coordinates of your graphic which if not perfectly pixel-aligned will add pixels to the exported SVG... Only when your graphic is perfectly aligned and sized using integer pixel values will the slice snap perfectly to the outer edge of your graphic... So this... will result in this... 25 minutes ago, knippex said: And regarding the slice, automatically creating a slice of several selected individual elements that are not grouped does not seem to be possible. Did you try not selecting any layers and just exporting the graphic as per the previous post? PCB.mp4 knippex 1 Quote Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse Link to comment Share on other sites More sharing options...
knippex Posted April 13 Author Share Posted April 13 @Hangman Thanks for the help 🙂 Quote Link to comment Share on other sites More sharing options...
Hangman Posted April 13 Share Posted April 13 4 minutes ago, knippex said: Thanks for the help 🙂 That's no problem at all, hopefully, you're closer to achieving what you set out to achieve... knippex 1 Quote Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse Link to comment Share on other sites More sharing options...
bbrother Posted April 14 Share Posted April 14 13 hours ago, knippex said: Here I tried to select individual elements and pressed slice. But as you can see, the result is not a large slice but a single slice for each element. You should select and group all the elements that make up the component into one group in 'Designer persona". After that you would see in the Layers panel one expandable/collapsable group with all childrens inside. The same would be in the 'Export persona" Layers panel because it is 1:1 copy from "Designer persona". Now, to make one big slice, don't select all individual elements instead select only the parent group that holds all the elements and then hit the "Create slice" btn. To make it easier for your self collapse the parent group so you won't see the childrens in the "Export persona" layers panel. 13 hours ago, knippex said: But as far as I have read, the elements should be ungrouped when exported so that the software can read them in cleanly. No, not at all. You can group them. You even should, to be able to create bigger slices. There are many possibilities of creating slices if you group things, namely: You can select group and make a bigger slice from it, because the silce size will match the sum of childrens bounding boxes from the group. Yo can select a children of a grup to make a smaller slice. You can select the group and hit the "Crate slice" to make a bigger slice, and after that you can go back and select a child to make a separate smaller slice. But what you need to know is that, what you see on the slice is what you get in the export. In case when some element overlaps an slice, on the export it will be included. The same in case if the overlapping element is actualy a slice by it self it will be included in the export of other slice. I know it can be overwhelming, but practice makes perfect. Ultimately, with practice, you will develop the optimal method for creating slices in the "Export persona". ----------------- BTW @knippex What's the name of the font used in your design for labeling GND| OUT| VCC on the PCB? Quote Link to comment Share on other sites More sharing options...
knippex Posted April 14 Author Share Posted April 14 (edited) @bbrother Thank you for your help. I'm going to experiment a bit in the near future to find the workflow that works best for me. The font was recommended by the manufacturer of the software and it's called OCR-A. Edited April 14 by knippex bbrother 1 Quote Link to comment Share on other sites More sharing options...
Alfred Posted April 14 Share Posted April 14 28 minutes ago, knippex said: The font was recommended by the manufacturer of the software and it's called OCRA. It’s actually called OCR-A (where OCR stands for Optical Character Recognition). OCR-B is much less ugly and much more readable by humans, which means it lacks the geeky feel of the original. OCR-A: OCR-B: Hangman 1 Quote Alfred Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.5.1 (iPad 7th gen) Link to comment Share on other sites More sharing options...
Recommended Posts
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.