Let's talk about libredwg support

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
looo
Posts: 3431
Joined: Mon Nov 11, 2013 5:29 pm

Re: Let's talk about libredwg support

Postby looo » Sat Oct 12, 2019 7:24 am

@kunda I simple used the same approach as yorik did. This was more a test to see if libredwg would work as replacement for the oda-converter but I didn't get this impression. I guess some more testing is necessary.

Thx @vocx for the explanation. I guess it's time to stop trying to write py2 compatible python. There are really some nice things about py3 and I guess it's time to use them.
User avatar
yorik
Site Admin
Posts: 12011
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Let's talk about libredwg support

Postby yorik » Mon Oct 14, 2019 7:25 pm

My 2 cents:

libreDWG is GPL3, which is incompatible with our LGPL2 license. So in any case, it is better not to try to make the FreeCAD source code depend on libreDWG, otherwise we're in for problems. Fortunately, that's where external addons are handy, because it's the addon that depends on FreeCAD, not the contrary.

So for me the right way would be to code a new DWG importer/exporter as external addon that uses libeDWG and is licensed under GPL3. This would be far more efficient than using a convertor, like the ODAconvertor, as libreDWG certainly has all the tools to navigate through the different entities of a DWG file. It could basically do both the job of the ODA convertor and our DXF importer together at once.

It could be done in C++ (with one or two very simple python functions), but then there is the burden that it must be compiled, and the addon author will need to start furnishing compiled packages for all platforms, etc. Or, it is all done in Python, but it will then requires the user to have a version of libreDWG on their machine. But this is a better way I believe, because if things go well, sooner or later libreDWG should be available in all package systems, same with IfcOpenShell.

Of course, @Kunda1's idea would be a much more simple thing that we can do first...
User avatar
Kunda1
Posts: 7988
Joined: Thu Jan 05, 2017 9:03 pm

Re: Let's talk about libredwg support

Postby Kunda1 » Tue Oct 15, 2019 11:52 am

yorik wrote:
Mon Oct 14, 2019 7:25 pm
But this is a better way I believe, because if things go well, sooner or later libreDWG should be available in all package systems, same with IfcOpenShell.
I've started reaching out to downstream repos to either update or add LibreDWG
Image

I'm also tracking this via https://github.com/luzpaz/FreeCAD-depen ... /issues/36
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
looo
Posts: 3431
Joined: Mon Nov 11, 2013 5:29 pm

Re: Let's talk about libredwg support

Postby looo » Tue Oct 15, 2019 12:17 pm

yorik wrote:
Mon Oct 14, 2019 7:25 pm
So for me the right way would be to code a new DWG importer/exporter as external addon that uses libeDWG and is licensed under GPL3. This would be far more efficient than using a convertor, like the ODAconvertor, as libreDWG certainly has all the tools to navigate through the different entities of a DWG file. It could basically do both the job of the ODA convertor and our DXF importer together at once.
Yes I agree with this. Directly importing dwg's is for sure the better solution. But for testing the library I think it would be nice to have the option to choose between libredwg and ODA for now. As far as I know calling libredwg via subprocess doesn't make freecad directly dependent on the source of libredwg.
yorik wrote:
Mon Oct 14, 2019 7:25 pm
So in any case, it is better not to try to make the FreeCAD source code depend on libreDWG, otherwise we're in for problems. Fortunately, that's where external addons are handy, because it's the addon that depends on FreeCAD, not the contrary.
For sure in the long run, a direct importer is better. But for getting some more feedback about libredwg, we could handle libredwg as a replacement to ODA. Don't you think?
UR_
Posts: 1188
Joined: Tue Jan 03, 2017 8:42 pm

Re: Let's talk about libredwg support

Postby UR_ » Tue Oct 15, 2019 1:07 pm

yorik wrote:
Mon Oct 14, 2019 7:25 pm
libreDWG is GPL3, which is incompatible with our LGPL2 license
Gmsh.exe (used by FEM WB) is licensed under GPL too, and directly called by subprocess :?
User avatar
yorik
Site Admin
Posts: 12011
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Let's talk about libredwg support

