From 8174e1aefd6e9d941d8d394dc156884280c03fff Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 2 Aug 2015 20:59:29 +0200 Subject: [PATCH] 3D viewer: speed up the silkscreen layer generation (not perfect, but it help). --- 3d-viewer/3d_draw_board_body.cpp | 85 ++---------- demos/electric/electric-cache.lib | 15 ++ demos/electric/electric.pro | 37 +---- demos/electric/electric.sch | 218 ++++++------------------------ 4 files changed, 73 insertions(+), 282 deletions(-) diff --git a/3d-viewer/3d_draw_board_body.cpp b/3d-viewer/3d_draw_board_body.cpp index bde6004551..de0f45d572 100644 --- a/3d-viewer/3d_draw_board_body.cpp +++ b/3d-viewer/3d_draw_board_body.cpp @@ -70,68 +70,6 @@ */ GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer ); -#if 0 - -// FIX ME: these 2 functions are fully duplicate of the same 2 functions in -// pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp -static const SHAPE_POLY_SET convertPolyListToPolySet(const CPOLYGONS_LIST& aList) -{ - SHAPE_POLY_SET rv; - unsigned corners_count = aList.GetCornersCount(); - - // Enter main outline: this is the first contour - unsigned ic = 0; - - if(!corners_count) - return rv; - - while( ic < corners_count ) - { - rv.NewOutline( ); - - while( ic < corners_count ) - { - rv.Append( aList.GetX(ic), aList.GetY(ic) ); - if( aList.IsEndContour( ic ) ) - break; - - ic++; - } - ic++; - } - - return rv; -} - - -static const CPOLYGONS_LIST convertPolySetToPolyList(const SHAPE_POLY_SET& aPolyset) -{ - CPOLYGONS_LIST list; - CPolyPt corner, firstCorner; - - for( int ii = 0; ii < aPolyset.OutlineCount(); ii++ ) - { - for( int jj = 0; jj < aPolyset.VertexCount(ii); jj++ ) - { - VECTOR2I v = aPolyset.GetVertex( jj, ii ); - corner.x = v.x; - corner.y = v.y; - corner.end_contour = false; - - if(!jj) - firstCorner = corner; - - list.AddCorner( corner ); - } - - firstCorner.end_contour = true; - list.AddCorner( firstCorner ); - } - - return list; -} - -#endif void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, REPORTER* aErrorMessages, REPORTER* aActivity ) @@ -158,7 +96,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, // to reduce time calculations // for holes and items which do not need // a fine representation - double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2.0) ); + double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2.0) ); SHAPE_POLY_SET bufferPolys; SHAPE_POLY_SET bufferPcbOutlines; // stores the board main outlines @@ -173,9 +111,8 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, { if( aErrorMessages ) { - msg << wxT("\n") << - _("Unable to calculate the board outlines.\n" - "Therefore use the board boundary box.") << wxT("\n\n"); + msg << wxT("\n") << _("Unable to calculate the board outlines.\n" + "Therefore use the board boundary box.") << wxT("\n\n"); aErrorMessages->Report( msg, REPORTER::RPT_WARNING ); } @@ -338,7 +275,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList, case PCB_TEXT_T: ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( - bufferPolys, 0, segcountforcircle, correctionFactor ); + bufferPolys, 0, segcountLowQuality, correctionFactor ); break; default: @@ -576,7 +513,7 @@ void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* a case PCB_TEXT_T: ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( - bufferPolys, 0, segcountforcircle, correctionFactor ); + bufferPolys, 0, segcountLowQuality, correctionFactorLQ ); break; default: @@ -605,7 +542,7 @@ void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* a bufferPolys, 0, segcountforcircle, correctionFactor ); module->TransformGraphicShapesWithClearanceToPolygonSet( layer, - bufferPolys, 0, segcountforcircle, correctionFactor ); + bufferPolys, 0, segcountLowQuality, correctionFactorLQ ); } // Draw non copper zones @@ -642,23 +579,23 @@ void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* a bufferPolys.BooleanSubtract( cuts ); } - // Remove holes from Solder paste layers and siklscreen + // Remove holes from Solder paste layers and silkscreen else if( layer == B_Paste || layer == F_Paste || layer == B_SilkS || layer == F_SilkS ) { - bufferPolys.BooleanSubtract( allLayerHoles ); } + // Convert each polygon with holes to + // a polygon with its holes linked to the main outline bufferPolys.Fracture(); - - int thickness = 0; + int thickness = 0; if( layer != B_Mask && layer != F_Mask ) thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer ); - int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer ); + int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer ); if( layer == Edge_Cuts ) { diff --git a/demos/electric/electric-cache.lib b/demos/electric/electric-cache.lib index f9c4aad505..8db5798f1d 100644 --- a/demos/electric/electric-cache.lib +++ b/demos/electric/electric-cache.lib @@ -457,6 +457,21 @@ X ~ 2 200 0 118 L 10 40 1 1 w ENDDRAW ENDDEF # +# V_F50Hz +# +DEF V_F50Hz EV 0 10 N Y 1 F N +F0 "EV" -160 120 40 H V C CNN +F1 "V_F50Hz" -40 -140 40 H V C CNN +F2 "" 0 0 60 H V C CNN +F3 "" 0 0 60 H V C CNN +DRAW +T 0 0 0 50 0 0 0 Hz Normal 0 C C +P 2 0 0 0 200 -200 200 -200 N +C 0 0 84 0 1 0 N +X ~ 1 200 0 118 L 10 40 1 1 W +ENDDRAW +ENDDEF +# # V_U400V # DEF V_U400V EV 0 10 N Y 1 F N diff --git a/demos/electric/electric.pro b/demos/electric/electric.pro index f8d0be7fdb..52b1ed878a 100644 --- a/demos/electric/electric.pro +++ b/demos/electric/electric.pro @@ -1,5 +1,5 @@ -update=25/11/2004-08:01:24 -last_client=eeschema +update=02/08/2015 19:59:42 +last_client=kicad [general] version=1 RootSch=electric.sch @@ -7,39 +7,8 @@ BoardNm=electric.brd [eeschema] version=1 LibDir= -NetFmt=1 -HPGLSpd=20 -HPGLDm=15 -HPGLNum=1 -offX_A4=0 -offY_A4=0 -offX_A3=0 -offY_A3=0 -offX_A2=0 -offY_A2=0 -offX_A1=0 -offY_A1=0 -offX_A0=0 -offY_A0=0 -offX_A=0 -offY_A=0 -offX_B=0 -offY_B=0 -offX_C=0 -offY_C=0 -offX_D=0 -offY_D=0 -offX_E=0 -offY_E=0 -RptD_X=0 -RptD_Y=100 -RptLab=1 -PenMin=20 -SimCmd= -UseNetN=0 -[eeschema/Libraries] +[eeschema/libraries] LibName1=power LibName2=elec-unifil LibName3=device LibName4=conn -LibName5=regul diff --git a/demos/electric/electric.sch b/demos/electric/electric.sch index d0308f0402..2c4acfefe1 100644 --- a/demos/electric/electric.sch +++ b/demos/electric/electric.sch @@ -1,11 +1,12 @@ EESchema Schematic File Version 2 +LIBS:electric-rescue LIBS:power LIBS:elec-unifil LIBS:device LIBS:conn LIBS:regul LIBS:electric-cache -EELAYER 24 0 +EELAYER 25 0 EELAYER END $Descr A4 11693 8268 encoding utf-8 @@ -25,50 +26,38 @@ Wire Notes Line 3850 2850 4700 2850 Connection ~ 8250 2900 Wire Wire Line - 8250 2400 8350 2400 + 5250 2400 8350 2400 Wire Wire Line - 8150 2900 8250 2900 -Wire Wire Line - 8250 2900 8350 2900 + 5250 2900 8350 2900 Wire Wire Line 4450 2400 4850 2400 Wire Wire Line - 4850 1900 4550 1900 + 4450 1900 4850 1900 Wire Wire Line - 4550 1900 4450 1900 -Wire Wire Line - 5600 1900 5700 1900 + 5250 1900 5700 1900 Wire Notes Line 5500 550 5600 550 Wire Notes Line 5500 1650 5500 550 Wire Notes Line - 5550 1650 5500 1650 + 5500 1650 8100 1650 Wire Notes Line - 5500 2200 5550 2200 + 5500 2200 8100 2200 Wire Notes Line 5500 1700 5500 2200 Wire Notes Line - 5550 1700 5500 1700 -Wire Wire Line - 5250 1900 5600 1900 + 5500 1700 8100 1700 Connection ~ 3950 1900 Connection ~ 3150 2450 Connection ~ 4550 1900 Wire Wire Line - 2600 800 2600 1400 + 2600 800 2600 1900 Wire Wire Line - 4550 800 2600 800 + 2600 800 5700 800 Wire Wire Line 4550 800 4550 1900 Wire Wire Line - 4950 800 4550 800 -Wire Wire Line - 5350 2900 5250 2900 -Wire Wire Line - 5350 2400 5250 2400 -Wire Wire Line - 4850 2900 4850 2400 + 4850 2400 4850 2900 Wire Wire Line 3750 2450 4050 2450 Wire Wire Line @@ -76,21 +65,13 @@ Wire Wire Line Wire Wire Line 3950 1900 3950 2400 Wire Wire Line - 3850 1950 4050 1950 + 3150 1950 4050 1950 Wire Wire Line - 3850 1900 3950 1900 + 3100 1900 4050 1900 Wire Wire Line - 3950 1900 4050 1900 -Wire Wire Line - 3150 2450 3350 2450 -Wire Wire Line - 3150 1950 3200 1950 + 3000 2450 3350 2450 Wire Wire Line 3150 2450 3150 1950 -Wire Wire Line - 3000 2450 3150 2450 -Wire Wire Line - 3100 1900 3150 1900 Wire Wire Line 3100 2400 3100 1900 Wire Wire Line @@ -98,21 +79,15 @@ Wire Wire Line Wire Notes Line 3850 2050 3850 2850 Wire Notes Line - 3800 2050 3850 2050 -Wire Notes Line - 3750 2050 3800 2050 + 3250 2050 3850 2050 Wire Notes Line 3250 2050 3250 3100 Wire Notes Line - 4700 1150 4700 2850 + 4700 2850 4700 1150 Wire Notes Line - 4750 1150 4700 1150 -Wire Notes Line - 5400 3100 5350 3100 + 4700 1150 5400 1150 Wire Notes Line 5400 1150 5400 3100 -Wire Notes Line - 5350 1150 5400 1150 Wire Notes Line 8100 6000 8100 3150 Wire Notes Line @@ -121,16 +96,6 @@ Wire Notes Line 5500 3150 8100 3150 Text Notes 4150 3000 0 60 ~ 0 AGBT -Wire Notes Line - 5350 1150 4750 1150 -Wire Notes Line - 3250 2050 3750 2050 -Wire Wire Line - 3850 1950 3200 1950 -Wire Wire Line - 3150 1900 3850 1900 -Wire Wire Line - 2600 1900 2600 1400 Wire Wire Line 1550 950 1800 950 Wire Wire Line @@ -156,13 +121,13 @@ Wire Wire Line Wire Wire Line 1700 2150 1750 2150 Wire Wire Line - 1950 3350 1700 3350 + 1700 3350 5700 3350 Wire Wire Line - 1950 3850 1700 3850 + 1700 3850 5400 3850 Wire Wire Line - 1950 4350 1700 4350 + 1700 4350 2350 4350 Wire Wire Line - 1950 4850 1700 4850 + 1700 4850 2050 4850 Wire Wire Line 850 4850 1200 4850 Wire Wire Line @@ -211,17 +176,9 @@ Connection ~ 2050 7300 Connection ~ 2050 6950 Connection ~ 2050 6600 Wire Wire Line - 2050 4850 1950 4850 + 2050 4850 2050 7550 Wire Wire Line - 2050 6600 2050 4850 -Wire Wire Line - 2050 7550 2050 7300 -Wire Wire Line - 2050 7300 2050 6950 -Wire Wire Line - 2050 6950 2050 6600 -Wire Wire Line - 2350 7550 2050 7550 + 2050 7550 2350 7550 Wire Wire Line 2350 7300 2050 7300 Wire Wire Line @@ -239,11 +196,9 @@ Wire Notes Line Wire Notes Line 2150 4100 2150 6300 Wire Wire Line - 5400 6100 5450 6100 + 5400 6100 8350 6100 Wire Wire Line 5400 3850 5400 6100 -Wire Wire Line - 1950 3850 5400 3850 Wire Notes Line 5500 6000 8100 6000 Text Notes 10150 6250 0 60 ~ 0 @@ -257,13 +212,7 @@ Wire Notes Line Wire Notes Line 8150 4200 11100 4200 Wire Wire Line - 8250 4450 8250 4800 -Wire Wire Line - 8250 4800 8250 5400 -Wire Wire Line - 8250 5400 8250 5750 -Wire Wire Line - 8250 5750 8250 6100 + 8250 4450 8250 6100 Wire Wire Line 8750 5100 8750 5400 Wire Wire Line @@ -296,33 +245,21 @@ Wire Notes Line Wire Notes Line 8150 2650 11100 2650 Wire Notes Line - 11100 2600 11100 2200 + 11100 500 11100 2600 Wire Notes Line 8150 2600 11100 2600 Wire Notes Line - 8150 2200 8150 2600 -Wire Notes Line - 5600 2200 5550 2200 -Wire Notes Line - 8100 2200 5600 2200 + 8150 500 8150 2600 Wire Notes Line 8100 1700 8100 2200 -Wire Notes Line - 5550 1700 8100 1700 Wire Notes Line 8100 1650 8100 550 -Wire Notes Line - 5550 1650 8100 1650 Wire Notes Line 8100 550 5550 550 Wire Notes Line 11100 500 8150 500 -Wire Notes Line - 11100 2200 11100 500 Wire Notes Line 11050 500 11050 500 -Wire Notes Line - 8150 500 8150 2200 $Comp L D_06A ED30 U 1 1 41642C2F @@ -779,25 +716,11 @@ Wire Wire Line Wire Wire Line 8250 3950 8350 3950 Wire Wire Line - 8250 3250 8250 3600 -Wire Wire Line - 8250 3600 8250 3950 + 8250 2900 8250 3950 Wire Wire Line 8350 3250 8250 3250 Wire Wire Line - 8250 2900 8250 3250 -Wire Wire Line - 5350 2900 8150 2900 -Wire Wire Line - 8250 650 8250 1000 -Wire Wire Line - 8250 1000 8250 1350 -Wire Wire Line - 8250 1350 8250 1700 -Wire Wire Line - 8250 1700 8250 2050 -Wire Wire Line - 8250 2050 8250 2400 + 8250 650 8250 2400 Text HLabel 6500 800 2 60 Output ~ 0 EC12 $Comp @@ -812,10 +735,6 @@ F 3 "" H 6300 800 60 0001 C CNN 1 0 0 -1 $EndComp Connection ~ 850 2750 -Wire Wire Line - 5450 6100 8250 6100 -Wire Wire Line - 8250 6100 8350 6100 Connection ~ 8250 6100 Connection ~ 8250 4800 Connection ~ 8250 5400 @@ -828,12 +747,6 @@ Wire Wire Line 8350 4800 8250 4800 Wire Wire Line 8350 4450 8250 4450 -Wire Wire Line - 5350 2400 8250 2400 -Wire Wire Line - 2350 4350 2250 4350 -Wire Wire Line - 2250 4350 1950 4350 Connection ~ 2250 4350 Connection ~ 2250 5750 Connection ~ 2250 5400 @@ -842,23 +755,15 @@ Connection ~ 2250 4700 Wire Wire Line 2350 4700 2250 4700 Wire Wire Line - 2350 5050 2250 5050 + 2250 5050 2350 5050 Wire Wire Line - 2350 5400 2250 5400 + 2250 5400 2350 5400 Wire Wire Line - 2350 5750 2250 5750 + 2250 5750 2350 5750 Wire Wire Line 2250 6100 2350 6100 Wire Wire Line - 2250 4350 2250 4700 -Wire Wire Line - 2250 4700 2250 5050 -Wire Wire Line - 2250 5050 2250 5400 -Wire Wire Line - 2250 5400 2250 5750 -Wire Wire Line - 2250 5750 2250 6100 + 2250 4350 2250 6100 $Comp L D_10A ED73 U 1 1 4162F22A @@ -1032,37 +937,21 @@ Connection ~ 5600 4050 Connection ~ 5600 3700 Connection ~ 5600 3350 Wire Wire Line - 5700 3350 5600 3350 + 5600 5450 5700 5450 Wire Wire Line - 5600 3350 1950 3350 + 5600 5100 5700 5100 Wire Wire Line - 5700 5450 5600 5450 + 5600 4750 5700 4750 Wire Wire Line - 5700 5100 5600 5100 + 5600 4400 5700 4400 Wire Wire Line - 5700 4750 5600 4750 -Wire Wire Line - 5700 4400 5600 4400 -Wire Wire Line - 5700 4050 5600 4050 + 5600 4050 5700 4050 Wire Wire Line 5700 3700 5600 3700 Wire Wire Line 5600 5800 5700 5800 Wire Wire Line - 5600 3350 5600 3700 -Wire Wire Line - 5600 3700 5600 4050 -Wire Wire Line - 5600 4050 5600 4400 -Wire Wire Line - 5600 4400 5600 4750 -Wire Wire Line - 5600 4750 5600 5100 -Wire Wire Line - 5600 5100 5600 5450 -Wire Wire Line - 5600 5450 5600 5800 + 5600 3350 5600 5800 $Comp L D_10A ED47 U 1 1 4162F76B @@ -1180,8 +1069,6 @@ Connection ~ 8250 2050 Connection ~ 8250 1700 Connection ~ 8250 1350 Connection ~ 8250 1000 -Connection ~ 8250 1000 -Connection ~ 8250 1000 Wire Wire Line 8250 1000 8350 1000 Wire Wire Line @@ -1195,15 +1082,9 @@ Wire Wire Line Wire Wire Line 5600 1150 5700 1150 Wire Wire Line - 4950 800 5600 800 + 5600 800 5600 1500 Wire Wire Line - 5600 800 5700 800 -Wire Wire Line - 5600 1500 5600 1150 -Wire Wire Line - 5600 1150 5600 800 -Wire Wire Line - 5700 1500 5600 1500 + 5600 1500 5700 1500 $Comp L D_06A ED15 U 1 1 4162F301 @@ -1330,18 +1211,7 @@ Connection ~ 850 4350 Connection ~ 850 3850 Connection ~ 850 3350 Wire Wire Line - 850 1350 850 1500 -Wire Wire Line - 850 1500 850 2750 -Wire Wire Line - 850 2750 850 3350 -Wire Wire Line - 850 3350 850 3850 -Wire Wire Line - 850 3850 850 4350 -Wire Wire Line - 850 4350 850 4850 -Connection ~ 850 1500 + 850 1350 850 4850 $Comp L O_600VA EO2 U 1 1 4162E0E4 @@ -1378,7 +1248,7 @@ F 3 "isolation HT " H 5150 600 30 0000 C CNN $EndComp Connection ~ 4350 1900 $Comp -L V_F50HZ EV2 +L V_F50Hz EV2 U 1 1 4162DD75 P 2400 1400 F 0 "EV2" H 2400 1550 40 0000 C CNN