DXF Export using TechDraw classes

Discussions about the development of the TechDraw workbench
User avatar
petit_chat_noir
Posts: 68
Joined: Wed Oct 02, 2019 6:45 pm

Re: TechDraw feature request

Postby petit_chat_noir » Thu Nov 14, 2019 6:20 pm

I've worked on it today.
this is the source :
Source.png
Source.png (40.98 KiB) Viewed 339 times
Now I Have layers aligned by creating bounding box:

here is the model exported with "temp" line in red :
generated.png
generated.png (8.45 KiB) Viewed 339 times
and if I hide "temp" layer:
generated2.png
generated2.png (7.88 KiB) Viewed 339 times
Now I have to suppress doubles, remove the bounding box, and the hardest point, color splitted lines :P

EDIT: after remove doubles :mrgreen:
rem_doubles.png
rem_doubles.png (6.78 KiB) Viewed 321 times
Is there a function to test if edges are collinear ? I will have to test that to color splitted lines
I've to rework on bounding box lines, they have to be more small to not much interact with the render

The source code is available on my github workbench :
https://github.com/JeromeL63/Wood-Frame
the macro to launch :

Code: Select all

from WFrame import WFDxfExport

export = WFDxfExport.DxfExport(Gui.Selection.getSelection())
export.extractLayers()
export.extractModel()
export.save()
You have to select objects and layers you want to export before launch
(sorry I haven't made security to launch with no selected objects at the moment !)
User avatar
Kunda1
Posts: 5915
Joined: Thu Jan 05, 2017 9:03 pm

Re: TechDraw feature request

Postby Kunda1 » Fri Nov 15, 2019 12:40 pm

Moved to TD subforum
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
petit_chat_noir
Posts: 68
Joined: Wed Oct 02, 2019 6:45 pm

Re: TechDraw feature request

Postby petit_chat_noir » Sat Nov 16, 2019 3:25 pm

Hello !
done !!

this is the source :
source.png
source.png (88.74 KiB) Viewed 270 times
and this is the result in draftsight :
result.png
result.png (10.88 KiB) Viewed 270 times
I'm very very happy :D
They are some mistakes but it's quite good !
update my github workbench if you want to use it.
I'll make button and dialog taskbox to use it in few days
User avatar
petit_chat_noir
Posts: 68
Joined: Wed Oct 02, 2019 6:45 pm

Re: DXF Export using TechDraw classes

Postby petit_chat_noir » Sat Nov 16, 2019 3:38 pm

yorik wrote:
Mon Nov 11, 2019 9:15 pm
ping
wandererfan wrote:
Wed Nov 13, 2019 2:43 pm
ping
I don't know if work like that ....
User avatar
wandererfan
Posts: 3145
Joined: Tue Nov 06, 2012 5:42 pm

Re: DXF Export using TechDraw classes

Postby wandererfan » Sun Nov 17, 2019 2:17 pm

petit_chat_noir wrote:
Sat Nov 16, 2019 3:38 pm
yorik wrote:
Mon Nov 11, 2019 9:15 pm
ping
wandererfan wrote:
Wed Nov 13, 2019 2:43 pm
ping
I don't know if work like that ....
:? I don't understand the ping, but I'm happy you got the result you were looking for.

Je ne comprends pas le ping, mais je suis content que tu as obtenu ton resultat.
User avatar
petit_chat_noir
Posts: 68
Joined: Wed Oct 02, 2019 6:45 pm

Re: DXF Export using TechDraw classes

Postby petit_chat_noir » Tue Nov 19, 2019 7:22 pm

No problem, it was just to show you that you helped me a lot !
vocx
Posts: 1851
Joined: Thu Oct 18, 2018 9:18 pm

Re: TechDraw feature request

Postby vocx » Wed Nov 20, 2019 4:50 pm

petit_chat_noir wrote:
Thu Nov 14, 2019 6:20 pm
The source code is available on my github workbench :
https://github.com/JeromeL63/Wood-Frame
the macro to launch :

Code: Select all

from WFrame import WFDxfExport

export = WFDxfExport.DxfExport(Gui.Selection.getSelection())
export.extractLayers()
export.extractModel()
export.save()
If this is something that can be merged into Draft for DXF export, you should look into it instead of keeping it in your external workbench.

I see that you are using "ezdxf". What is this exactly?
User avatar
petit_chat_noir
Posts: 68
Joined: Wed Oct 02, 2019 6:45 pm

Re: DXF Export using TechDraw classes

Postby petit_chat_noir » Thu Nov 21, 2019 3:52 pm

vocx wrote:
Wed Nov 20, 2019 4:50 pm
If this is something that can be merged into Draft for DXF export, you should look into it instead of keeping it in your external workbench.

I see that you are using "ezdxf". What is this exactly?
I think this tool has not his place in draft, but more probably in arch. I'm trying to make functions to use it easly, so I will post discussion after the tool will be released.
It will probably work for draft objects too !

EzDxf is a python library/package(MIT licence) that provide good functions to create/write dxf files. A member told me it's existance, and I tried.
https://ezdxf.readthedocs.io/en/master/
vocx
Posts: 1851
Joined: Thu Oct 18, 2018 9:18 pm

Re: DXF Export using TechDraw classes

Postby vocx » Thu Nov 21, 2019 4:39 pm

petit_chat_noir wrote:
Thu Nov 21, 2019 3:52 pm
I think this tool has not his place in draft, but more probably in arch. I'm trying to make functions to use it easly, so I will post discussion after the tool will be released.
It will probably work for draft objects too !
...
Just for reference, Arch is built on top of Draft. Arch actually uses the Draft routines to export DXFs and do many other things, so that's why I suggest adding the code directly to Draft.
Last edited by vocx on Fri Nov 22, 2019 11:30 pm, edited 1 time in total.
User avatar
petit_chat_noir
Posts: 68
Joined: Wed Oct 02, 2019 6:45 pm

Re: DXF Export using TechDraw classes

Postby petit_chat_noir » Fri Nov 22, 2019 5:20 pm

OK no problem vocx, thanks for the information.
I'm making some tests, and I'll push on my workbench before introduce it in draft :D