Perfectly scale dxf printing on Linux, how? - Page 1
Forum section: electronics / general

author: Infraviolet
author_rank: Super Contributor
timestamp: January 13, 2025, 06:39:52 pm
content: Does anyone know a means to print a dxf file perfectly to scale, on A4 paper, from a Linux PC.I do now want to jump through the sort of hoops involved in converting a dxf to an image (thereby losing inbuilt scale information), then putting this in to something like libreoffice (wherein one has to crudely manually scale it from whatever size Libreoffice Writer decides to import it as, and then try to line it up against scale bars on the document in an attempt to restore it to the true size), then printing from libreoffice or exporting as a pdf and printing from the pdf viewer's dialog box (I understand sometimes these, and even the paper printer itself, can sneakily insert unexpected margins on the page which usually affectscale rather than merely chopping off any parts of the design which are unprintably close to the paper edges). I absolutely cannot be fiddling around with manual scale adjustments by mouse cursor, or anything where I have to print a test of the design, measure by ruler/calipers and then use the proportion of inaccuracy to reprint. I want something which is right first time.It is easy for me to print an stl file at the right size with a 3D printer, does anyone know an easy way to print dxf's up to the size of a sheet of A4 easily on a traditional paper printer. I particularly need to print some drilling and sawing guides to glue on to stock materials before I saw/drill them. I can easily get from the initially designed CAD data to dxf as a common 2d, scale preserving, format, but then don't know how to proceed from there to a printed page in a scale-consistent manner.Thank youP.S. Mods, I interpretred this to be the section for general CAD considerations, not just PCB related threads, if not, please move the thread, thanks

author: voltsandjolts
author_rank: Unknown
timestamp: January 13, 2025, 07:32:45 pm
content: Quote from: Infraviolet on January 13, 2025, 06:39:52 pmDXF is a unit-less file format. It just has numbers and the units are in your head, mm or miles, whatever.I use inkscape and find it very good. It can import DXF, although I haven't used it much. YMMV. Post a DXF if you want me to try it for your use case.

author: Kean
author_rank: Unknown
timestamp: January 13, 2025, 08:54:48 pm
content: I don't use desktop Linux much (mostly servers) but Inkscape is the first solution that came to mindThe other thing is to do a search on "dxf to pdf github" (or similar terms) and see what you gete.g.https://gist.github.com/slazav/2c617b8e7ba09ec67e1e633b043f89dd

author: Geoff-AU
author_rank: Frequent Contributor
timestamp: January 13, 2025, 10:18:15 pm
content: LibreCAD works with dxf files and can print them at 1:1 scale no problem.

author: JohanH
author_rank: Frequent Contributor
timestamp: January 14, 2025, 07:05:24 am
content: FreeCAD can import dxf files as well. But if you haven't used FreeCAD before, it can be a bit overwhelming. Plenty of search results if you google for the terms, though.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 14, 2025, 11:27:13 am
content: What sort of accuracy do you need? Printers have high resolutions these days, but they are not engineered to be precise. Typical deviations are around 0.5%, and these scale factors can be different in horizontal and vertical directions.And if you want accurate measurements, use programs that are made for engineering. Both FreeCAD and LibreCAD have been mentioned. Both work, but FreeCAD has a quite significant learning curve. LibreCAD is sort of usable, but it has a few too many "obvious flaws" for my liking. As I switched to 3D long ago, I did not spend much time on LibreCAD though. And it does seem to get some small updates every now and then, so at least the project is not dead.For accurate printer output, the best way is if you have a built in algorithm to callibrate your printer. For example, you print a 180x250mm rectangle once, then you measure it and enter your measurements into the program, After that the program knows the particular deviation of your printer, and it can use correction factors.You also have to watch out for other settings in your printer driver. Common is to have a checkbox with "fit to page", and if that is on, you can never expect measurements to be consistent.

author: Infraviolet
author_rank: Super Contributor
timestamp: January 14, 2025, 09:27:34 pm
content: Thanks, I have FreeCAD installed but have never gotten round to learning it. My usual use of it is as a file converter to let me import things like STEP then export them as mesh formats I'm more used to working on.I looked in to FreeCAD for this and from piecing together a few partial descriptions online worked out the following.I have tried it and it might be working but I'm not fully sure, particularly if my printer (Canon MG54 series) is doing anything funny to the printing jobs supplied to it in terms of scale.1.I create a "new" file in FreeCAD2.I import the dxf in to FreeCAD (File-->Import, then pick the dxf), and select to view it from the TOP (my usual projection direction when producing dxf files)3.I select all the lines of the dxf, then pick the "TechDraw" workbench4.I go to "Insert page using template" and insert the A4PortraitBlank option5.Then I use "Insert multiple linked views of drawable objects" on the top toolbar, ensure it has chosen the correct angle to project from then click "ok" in the Tasks box.6.The File-->Print preview and in Page Setup I set the units to mm, set all margins to 0.00mm, keeping page Size as A47.Then the Print button in the print preview popup8.In properties I check that mm, A4 and zero margins are still set, in the Advanced tab under General I change the "Shrink page if necessary to fit borders" to the Crop option which apparently preserves dimensions9.Then I print itIt appears that the zero margin setting and the Crop option need redoing every time, even if you haven't closed FreeCAD inbetween.A simple check with a ruler suggests that the dxf files have printed to scale, but I can't be fully sure if the method is 100% reliable. Can anyone verify that there aren't any steps in this where a sneaky scaling factor may arise and mess up the final printed page's scale?Thanks