VRML export: AddArc(): width/2 exceeds radius*1.01

Bug #1536786 reported by Sourcerer
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Expired
Low

Bug Description

When exporting a converted file to VRML, I get the error message
AddArc(): width/2 exceeds radius*1.01
(from utils/idftools/vrml_layer.cpp AddArc() )
then the VRML generation stops and the there is no output file.

1. The error message does not state which arc is causing the problem, my test-file had about 100 arcs, so it was hard to find the right one. Please always add the coordinates and the layer in the error messages, so that the user can find the culprit. (I think this problem applies to lots of error messages in the VRML exporting code)

2. KiCAD does not give a warning when loading a file with such arcs or when creating such an arc, only when the VRML export is used.

3. One of the several arcs that triggered this was the Pin-1 marker (a dot / filled circle) in a footprint, so I guess that it will occur in component libraries from component vendors. I agree that an Arc where the width is larger than the radius is a bit nonsensical. But it works in KiCad 2D, 3D and Gerber and also in other PCB design applications, and I am afraid that I am altering the effectively generated output, if I try to automatically correct it to enable VRML output.

4. KiCad does not allow to ignore the arc to continue generating the rest of the VRML file. I think such arcs are not such a grave problem in the file that a VRML file should not be generated at all.

I could help with patches for this and similar problems, but I would like to know your opinion on how to solve it best first.

Revision history for this message
Nick Østergaard (nickoe) wrote :

Could you provide your VRML file as a sample for testing?

Revision history for this message
Nick Østergaard (nickoe) wrote :

And one important think I think you missed while doing a good effort in describing your problem. Which kicad version?

tags: added: vrml
Revision history for this message
Sourcerer (pg-futureware) wrote :

KiCad version 4.01, but I see the same sourcecode on the GitHub repo: https://github.com/KiCad/kicad-source-mirror/blob/c4ea4dc0dfe60cb34ac57ac9f533faf928e331cf/utils/idftools/vrml_layer.cpp

I cannot provided a VRML file as a sample, since I cannot generate one due to this bug, but I will provided a KiCAD PCB file.

Revision history for this message
Sourcerer (pg-futureware) wrote :

Now I created a better visualisation of the problem.
The rightmost arc is the problematic one, it has "grown too fat".
If you delete the arc on the right side, you can export it to VRML.

Revision history for this message
Sourcerer (pg-futureware) wrote :

How to reproduce it:
Open the file in KiCad
Click on File-Export-VRML
Click on OK.
Now you should see 2 error messages, click OK.
Now select the right arc and delete it.
Click on File-Export-VRML
Click on OK.
Now it should be exported properly.

Changed in kicad:
status: New → Confirmed
tags: added: pcbnew
Changed in kicad:
importance: Undecided → Low
Revision history for this message
Sourcerer (pg-futureware) wrote :

I would like to showcase KiCad in a few weeks, which way you want this issues fixed, so that I can develop a patch and have it running in time for the show?

Revision history for this message
Cirilo Bernardo (cirilo-bernardo) wrote : Re: [Bug 1536786] Re: VRML export: AddArc(): width/2 exceeds radius*1.01

Sorry, I had missed this one. I think the best solution is to look where
that message is issued and instead of failing, ensure that the appropriate
variable is set so that width/2 = radius * 0.99. This helps to avoid
invalid geometry in most cases, and in the cases where the geometry is bad
it will at least not be so obvious.

In general, kicad should enforce more checks to ensure this bad geometry
doesn't happen. The correct behavior depends on the exact circumstances for
the object. This is not the first time we had trouble with arcs or drill
holes.

- Cirilo

On Mon, Feb 29, 2016 at 1:49 AM, Sourcerer <email address hidden>
wrote:

> I would like to showcase KiCad in a few weeks, which way you want this
> issues fixed, so that I can develop a patch and have it running in time
> for the show?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1536786
>
> Title:
> VRML export: AddArc(): width/2 exceeds radius*1.01
>
> Status in KiCad:
> Confirmed
>
> Bug description:
> When exporting a converted file to VRML, I get the error message
> AddArc(): width/2 exceeds radius*1.01
> (from utils/idftools/vrml_layer.cpp AddArc() )
> then the VRML generation stops and the there is no output file.
>
> 1. The error message does not state which arc is causing the problem,
> my test-file had about 100 arcs, so it was hard to find the right one.
> Please always add the coordinates and the layer in the error messages,
> so that the user can find the culprit. (I think this problem applies
> to lots of error messages in the VRML exporting code)
>
> 2. KiCAD does not give a warning when loading a file with such arcs or
> when creating such an arc, only when the VRML export is used.
>
> 3. One of the several arcs that triggered this was the Pin-1 marker (a
> dot / filled circle) in a footprint, so I guess that it will occur in
> component libraries from component vendors. I agree that an Arc where
> the width is larger than the radius is a bit nonsensical. But it works
> in KiCad 2D, 3D and Gerber and also in other PCB design applications,
> and I am afraid that I am altering the effectively generated output,
> if I try to automatically correct it to enable VRML output.
>
> 4. KiCad does not allow to ignore the arc to continue generating the
> rest of the VRML file. I think such arcs are not such a grave problem
> in the file that a VRML file should not be generated at all.
>
> I could help with patches for this and similar problems, but I would
> like to know your opinion on how to solve it best first.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1536786/+subscriptions
>

