DXF import does not start when there is a scene georeferencing #62493

Open
opened 2019-03-12 14:41:33 +01:00 by Vaclav Cermak · 30 comments

System Information
Operating system: Ubuntu 18.04
Graphics card: GeForce GTX TITAN X (GM200)

Blender Version
Broken: 2.80, e6eb7b9ccee1, 2019-03-11 23:54

DXF importer fails to start when I have a georeferencing in the scene.

Exact steps for others to reproduce the error
I have there a georeferencing created by BlenderGIS addon. My exact steps were:

  • import a SHP file with BlenderGIS - this creates the georeferencing
  • try to start DXF importer. I fails with following error:
Traceback (most recent call last):
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 550, in invoke
    self._update_use_georeferencing(context)
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 322, in _update_use_georeferencing
    _update_use_georeferencing_do(self, context)
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 154, in _update_use_georeferencing_do
    self.proj_scene = 'USER'
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/modules/bpy_types.py", line 665, in __setattr__
    return setattr(properties, attr, value)
TypeError: bpy_struct: item.attr = val: enum "USER" not found in ('NONE', 'TMERC')

When I try to run it in a fresh scene without any georeferencing, it works.

**System Information** Operating system: Ubuntu 18.04 Graphics card: GeForce GTX TITAN X (GM200) **Blender Version** Broken: 2.80, e6eb7b9ccee1, 2019-03-11 23:54 DXF importer fails to start when I have a georeferencing in the scene. **Exact steps for others to reproduce the error** I have there a georeferencing created by BlenderGIS addon. My exact steps were: - import a SHP file with BlenderGIS - this creates the georeferencing - try to start DXF importer. I fails with following error: ``` Traceback (most recent call last): File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 550, in invoke self._update_use_georeferencing(context) File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 322, in _update_use_georeferencing _update_use_georeferencing_do(self, context) File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 154, in _update_use_georeferencing_do self.proj_scene = 'USER' File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/modules/bpy_types.py", line 665, in __setattr__ return setattr(properties, attr, value) TypeError: bpy_struct: item.attr = val: enum "USER" not found in ('NONE', 'TMERC') ``` When I try to run it in a fresh scene without any georeferencing, it works.
Author

Added subscriber: @VaclavCermak

Added subscriber: @VaclavCermak

#94666 was marked as duplicate of this issue

#94666 was marked as duplicate of this issue

#86451 was marked as duplicate of this issue

#86451 was marked as duplicate of this issue
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Not sure about the exact workflow, I assume we are talking about https://github.com/domlysz/BlenderGIS?
(This addon is not maintained by blender...)

However, if you could provide a .blend file with georeferencing included, we might have a look...
(exact steps in regards to "try to start DXF importer" would help here)

Otherwise report the error over here https://github.com/domlysz/BlenderGIS/issues?

Not sure about the exact workflow, I assume we are talking about https://github.com/domlysz/BlenderGIS? (This addon is not maintained by blender...) However, if you could provide a .blend file with georeferencing included, we might have a look... (exact steps in regards to "try to start DXF importer" would help here) Otherwise report the error over here https://github.com/domlysz/BlenderGIS/issues?
Author

Yes, that BlenderGIS.

As for reproducibility of the problem, simply open provided file and try to run DXF import (File / Import / AutoCAD DXF). Assuming you have that addon enabled, of course.

dxf_import_problem.blend

