KiCad PCB EDA Suite
Loading...
Searching...
No Matches
3d_placeholder_utils.h File Reference
#include <math/box2.h>
#include <layer_ids.h>
#include <plugins/3dapi/xv3d_types.h>

Go to the source code of this file.

Classes

struct  EXTRUSION_MATERIAL_PROPS
 

Functions

BOX2I CalcPlaceholderLocalBox (const FOOTPRINT *aFootprint)
 Calculate a local space bounding box for a placeholder 3D model.
 
bool GetExtrusionOutline (const FOOTPRINT *aFootprint, SHAPE_POLY_SET &aOutline, PCB_LAYER_ID aLayerOverride=UNDEFINED_LAYER)
 Get the extrusion outline polygon for a footprint in board coordinates.
 
bool GetExtrusionPinOutlines (const FOOTPRINT *aFootprint, SHAPE_POLY_SET &aPinPoly, SHAPE_POLY_SET &aPegPoly)
 Get the hole outline polygons for extruded pin rendering.
 
EXTRUSION_MATERIAL_PROPS GetMaterialProps (EXTRUSION_MATERIAL aMaterial, const SFVEC3F &aDiffuse)
 
void ApplyExtrusionTransform (SHAPE_POLY_SET &aOutline, const EXTRUDED_3D_BODY *aBody, const VECTOR2I &aFpPos)
 Apply 2D extrusion transforms (rotation, scale, offset) to an outline.
 

Function Documentation

◆ ApplyExtrusionTransform()

◆ CalcPlaceholderLocalBox()

◆ GetExtrusionOutline()

bool GetExtrusionOutline ( const FOOTPRINT * aFootprint,
SHAPE_POLY_SET & aOutline,
PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER )

Get the extrusion outline polygon for a footprint in board coordinates.

Parameters
aFootprintthe footprint to extract an outline from.
aOutlineoutput polygon set.
aLayerOverridewhen not UNDEFINED_LAYER, use this layer instead of the footprint's extruded body layer setting.
Returns
true if outline was found.

Definition at line 261 of file 3d_placeholder_utils.cpp.

References SHAPE_POLY_SET::Append(), B_CrtYd, B_Fab, B_SilkS, buildFilledPolygonFromShapes(), buildPadBoundingBox(), F_CrtYd, F_Fab, F_SilkS, FlipLayer(), FOOTPRINT::GetCourtyard(), FOOTPRINT::GetExtrudedBody(), FOOTPRINT::GetReference(), FOOTPRINT::IsFlipped(), EXTRUDED_3D_BODY::m_layer, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::RemoveAllContours(), SHAPE_POLY_SET::Simplify(), UNDEFINED_LAYER, and UNSELECTED_LAYER.

Referenced by RENDER_3D_RAYTRACE_BASE::addExtrudedBodyToRaytracer(), EXPORTER_STEP::buildFootprint3DShapes(), IDF_EXPORTER::createOutlineFromExtrudedBody(), PANEL_FP_PROPERTIES_3D_MODEL::OnExportExtrudedModel(), and RENDER_3D_OPENGL::renderExtrudedBodies().

◆ GetExtrusionPinOutlines()

bool GetExtrusionPinOutlines ( const FOOTPRINT * aFootprint,
SHAPE_POLY_SET & aPinPoly,
SHAPE_POLY_SET & aPegPoly )

Get the hole outline polygons for extruded pin rendering.

Collects drill hole shapes from all pads with holes, shrunk to ~90% of the drill diameter so pins sit inside the hole. Plated holes go to aPinPoly and NPTH holes go to aPegPoly.

Returns
true if at least one hole polygon was generated.

Definition at line 349 of file 3d_placeholder_utils.cpp.

References ARC_HIGH_DEF, ERROR_INSIDE, NPTH, SHAPE_POLY_SET::OutlineCount(), pad, FOOTPRINT::Pads(), SHAPE_POLY_SET::RemoveAllContours(), and SHAPE_POLY_SET::Simplify().

Referenced by RENDER_3D_RAYTRACE_BASE::addExtrudedBodyToRaytracer(), STEP_PCB_MODEL::AddExtrudedPins(), and RENDER_3D_OPENGL::renderExtrudedBodies().

◆ GetMaterialProps()

EXTRUSION_MATERIAL_PROPS GetMaterialProps ( EXTRUSION_MATERIAL aMaterial,
const SFVEC3F & aDiffuse )