Postby yorik » Tue Oct 15, 2019 1:43 pm

looo wrote:
Tue Oct 15, 2019 12:17 pm
For sure in the long run, a direct importer is better. But for getting some more feedback about libredwg, we could handle libredwg as a replacement to ODA. Don't you think?
Yes, 100% agree.

The "Does using an executable as a subprocess count as a dependency" question is probably highly controversial.. I remember RMS arguing that importing a python lib at runtime is dependency... Some might say this is one too. But in this case, I think 1) No distribution or packaging system ever goes so far, not even debian, and 2) FreeCAD still runs perfectly fine without, so I wouldn't worry much. We all agree FreeCAD doesn't depend on ODA. It just uses it if it happens to be present. Like the users themselves would do anyway.
User avatar
Kunda1
Posts: 7988
Joined: Thu Jan 05, 2017 9:03 pm

Re: Let's talk about libredwg support

Postby Kunda1 » Tue Oct 15, 2019 2:55 pm

Kunda1 wrote:
Tue Oct 15, 2019 11:52 am
yorik wrote:
Mon Oct 14, 2019 7:25 pm
But this is a better way I believe, because if things go well, sooner or later libreDWG should be available in all package systems, same with IfcOpenShell.
I've started reaching out to downstream repos to either update or add LibreDWG
I'm also tracking this via https://github.com/luzpaz/FreeCAD-depen ... /issues/36
kkremitzki wrote::bell:
Hey man, do you know of any efforts on the topic in regards to ubuntu/debian side of things?
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
Kunda1
Posts: 7988
Joined: Thu Jan 05, 2017 9:03 pm

LibreDWG 0.9.3 released (Re: Let's talk about libredwg support)

Postby Kunda1 » Sun Dec 29, 2019 12:53 pm

https://github.com/LibreDWG/libredwg/blob/0.9.3/NEWS
LibreDWG version 0.9.3 - released 2019/12/25 - beta:

Minor bugfixes:
* Added several overflow checks from fuzzing (#176)
* Enabled AX_RESTRICT, undefining restrict in broken compilers (#141)
* Fixed AX_ADD_FORTIFY_SOURCE warnings with gcc-9 -Wcpp
* Disallow illegal SPLINE scenarios (#176)
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
Kunda1
Posts: 7988
Joined: Thu Jan 05, 2017 9:03 pm

Re: Let's talk about libredwg support

Postby Kunda1 » Tue Dec 31, 2019 1:46 pm

Kunda1 wrote:
Tue Oct 15, 2019 2:55 pm
kkremitzki wrote::bell:
Hey man, do you know of any efforts on the topic in regards to ubuntu/debian side of things?
just re-upping this to see if it's on the your radar, @kkremitzki
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
maker
Posts: 81
Joined: Sun Apr 01, 2018 10:25 am

Implementation of LibreDWG in FreeCAD

Postby maker » Thu Jan 02, 2020 10:47 am

Hi community,

with the beginning of the year 2020, I'd like to inquire how it will be possible to implement LibreDWG in FreeCAD.

Until now, I could only find to basic threads concerning to libreCAD and FreeCAD:

1) LibreDWG revived! https://forum.freecadweb.org/viewtopic.php?f=8&t=30601

2) Let's talk about libredwg support https://forum.freecadweb.org/viewtopic.php?f=8&t=39827

Related to the development the following state was actually achieved, dated Jan 1, 2020, with packages available at github:

https://github.com/LibreDWG/libredwg/re ... 0.9.3.2543

packages for openSUSE are available at:

https://software.opensuse.org//download ... ctopenSUSE

After retrieving the package and installation of

libredwg-0.9.3-lp151.23.1.src.rpm

on e.g. openSUSE leap 15.1 system with the repos:

libredwg0 - A library to handle DWG files
libredwg-devel - Development files for libredwg
libredwg-tools - Command line utilities for handling DWG file

the essential question now is:

what to do to work (Import/ Export data files) with libreDWG in FreeCAD?