Unable to create 2D drawing from 3D part

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
quick61
Veteran
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Unable to create 2D drawing from 3D part

Post by quick61 »

After selecting the Drawing in the tree view, and then the Data tab below it in your combo view, you will see the entry line "Template". Click on it and you will now see a small button with 3 dots [...]. Click on the little button and that will provide you with a file browser dialog that will allow you to browse to the location you have placed your new template and select it. Once the new template is selected you can now add your part to it.

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
imagecatcher
Posts: 2
Joined: Sun Jan 11, 2015 8:09 pm

Re: Unable to create 2D drawing from 3D part

Post by imagecatcher »

Thanks Quick61 but as a Newbie I must be missing something (in addition to a brain). Here is a screen shot.
Feel free to open up the svg file and see if you have any luck.
Attachments
FC grab.tiff
FC grab.tiff (447.57 KiB) Viewed 1349 times
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Unable to create 2D drawing from 3D part

Post by NormandC »

Please do not post TIFF images. Other than on Macs, no browser can display TIFF images.
User avatar
quick61
Veteran
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Unable to create 2D drawing from 3D part

Post by quick61 »

OK, to tell you the truth, this one has me kind of stumped at first look. I loaded your svg template and sure enough, no projections can be seen, though they are being added and not showing any error. Everything looks good as far as formatting, other than viewBox was not included, but that would not stop anything. I'll keep looking, but hummm.....

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
User avatar
CraigCu
Posts: 15
Joined: Thu Jan 07, 2016 9:53 pm
Location: McFarland WI

Re: Unable to create 2D drawing from 3D part

Post by CraigCu »

quick61 wrote: Sun Jan 11, 2015 9:08 pm After selecting the Drawing in the tree view, and then the Data tab below it in your combo view, you will see the entry line "Template". Click on it and you will now see a small button with 3 dots [...]. Click on the little button and that will provide you with a file browser dialog that will allow you to browse to the location you have placed your new template and select it. Once the new template is selected you can now add your part to it.
Mark
At the risk of digging up this old thread, it is very relevant to my situation. My particulars:

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

So I have a company template in DXF format and have edited it with the 2 lines needed ($block and $entities) per other documentation and have copied this DXF into C:\Program Files\FreeCAD 0.16\data\Mod\Drawing\Templates. This user template is not behaving as per any of the system default templates, all of which have an SVG equivalent file. Is this a requirement? Other documentation is not exactly clear about this.
Craig, AMTELCO
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Unable to create 2D drawing from 3D part

Post by chrisb »

I have never heard about anything else for the templates except SVG format.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Unable to create 2D drawing from 3D part

Post by NormandC »

Hi Craig,

You cannot use the DXF directly as template in FreeCAD's Drawing workbench. The single purpose of the DXF files in FreeCAD's Templates is for exporting a Drawing page to DXF. For each SVG template there is its DXF counterpart. At export, this DXF is merged with the views on the page. I don't remember why it was done so, I think it's because exporting the SVG template didn't work reliably.

You need to convert your DXF to SVG, then you need to edit it with a text editor to add special tags inside the file. See Drawing_templates.

The challenge here is to convert your DXF to SVG. I won't sugarcoat it, I did tests and didn't find a straightforward way to do so.

You can try to open your DXF template in FreeCAD, then export it to Flattened SVG. But chances are text will come out garbled.

Using open source programs, the best I've come up with is this:
  1. Download a 2D CAD program that works with DXF, for example LibreCAD. Open your DXF template with it, then export to PDF. You may have to deal with the Page setup process.
  2. Download and install Inkscape, a vector graphics program.
  3. Open the PDF.
  4. Export to SVG.
  5. Open the SVG in a text editor and follow instructions from Drawing_templates.
  6. Place the SVG template into your Templates folder.
Another solution would be to create your drawing pages with a blank template, export to DXF, then use LibreCAD to add your template to it.
User avatar
CraigCu
Posts: 15
Joined: Thu Jan 07, 2016 9:53 pm
Location: McFarland WI

