kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #18087
PATCH: VRML export, bug 1448192
Attached is a patch for bug 1448192:
https://bugs.launchpad.net/kicad/+bug/1448192
Problem: Arcs in modules were rendered incorrectly on export.
Cause: Rotation angle was not negated when PCB coordinates were
converted to VRML coordinates.
The patch also fixes an unreported bug: I forgot to scale the PCB
units when exporting an arc on the PCB. This resulted in a waste
of computing resources since the code attempts to model arcs
on the order of 6x10^7m with a maximum error of ~0.001mm. It's
surprising how long some bugs escape detection despite the
number of people using the software.
- Cirilo
=== modified file 'pcbnew/exporters/export_vrml.cpp'
--- pcbnew/exporters/export_vrml.cpp 2015-04-10 07:30:21 +0000
+++ pcbnew/exporters/export_vrml.cpp 2015-04-27 06:53:58 +0000
@@ -569,7 +569,7 @@
centery = -centery;
arc_starty = -arc_starty;
- if( !vlayer->AddArc( centerx, centery, arc_startx, arc_starty, width, arc_angle, false ) )
+ if( !vlayer->AddArc( centerx, centery, arc_startx, arc_starty, width, -arc_angle, false ) )
throw( std::runtime_error( vlayer->GetError() ) );
}
@@ -592,10 +592,10 @@
{
case S_ARC:
export_vrml_arc( aModel, layer,
- (double) drawseg->GetCenter().x,
- (double) drawseg->GetCenter().y,
- (double) drawseg->GetArcStart().x,
- (double) drawseg->GetArcStart().y,
+ (double) drawseg->GetCenter().x * aModel.scale,
+ (double) drawseg->GetCenter().y * aModel.scale,
+ (double) drawseg->GetArcStart().x * aModel.scale,
+ (double) drawseg->GetArcStart().y * aModel.scale,
w, drawseg->GetAngle() / 10 );
break;
Follow ups