D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T ) { m_NumPadName = 0; m_Size.x = m_Size.y = DMils2iu( 600 ); // Default pad size 60 mils. m_Drill.x = m_Drill.y = DMils2iu( 300 ); // Default drill size 30 mils. m_Orient = 0; // Pad rotation in 1/10 degrees. m_LengthPadToDie = 0; if( m_Parent && m_Parent->Type() == PCB_MODULE_T ) { m_Pos = GetParent()->GetPosition(); } SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE. SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle. m_Attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole) m_LocalClearance = 0; m_LocalSolderMaskMargin = 0; m_LocalSolderPasteMargin = 0; m_LocalSolderPasteMarginRatio = 0.0; m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use parent setting by default m_ThermalWidth = 0; // Use parent setting by default m_ThermalGap = 0; // Use parent setting by default // Set layers mask to default for a standard thru hole pad. m_layerMask = StandardMask(); SetSubRatsnest( 0 ); // used in ratsnest calculations m_boundingRadius = -1; }
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : m_Pad_Master( 0 ) { m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. // SetCopperLayerCount() will adjust this. SetVisibleLayers( FULL_LAYERS ); // set all but hidden text as visible. m_VisibleElements = ~( 1 << MOD_TEXT_INVISIBLE ); SetCopperLayerCount( 2 ); // Default design is a double sided board // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA). m_CurrentViaType = VIA_THROUGH; // if true, when creating a new track starting on an existing track, use this track width m_UseConnectedTrackWidth = false; m_BlindBuriedViaAllowed = false; // true to allow blind/buried vias m_MicroViasAllowed = false; // true to allow micro vias m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer) m_EdgeSegmentWidth = DEFAULT_PCB_EDGE_THICKNESS; // current graphic line width (EDGE layer only) m_PcbTextWidth = DEFAULT_TEXT_PCB_THICKNESS; // current Pcb (not module) Text width m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE, DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size m_TrackMinWidth = DMils2iu( 100 ); // track min value for width ((min copper size value m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter m_MicroViasMinSize = DMils2iu( 200 ); // micro vias (not vias) min diameter m_MicroViasMinDrill = DMils2iu( 50 ); // micro vias (not vias) min drill diameter // Global mask margins: m_SolderMaskMargin = DEFAULT_SOLDERMASK_CLEARANCE; // Solder mask margin m_SolderMaskMinWidth = DEFAULT_SOLDERMASK_MIN_WIDTH; // Solder mask min width m_SolderPasteMargin = 0; // Solder paste margin absolute value m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size // The final margin is the sum of these 2 values // Usually < 0 because the mask is smaller than pad m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE, DEFAULT_TEXT_MODULE_SIZE ); m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS; m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS; // Layer thickness for 3D viewer m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM ); }
void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) { const int arrowz = DMils2iu( 500 ); // size of arrows int ii; int measure, deltax, deltay; // value of the measure on X and Y axes int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line / int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\' int hx, hy; // dimension line interval double angle, angle_f; wxString msg; // Init layer : m_Text.SetLayer( GetLayer() ); // calculate the size of the dimension (text + line above the text) ii = m_Text.GetSize().y + m_Text.GetThickness() + (m_Width * 3); deltax = m_featureLineDO.x - m_featureLineGO.x; deltay = m_featureLineDO.y - m_featureLineGO.y; // Calculate dimension value measure = KiROUND( hypot( deltax, deltay ) ); angle = atan2( deltay, deltax ); // Calculation of parameters X and Y dimensions of the arrows and lines. hx = hy = ii; // Taking into account the slope of the side lines. if( measure ) { hx = abs( KiROUND( ( (double) deltay * hx ) / measure ) ); hy = abs( KiROUND( ( (double) deltax * hy ) / measure ) ); if( m_featureLineGO.x > m_crossBarO.x ) hx = -hx; if( m_featureLineGO.x == m_crossBarO.x ) hx = 0; if( m_featureLineGO.y > m_crossBarO.y ) hy = -hy; if( m_featureLineGO.y == m_crossBarO.y ) hy = 0; angle_f = angle + DEG2RAD( 27.5 ); arrow_up_X = wxRound( arrowz * cos( angle_f ) ); arrow_up_Y = wxRound( arrowz * sin( angle_f ) ); angle_f = angle - DEG2RAD( 27.5 ); arrow_dw_X = wxRound( arrowz * cos( angle_f ) ); arrow_dw_Y = wxRound( arrowz * sin( angle_f ) ); } int dx = KiROUND( m_Height * cos( angle + M_PI / 2 ) ); int dy = KiROUND( m_Height * sin( angle + M_PI / 2 ) ); m_crossBarO.x = m_featureLineGO.x + dx; m_crossBarO.y = m_featureLineGO.y + dy; m_crossBarF.x = m_featureLineDO.x + dx; m_crossBarF.y = m_featureLineDO.y + dy; m_arrowG1F.x = m_crossBarO.x + arrow_up_X; m_arrowG1F.y = m_crossBarO.y + arrow_up_Y; m_arrowG2F.x = m_crossBarO.x + arrow_dw_X; m_arrowG2F.y = m_crossBarO.y + arrow_dw_Y; /* The right arrow is symmetrical to the left. * / = -\ and \ = -/ */ m_arrowD1F.x = m_crossBarF.x - arrow_dw_X; m_arrowD1F.y = m_crossBarF.y - arrow_dw_Y; m_arrowD2F.x = m_crossBarF.x - arrow_up_X; m_arrowD2F.y = m_crossBarF.y - arrow_up_Y; m_featureLineGF.x = m_crossBarO.x + hx; m_featureLineGF.y = m_crossBarO.y + hy; m_featureLineDF.x = m_crossBarF.x + hx; m_featureLineDF.y = m_crossBarF.y + hy; // Calculate the better text position and orientation: wxPoint textPos; textPos.x = (m_crossBarF.x + m_featureLineGF.x) / 2; textPos.y = (m_crossBarF.y + m_featureLineGF.y) / 2; m_Text.SetTextPosition( textPos ); double newAngle = -RAD2DECIDEG( angle ); NORMALIZE_ANGLE_POS( newAngle ); if( newAngle > 900 && newAngle < 2700 ) newAngle -= 1800; m_Text.SetOrientation( newAngle ); if( !aDoNotChangeText ) { m_Value = measure; msg = ::CoordinateToString( m_Value ); SetText( msg ); } }
#include <fctsys.h> #include <common.h> #include <kicad_string.h> #include <pcbnew.h> #include <richio.h> #include <macros.h> #include <class_board.h> #include <class_netclass.h> // This will get mapped to "kicad_default" in the specctra_export. const wxString NETCLASS::Default = wxT("Default"); // Initial values for netclass initialization int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance int NETCLASS::DEFAULT_VIA_DRILL = DMils2iu( 250 ); // default via drill int NETCLASS::DEFAULT_UVIA_DRILL = DMils2iu( 50 ); // micro via drill NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) : m_Parent( aParent ), m_Name( aName ) { // use initialParameters if not NULL, else set the initial // parameters from boardDesignSettings (try to change this) SetParams( initialParameters ); } void NETCLASS::SetParams( const NETCLASS* defaults )