Re: Unable to create 2D drawing from 3D part

Post by CraigCu »

NormandC wrote: Wed Mar 21, 2018 3:28 am You need to convert your DXF to SVG, then you need to edit it with a text editor to add special tags inside the file. See Drawing_templates.
The challenge here is to convert your DXF to SVG. I won't sugarcoat it, I did tests and didn't find a straightforward way to do so.
Thank you, et merci, NormandC. This confirms my suspicions.
NormandC wrote: Wed Mar 21, 2018 3:28 am You can try to open your DXF template in FreeCAD, then export it to Flattened SVG. But chances are text will come out garbled.
Indeed I tried this overnight and was unsuccessful: "The export list contains no shape". Perhaps I need to explode any blocks or similar processes but at this point it is a diversion from my goal. I will instead use the built-in FreeCAD templates to get something to our Production/Purchasing staff.
I may already have a PDF of our company DXF so I will not need LibreCAD; I also have and use DraftSight anyways.

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Craig, AMTELCO
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Unable to create 2D drawing from 3D part

Post by NormandC »

CraigCu wrote: Wed Mar 21, 2018 2:23 pm Indeed I tried this overnight and was unsuccessful: "The export list contains no shape".
Just for the sake of completeness, I believe this may be caused by your DXF import settings.

There are two DXF importers. The legacy python one needs to be downloaded from a Github repository; because of its license, it couldn't be included with FreeCAD. In v0.16, a new native importer programmed in C++ was introduced, but it does not yet have all the features of the legacy importer. I believe the native imported is set as default.

The DXF importer is managed by the Draft workbench. You need to load Draft, which will load the DXF tab in the Import-Export preferences (in the Edit menu). Then you can enable the legacy python importer. But also check that text and dims are checked, and possibly other types of geometry.

Once done, you need to quit and reopen FreeCAD for changes to take effect.
User avatar
CraigCu
Posts: 15
Joined: Thu Jan 07, 2016 9:53 pm
Location: McFarland WI

Re: Unable to create 2D drawing from 3D part

Post by CraigCu »

NormandC wrote: Fri Mar 23, 2018 1:27 am
CraigCu wrote: Wed Mar 21, 2018 2:23 pm Indeed I tried this overnight and was unsuccessful: "The export list contains no shape".
Just for the sake of completeness, I believe this may be caused by your DXF import settings.

There are two DXF importers. The legacy python one needs to be downloaded from a Github repository; because of its license, it couldn't be included with FreeCAD. In v0.16, a new native importer programmed in C++ was introduced, but it does not yet have all the features of the legacy importer. I believe the native imported is set as default.

The DXF importer is managed by the Draft workbench. You need to load Draft, which will load the DXF tab in the Import-Export preferences (in the Edit menu). Then you can enable the legacy python importer. But also check that text and dims are checked, and possibly other types of geometry.

Once done, you need to quit and reopen FreeCAD for changes to take effect.
Ah, I like completeness also. This may help others in the future.

I confirmed that the DXF importer had already enabled the legacy python importer.
So I experimented some more:
- if I select just the parent item in the combo view then export to flattened SVG I would get "The export list contains no shape".
- if I expand the parent and select all the individual elements (in my case many polylines and texts) then export to flattened SVG then I get no error; however importing the resultant SVG in a new FreeCAD file does indeed remove the texts.

I then DISabled the legacy python DXF importer in FreeCAD preferences, closed FreeCAD, then opened FreeCAD again, and
opened the desired DXF file:
- immediately I could see that the text scale was whacked and the parent item now consisted of texts and shapes (instead of polylines).(But then the texts corrected scale when I zoomed in)
- however importing the resultant SVG in a new FreeCAD file does indeed remove the texts again.

I will leave this alone for now and wait for v0.17.
Craig, AMTELCO
Post Reply