DXF importer creates bad arcs representation #76908
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#76908
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-5.6.11-050611-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: GeForce GTX TITAN X/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.64
Blender Version
Broken: v2.82, v3.2
Worked: Never
Short description of error
Arcs are improperly converted to curves when imported from DXF, they are not perfectly circular.
The DXF specification doesn't mandate the use of any curve type, it just says that there is an arc with a specific radius, center, and angle. How the software draw or represents that arc is up to it. Currently, the importer represents arcs as Bezier curves, but it computes their handles wrong, which is what the report demonstrates. So a fix would then change the importer to compute the bezier handle correctly. However, as suggested by the user, since NURBS can represent arcs better (Bezier curves are approximations), then it maybe worth it to change the importer to import NURBS instead.
See http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a35.htm.
Exact steps for others to reproduce the error
I have created a simple DXF file containing one circle and one arc. Both have common center at point [0,100] and radius 100. If I import them by Blender importer, the resulting arc does not match the circle.
dxf_import-01.dxf dxf_import.blend
Added subscriber: @VaclavCermak
Added subscriber: @rjg
Changed status from 'Needs Triage' to: 'Needs User Info'
How did you create the
*.dxf
file and are you certain that your expectation with regards to the arc are valid according to the file format specification?DXF was simply drawn in BricsCAD (https://www.bricsys.com) and exported from it. So I assume that the file is valid, but I haven't checked it except reopening in BricsCAD.
Changed status from 'Needs User Info' to: 'Needs Triage'
Added subscriber: @OmarEmaraDev
Changed status from 'Needs Triage' to: 'Needs User Info'
The imported files looks like this for me. There is a tiny difference at 270, and that difference exist when I tested the files on other software. So this doesn't seem like a Blender specific issue.
Is this the difference you are describing?
Yes, its probably that difference. The curve should go exactly through [0, 0] point and it does not.
To be honest, I created it two years ago and I don't remember the exact reason for reporting it. It was probably when I imported some site plan with lot of detailed roads and their arcs were somewhat misplaced and didn't fit to other parts of that plan.
Changed status from 'Needs User Info' to: 'Confirmed'
The difference looks much larger in Blnder when compared to other software indeed. So looks like an import issue.
I'am not sure, if a circular arc can be exactly represented by bezier curves at all (I think not), so it may be fundamental problem, not some bug in calculating curve coeficients. It may be solved by using nurbs curves instead bezier ones then.
That is true, but small arcs can be approximated very well with bezier curves, so I doubt this is an intrinsic limitation.
Agreed, but...
At first, something convinced me to create this task. Unfortunately I can't remember what it was exactly. But it means, that there was a situation, when this limitation had its own impact.
And second, is there any reason not to use nurbs? When we have the opportunity to represent imported geometry exactly, why not to use it?
As for that "impact", if I import a site plan, arcs forming roads have typically big sizes. Even with small error they may be misplaced from other point element imported from the same site plan (trees, streetlights etc.) significantly. Maybe this was the problem.
Now I'am converting all arcs and circles to polylines with some CAD utility before import to Blender, so I haven't met this problem for a while. It is clumsy, however.
Perhaps Nurbs could be used as a better option, but that is up to the maintainers of the add-on, so we should just wait and see what they think about that.
Or we may try to dive into it and create a patch, it shouldn't be so hard ;-) But first I want to discuss, if there are any reasons not to use nurbs. Maybe I'am missing something.
@VaclavCermak Feel free to try to create a patch that uses NURBS to import acrs to fix this issue. Or if proven harder than expected, maybe try fixing the bezier computations first. Let us know if you need any help doing that.
Fine, I'll try that. I have looked into the source and I think that I know how and where I should add it.
Did you get anywhere with this? We use Blender with CAD a lot and struggle with the same issues you were having all of the arcs being approximate instead of absolute.
Haven't had time for that :-/ Currently I'am using a small LISP in CAD for converting all arcs to polylines before exporting DXF. And promising myself to try to look into this often ...
But now I can see, that not only me is fighting this problem ...
Ah you are probably using a similar work around to what I am having to do. Stroking / faceting the CAD elements to get more or less where you want to be. It's a shame as this is less editable after the fact.
I'll investigate from my side as well to see if there is an patch for the existing importer. It looks like a pretty well commented bit of code from my initial look.
Yes, it shouldn't be hard. But for me it is somewhere on my TODO list ...