Yes, that BlenderGIS. As for reproducibility of the problem, simply open provided file and try to run DXF import (File / Import / AutoCAD DXF). Assuming you have that addon enabled, of course. [dxf_import_problem.blend](https://archive.blender.org/developer/F6810163/dxf_import_problem.blend)

Added subscriber: @mont29

Added subscriber: @mont29
Remigiusz Fiedler was assigned by Bastien Montagne 2019-03-19 10:29:43 +01:00

My bet would be that your blender setup does not have access to pyproj, DXF code is probably wrong in that case? At least it seems to have a very limited set of projections defined when it cannot find that python module…

My bet would be that your blender setup does not have access to pyproj, DXF code is probably wrong in that case? At least it seems to have a very limited set of projections defined when it cannot find that python module…
Author

I have just tried to install python3-pyproj (wasn't in my system before - you are right), but no luck. Perhaps Blender is unable to reach it? I have a version downloaded as tarball from blender.org, simply extracted.

I have just tried to install python3-pyproj (wasn't in my system before - you are right), but no luck. Perhaps Blender is unable to reach it? I have a version downloaded as tarball from blender.org, simply extracted.

yes, blender archives from our download site are 'self contained', they (nearly) use no system library, so installing python pyproj on your system won't help. What you can try is copying the module files installed by that package into your blender app directory (path should be something like /path/to/blenderdir/2.80/python/lib/python3.7/), if they are pure python (with no compiled .lib binaries).

yes, blender archives from our download site are 'self contained', they (nearly) use no system library, so installing python pyproj on your system won't help. What you can try is copying the module files installed by that package into your blender app directory (path should be something like `/path/to/blenderdir/2.80/python/lib/python3.7/`), if they are pure python (with no compiled `.lib` binaries).
Member

you could also try getting it through pip

/path/to/blenderdir/2.80/python/bin/python -m ensurepip --default-pip
/path/to/blenderdir/2.80/python/bin/python -m pip install pyproj
you could also try getting it through pip ``` /path/to/blenderdir/2.80/python/bin/python -m ensurepip --default-pip /path/to/blenderdir/2.80/python/bin/python -m pip install pyproj ```
Member

with pyproj installed (through pip) I can open dxf_import_problem.blend and start the DXF import, however - workflowwise - I am unsure what to do next? I need to select a SRID, which one?

with pyproj installed (through pip) I can open `dxf_import_problem.blend` and start the DXF import, however - workflowwise - I am unsure what to do next? I need to select a SRID, which one?
Author

So one step further but not perfect. Bastien was right, with pyproj installed (by pip, but it doesn't matter) I can start dxf import.

But it immediatelly complains that "proj_create: crs not found". I have tried to select "Czech republic & Slovakia", it still complains everytime I put my mouse over dxf import panel. And when I try to start import, I get this:

Traceback (most recent call last):
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 525, in execute
    proj_scn = Proj(init=self.epsg_scene_user)
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/python/lib/python3.7/site-packages/pyproj/proj.py", line 295, in __init__
    self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs)
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/python/lib/python3.7/site-packages/pyproj/crs.py", line 224, in from_user_input
    return cls(**value)
  File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/python/lib/python3.7/site-packages/pyproj/crs.py", line 146, in __init__
    super(CRS, self).__init__(projstring)
  File "pyproj/_crs.pyx", line 322, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: +init=epsg:102067 +type=crs

It would be nice, if it was able to get CRS and geoloc defined by BlenderGIS, they are stored as custom scene properties.

So one step further but not perfect. Bastien was right, with pyproj installed (by pip, but it doesn't matter) I can start dxf import. But it immediatelly complains that "proj_create: crs not found". I have tried to select "Czech republic & Slovakia", it still complains everytime I put my mouse over dxf import panel. And when I try to start import, I get this: ``` Traceback (most recent call last): File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/scripts/addons/io_import_dxf/__init__.py", line 525, in execute proj_scn = Proj(init=self.epsg_scene_user) File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/python/lib/python3.7/site-packages/pyproj/proj.py", line 295, in __init__ self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs) File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/python/lib/python3.7/site-packages/pyproj/crs.py", line 224, in from_user_input return cls(**value) File "/opt/blender/blender-2.80-e6eb7b9ccee1-linux-glibc224-x86_64/2.80/python/lib/python3.7/site-packages/pyproj/crs.py", line 146, in __init__ super(CRS, self).__init__(projstring) File "pyproj/_crs.pyx", line 322, in pyproj._crs._CRS.__init__ pyproj.exceptions.CRSError: Invalid projection: +init=epsg:102067 +type=crs ``` It would be nice, if it was able to get CRS and geoloc defined by BlenderGIS, they are stored as custom scene properties.

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

@VaclavCermak Is this still an issue in the Blender 2.91 or 2.92 and the current version of BlenderGIS? Correct if I'm wrong but this currently sounds like a problem with a third-party add-on and its dependencies, not like a bug in Blender.

@VaclavCermak Is this still an issue in the [Blender 2.91 or 2.92 ](https://builder.blender.org/download/) and the current version of BlenderGIS? Correct if I'm wrong but this currently sounds like a problem with a third-party add-on and its dependencies, not like a bug in Blender.
Author

Yes it is. But you are right, it is not a bug in Blender. It is about incompatibility between DXF importer and BlenderGIS. Each one stores georeferencing information in a different way.

Yes it is. But you are right, it is not a bug in Blender. It is about incompatibility between DXF importer and BlenderGIS. Each one stores georeferencing information in a different way.

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

I can reproduce the issue from the original report and the error in the most recent comment when pyproj is installed and "Czech republic & Slovakia" is selected. However, I'm not sure if this is an issue with the DXF add-on, the pyproj dependency or the input data?

I can reproduce the issue from the original report and the error in the most recent comment when `pyproj` is installed and `"Czech republic & Slovakia"` is selected. However, I'm not sure if this is an issue with the DXF add-on, the pyproj dependency or the input data?

@VaclavCermak Didn't refresh the page fast enough to see your comment.

@lichtwerk @mont29 Can this be closed then or should the DXF importer get additional save guards that handle this case gracefully and therefore the ticket should be confirmed?

@VaclavCermak Didn't refresh the page fast enough to see your comment. @lichtwerk @mont29 Can this be closed then or should the DXF importer get additional save guards that handle this case gracefully and therefore the ticket should be confirmed?
Author

In my opinion either DXF importer or BlenderGIS should be made compatible to the other one.

In my opinion either DXF importer or BlenderGIS should be made compatible to the other one.

Added subscribers: @jcmind, @JaumeBellet

Added subscribers: @jcmind, @JaumeBellet

Hello.

I´ve been using this two add-ons in previous versions of Blender (prior to 2.92.0) and they worked fine, without interference on both.

My workflow starts in AutoCad > export dxf files >Import in Blender > Model the project > Import BlenderGIS info to make 3d surroundings of the project > Export as .fbs file to Twinmotion

Unfortunately i think i have to install a later version of Blender for this to work again, so i think this is an issue of Blender 2.92.0

I´m just ignorant in coding so i cannot help to solve this problem, so if you can help that would be really great because i can use the new features in Blender which are so awesome.

Thanks!!

Hello. I´ve been using this two add-ons in previous versions of Blender (prior to 2.92.0) and they worked fine, without interference on both. My workflow starts in AutoCad > export dxf files >Import in Blender > Model the project > Import BlenderGIS info to make 3d surroundings of the project > Export as .fbs file to Twinmotion Unfortunately i think i have to install a later version of Blender for this to work again, so i think this is an issue of Blender 2.92.0 I´m just ignorant in coding so i cannot help to solve this problem, so if you can help that would be really great because i can use the new features in Blender which are so awesome. Thanks!!

Uploaded diff, i imported correctly a DXF, once loaded DXF_import_problem.blend (without need to install pyproj)

Uploaded diff, i imported correctly a DXF, once loaded DXF_import_problem.blend (without need to install pyproj)

#86451 was complaining aobut "EPSG:3857" not found, the diff uploaded only adds "USER", because was the one found on blend file supplied.

Anyone knows where can be found a complete list, and how this affects to import ¿?

#86451 was complaining aobut "EPSG:3857" not found, the diff uploaded only adds "USER", because was the one found on blend file supplied. Anyone knows where can be found a complete list, and how this affects to import ¿?
Member

Added subscriber: @EAW

Added subscriber: @EAW
Member

In #62493#1128145, @JaumeBellet wrote:
#86451 was complaining aobut "EPSG:3857" not found, the diff uploaded only adds "USER", because was the one found on blend file supplied.

Anyone knows where can be found a complete list, and how this affects to import ¿?

https://epsg.io/about might be helpful.


EDIT:

@JaumeBellet There is a issue on BlenderGIS's github about this issue.

Google Translated @domlysz's relevant comment.

yes the DXF importer has apparently been modified to be compatible with the Blender-OSM addon which does not handle the georeferencing issue at all in the same way as BlenderGIS. Both tools use properties stored at the scene level, in particular SRID , longitude and latitude . The SRID corresponds to the identifier of the projection, by convention it is written in the form AUTORITHY: CODE, authority being most often EPSG. It is therefore understood that TMERC is not a valid SRID.
So why this TMERC? Well BlenderOSM always imports non-projected data (longitude / latitude) coming from the OSM database, and to limit distortions, it systematically transforms them into a local transverse Mercator projection, that is to say centered on the influence of the imported data. It is therefore, for each import, a tailor-made projection to which no SIRD corresponds. There are many standard transverse projections with an SRID, but they are not centered in the same places and do not necessarily use the same reference ellipsoid.
So much for the technical explanations, a simple solution is to remove the SRID property (scene panel> custom props), import the dxf then recreate the property. Obviously the dxf will not be aligned, it will therefore be necessary to re-center the objects according to the projected coordinates of the scene (properties created x and created y). It is also possible to use the BlenderGIS georeference management panel to set the coordinates of the origin to zero before importing the dxf.
It goes without saying that for all of this to work your data must be in the same projection, so if you used the basemaps tool with a Web Mercator service (like Google), your DXF must also be in this projection. Be vigilant on the fact that this projection induces strong distortions and is therefore to be avoided for a topo plan.

> In #62493#1128145, @JaumeBellet wrote: > #86451 was complaining aobut "EPSG:3857" not found, the diff uploaded only adds "USER", because was the one found on blend file supplied. > > Anyone knows where can be found a complete list, and how this affects to import ¿? https://epsg.io/about might be helpful. --- EDIT: @JaumeBellet There is a [issue on BlenderGIS's github](https://github.com/domlysz/BlenderGIS/issues/433) about this issue. Google Translated @domlysz's relevant comment. >yes the DXF importer has apparently been modified to be compatible with the Blender-OSM addon which does not handle the georeferencing issue at all in the same way as BlenderGIS. Both tools use properties stored at the scene level, in particular SRID , longitude and latitude . The SRID corresponds to the identifier of the projection, by convention it is written in the form AUTORITHY: CODE, authority being most often EPSG. It is therefore understood that TMERC is not a valid SRID. >So why this TMERC? Well BlenderOSM always imports non-projected data (longitude / latitude) coming from the OSM database, and to limit distortions, it systematically transforms them into a local transverse Mercator projection, that is to say centered on the influence of the imported data. It is therefore, for each import, a tailor-made projection to which no SIRD corresponds. There are many standard transverse projections with an SRID, but they are not centered in the same places and do not necessarily use the same reference ellipsoid. >So much for the technical explanations, a simple solution is to remove the SRID property (scene panel> custom props), import the dxf then recreate the property. Obviously the dxf will not be aligned, it will therefore be necessary to re-center the objects according to the projected coordinates of the scene (properties created x and created y). It is also possible to use the BlenderGIS georeference management panel to set the coordinates of the origin to zero before importing the dxf. >It goes without saying that for all of this to work your data must be in the same projection, so if you used the basemaps tool with a Web Mercator service (like Google), your DXF must also be in this projection. Be vigilant on the fact that this projection induces strong distortions and is therefore to be avoided for a topo plan.
Member

Added subscriber: @domlysz

Added subscriber: @domlysz
Member

Added subscribers: @rocstar293, @PratikPB2123

Added subscribers: @rocstar293, @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Sign in to join this conversation.
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#62493
No description provided.