Shapefile importer

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ignotas.grazys
Posts: 3
Joined: Sun Oct 17, 2021 6:26 pm

Re: Shapefile importer

Post by ignotas.grazys »

Hello,

I think the problem stems from the implementation of the 3D view in the Gui directory. The problem is also experienced in the Blender, Revit, AutoCAD and LibreCAD. Moving "geometry" too far away from the defined internal software coordinate origin point distorts the 3D view (viewport) of the mentioned softwares.
What if it is as simple as switching a data type which increases the distance for non distorted "geometry" in the 3D view? AutoCAD has a larger distance than FreeCAD before it also becomes distorted.
Techdraw projects the "geometry" correctly, but the viewport does not. I have made two screenshots depicting this:
3D view (viewport):
Freecad viewport.PNG
Freecad viewport.PNG (50.63 KiB) Viewed 4427 times
Techdraw:
Freecad techdraw.PNG
Freecad techdraw.PNG (109.12 KiB) Viewed 4427 times
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Shapefile importer

Post by HakanSeven12 »

We also had this type of problems when we started to develop Trails. I implemented Coin Geo nodes to our objects to solve the issue.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Shapefile importer

Post by yorik »

HakanSeven12 wrote: Mon Oct 18, 2021 8:23 am I implemented Coin Geo nodes to our objects to solve the issue.
How does it work?
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Shapefile importer

Post by HakanSeven12 »

Basically it creates a new coordinate system at the origin and renders geo objects by using this origin.

I'm controlling origin by using this object: https://github.com/HakanSeven12/Trails/ ... eorigin.py

I wrote my view providers by using sogeocoordinate nodes like this: https://github.com/HakanSeven12/Trails/ ... section.py

If you want to ask something I can help you.
ignotas.grazys
Posts: 3
Joined: Sun Oct 17, 2021 6:26 pm

Re: Shapefile importer

Post by ignotas.grazys »

I have a question about the math behind your workbench. Why is the GeoOrigin Origin x and y values are larger by three digits than the global coordinate values in the bottom right corner?
Values.PNG
Values.PNG (28.93 KiB) Viewed 4261 times
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Shapefile importer

Post by HakanSeven12 »

Because this widget works in meters unit. But values of origin is millimeters. If you want to ask why it's in meters, because it's the standart usage for geological works.
ignotas.grazys
Posts: 3
Joined: Sun Oct 17, 2021 6:26 pm

Re: Shapefile importer

Post by ignotas.grazys »

HakanSeven12 wrote: Mon Oct 18, 2021 12:55 pm Because this widget works in meters unit. But values of origin is millimeters. If you want to ask why it's in meters, because it's the standart usage for geological works.
Thank you for the information :) So I assume that the millimeters are from FreeCAD's internals?
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Shapefile importer

Post by HakanSeven12 »

Yes ;)
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Shapefile importer

Post by yorik »

HakanSeven12 wrote: Mon Oct 18, 2021 9:10 am Basically it creates a new coordinate system at the origin and renders geo objects by using this origin.
Wow, interesting... I wouldn't have expected that to solve the OpenGL issue (I suppose it's an OpenGL issue since it happens in other OpenGL apps as well).

That might be interesting to use when importing Shapefiles too indeed
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Shapefile importer

Post by wmayer »

Wow, interesting... I wouldn't have expected that to solve the OpenGL issue (I suppose it's an OpenGL issue since it happens in other OpenGL apps as well).
I think it's more a problem of Coin3d and other libraries because internally they use simple floats instead of doubles. For huge coordinates you will get rounding issues, then.
Post Reply