Skip to content

Commit

Permalink
fix: handle undefined board thickness (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Jul 7, 2024
1 parent 3b5e8e6 commit 16eb407
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/builder/component-builder/ComponentBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ export class ComponentBuilderClass implements GenericComponentBuilder {
): Type.AnySoupElement[] {
const cadModel: ComponentProps["cadModel"] = this.pcb_properties.cadModel
if (cadModel) {
const board_thickness = bc.board_thickness ?? 0
const cad_component: CadComponent = {
type: "cad_component",
cad_component_id: bc.getId("cad_component"),
Expand All @@ -434,9 +435,9 @@ export class ComponentBuilderClass implements GenericComponentBuilder {
...pcb_component.center,
z:
pcb_component.layer === "top"
? bc.board_thickness! / 2
? board_thickness / 2
: pcb_component.layer === "bottom"
? bc.board_thickness! / -2
? board_thickness / -2
: 0,
}, // TODO set z based on layer?
layer: pcb_component.layer,
Expand Down

0 comments on commit 16eb407

Please sign in to comment.