Patch for Arch shapefile importing, other shapefile issues

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ElliotLee
Posts: 18
Joined: Wed Mar 20, 2019 10:20 pm

Patch for Arch shapefile importing, other shapefile issues

Post by ElliotLee »

Hi there,

I've been trying to import a couple of GIS shapefiles and ran into some bugs in src/Mod/Arch/importSHP.py.

One of them is that the Z coordinates stored in the shapefile do not get used by importSHP.py. This is fixed by the attached patch. You can see the difference before/after with the attached shapefile.

One remaining issue is that a file full of POLYGONZ shapes (really, a terrain mesh) fails to create the Part.Face objects. The attached patch does not fix this but makes it a little easier to debug. I have a shapefile that produces the error consistently. It is too big to attach but can be found at https://drive.google.com/open?id=1033aT ... ZHIRzfk0t1 (1.6MB).

Another issue I noticed in importSHP.py is that the pyshp library is installed by downloading shapefile.py into the Macros directory. It seems like it would be preferable instead to use the Python dependency handler from the add-on manager to install and update pyshp as needed, and this approach could be used for quite a few other places in FreeCAD where a 3rd party library is used to implement some auxiliary functionality.

Hope this helps,
Elliot
Attachments
importSHP-fixups.patch.gz
Patch for src/Mod/Arch/importSHP.py
(1.21 KiB) Downloaded 39 times
testhouse-land.shp.gz
test shapefile that works better with the patch
(368.45 KiB) Downloaded 37 times
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Patch for Arch shapefile importing, other shapefile issues

Post by paullee »

Thanks ! Would you also make a Pull Request at Github after maybe there are peoples help to test ? :D
Post Reply