OCCT 3D model export: support different line styles for graphics.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18873
This commit is contained in:
Alex Shvartzkop 2025-04-14 07:01:55 +03:00
parent 16b4ee92bb
commit ad12fbd2f9

View File

@ -33,6 +33,7 @@
#include <pcb_tablecell.h>
#include <pcb_track.h>
#include <pcb_shape.h>
#include <pcb_painter.h>
#include <pad.h>
#include <zone.h>
#include <fp_lib_table.h>
@ -530,8 +531,39 @@ bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
return true;
}
graphic->TransformShapeToPolySet( m_poly_shapes[pcblayer], pcblayer, 0, maxError,
ERROR_INSIDE );
LINE_STYLE lineStyle = graphic->GetLineStyle();
if( lineStyle == LINE_STYLE::SOLID )
{
graphic->TransformShapeToPolySet( m_poly_shapes[pcblayer], pcblayer, 0, maxError,
ERROR_INSIDE );
}
else
{
std::vector<SHAPE*> shapes = graphic->MakeEffectiveShapes( true );
const PCB_PLOT_PARAMS& plotParams = m_board->GetPlotOptions();
KIGFX::PCB_RENDER_SETTINGS renderSettings;
renderSettings.SetDashLengthRatio( plotParams.GetDashedLineDashRatio() );
renderSettings.SetGapLengthRatio( plotParams.GetDashedLineGapRatio() );
for( SHAPE* shape : shapes )
{
STROKE_PARAMS::Stroke( shape, lineStyle, graphic->GetWidth(), &renderSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
SHAPE_SEGMENT seg( a, b, graphic->GetWidth() );
seg.TransformToPolygon( m_poly_shapes[pcblayer],
maxError, ERROR_INSIDE );
} );
}
for( SHAPE* shape : shapes )
delete shape;
}
if( graphic->IsHatchedFill() )
m_poly_shapes[pcblayer].Append( graphic->GetHatching() );
break;
}