Seth Hillbrand (sethh)
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
milestone: none → 5.1.0
status: Confirmed → In Progress
Revision history for this message
Seth Hillbrand (sethh) wrote :

Need to kick the can down the road on this one

Changed in kicad:
milestone: 5.1.0 → 6.0.0-rc1
status: In Progress → Triaged
tags: added: export
Revision history for this message
Cirilo Bernardo (cirilo-bernardo) wrote :
Download full text (3.3 KiB)

The factors are a bit of a bug anyway; the idea was that the width should not be
equal or greater than the diameter since the segments generated would be
nonsensical. What is really needed here is code to handle this special case;
what should the arc look like? If the arc is a complete circle and
width = diameter
then there is no hole in the glyph, but if the width is slightly
smaller then what
size hole do we allow? The issue is that in VRML a trapezoidal segment
ABCD starts to look like ABBD. I can't remember the precision of KiCad's VRML
engine anymore, but many other VRML engines are pretty awful and you never
even get the precision expected of a 32-bit float which is VRML's spec. for
coordinates. Another issue is that when the width is > diameter then a curve
drawn at the distance S from the arc will self-intersect; from the perspective
of the simple rendering algorithm used that no longer makes sense, so some
other transformation will be required to produce the desired shape, which
I presume would be whatever shape you get if you use, say, a 1.5W brush to
draw an arc with a diameter 1/2W. The shape is further complicated by the
rounded ends of the arcs, which is equivalent to spinning the brush around
when you get to the ends of the arc.

Cirilo

On Sat, Jul 27, 2019 at 7:49 PM Michael Kavanagh
<email address hidden> wrote:
>
> ** Tags added: export
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1536786
>
> Title:
> VRML export: AddArc(): width/2 exceeds radius*1.01
>
> Status in KiCad:
> Triaged
>
> Bug description:
> When exporting a converted file to VRML, I get the error message
> AddArc(): width/2 exceeds radius*1.01
> (from utils/idftools/vrml_layer.cpp AddArc() )
> then the VRML generation stops and the there is no output file.
>
> 1. The error message does not state which arc is causing the problem,
> my test-file had about 100 arcs, so it was hard to find the right one.
> Please always add the coordinates and the layer in the error messages,
> so that the user can find the culprit. (I think this problem applies
> to lots of error messages in the VRML exporting code)
>
> 2. KiCAD does not give a warning when loading a file with such arcs or
> when creating such an arc, only when the VRML export is used.
>
> 3. One of the several arcs that triggered this was the Pin-1 marker (a
> dot / filled circle) in a footprint, so I guess that it will occur in
> component libraries from component vendors. I agree that an Arc where
> the width is larger than the radius is a bit nonsensical. But it works
> in KiCad 2D, 3D and Gerber and also in other PCB design applications,
> and I am afraid that I am altering the effectively generated output,
> if I try to automatically correct it to enable VRML output.
>
> 4. KiCad does not allow to ignore the arc to continue generating the
> rest of the VRML file. I think such arcs are not such a grave problem
> in the file that a VRML file should not be generated at all.
>
> I could help with patches for this and similar problems, but I would
> like to know your opinion...

Read more...

Revision history for this message
Seth Hillbrand (sethh) wrote :

The plan is to just make it look like it does in pcbnew. Kind of like a large lima bean

Revision history for this message
Cirilo Bernardo (cirilo-bernardo) wrote :

If it looks just like in pcbnew that's the best we can do, so go ahead.

Cirilo

On Mon, Aug 5, 2019 at 8:49 AM Seth Hillbrand
<email address hidden> wrote:
>
> The plan is to just make it look like it does in pcbnew. Kind of like a
> large lima bean
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1536786
>
> Title:
> VRML export: AddArc(): width/2 exceeds radius*1.01
>
> Status in KiCad:
> Triaged
>
> Bug description:
> When exporting a converted file to VRML, I get the error message
> AddArc(): width/2 exceeds radius*1.01
> (from utils/idftools/vrml_layer.cpp AddArc() )
> then the VRML generation stops and the there is no output file.
>
> 1. The error message does not state which arc is causing the problem,
> my test-file had about 100 arcs, so it was hard to find the right one.
> Please always add the coordinates and the layer in the error messages,
> so that the user can find the culprit. (I think this problem applies
> to lots of error messages in the VRML exporting code)
>
> 2. KiCAD does not give a warning when loading a file with such arcs or
> when creating such an arc, only when the VRML export is used.
>
> 3. One of the several arcs that triggered this was the Pin-1 marker (a
> dot / filled circle) in a footprint, so I guess that it will occur in
> component libraries from component vendors. I agree that an Arc where
> the width is larger than the radius is a bit nonsensical. But it works
> in KiCad 2D, 3D and Gerber and also in other PCB design applications,
> and I am afraid that I am altering the effectively generated output,
> if I try to automatically correct it to enable VRML output.
>
> 4. KiCad does not allow to ignore the arc to continue generating the
> rest of the VRML file. I think such arcs are not such a grave problem
> in the file that a VRML file should not be generated at all.
>
> I could help with patches for this and similar problems, but I would
> like to know your opinion on how to solve it best first.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1536786/+subscriptions

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/1834

Changed in kicad:
status: Triaged → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.