Skip to content

Commit

Permalink
Merge pull request #13 from Grazfather/led_model
Browse files Browse the repository at this point in the history
Add ability to add model for led_sk6812mini-e
  • Loading branch information
ceoloide authored Mar 31, 2024
2 parents ac4c77c + 1710946 commit 1f265eb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions led_sk6812mini-e.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@
// if true it will include the part courtyard
// include_keepout: default is false
// if true it will include the part keepout area
// led_3dmodel_filename: default is ''
// Allows you to specify the path to a 3D model STEP or WRL file to be
// used when rendering the PCB. Use the ${VAR_NAME} syntax to point to
// a KiCad configured path.
// led_3dmodel_xyz_offset: default is [0, 0, 0]
// xyz offset (in mm), used to adjust the position of the 3d model
// relative the footprint.
// led_3dmodel_xyz_scale: default is [1, 1, 1]
// xyz scale, used to adjust the size of the 3d model relative to its
// original size.
// led_3dmodel_xyz_rotation: default is [0, 0, 0]
// xyz rotation (in degrees), used to adjust the orientation of the 3d
// model relative the footprint.

module.exports = {
params: {
Expand All @@ -71,6 +84,10 @@ module.exports = {
via_drill: 0.4,
include_courtyard: true,
include_keepout: false,
led_3dmodel_filename: '',
led_3dmodel_xyz_offset: [0, 0, 0],
led_3dmodel_xyz_rotation: [0, 0, 0],
led_3dmodel_xyz_scale: [1, 1, 1],
P1: { type: 'net', value: 'VCC' },
P2: undefined,
P3: { type: 'net', value: 'GND' },
Expand Down Expand Up @@ -315,6 +332,13 @@ module.exports = {
)
`

const led_3dmodel = `
(model ${p.led_3dmodel_filename}
(offset (xyz ${p.led_3dmodel_xyz_offset[0]} ${p.led_3dmodel_xyz_offset[1]} ${p.led_3dmodel_xyz_offset[2]}))
(scale (xyz ${p.led_3dmodel_xyz_scale[0]} ${p.led_3dmodel_xyz_scale[1]} ${p.led_3dmodel_xyz_scale[2]}))
(rotate (xyz ${p.led_3dmodel_xyz_rotation[0]} ${p.led_3dmodel_xyz_rotation[1]} ${p.led_3dmodel_xyz_rotation[2]})))
`

let final = standard_opening;

if (p.side == "F" || p.reversible) {
Expand Down Expand Up @@ -342,6 +366,10 @@ module.exports = {
}
}

if (p.led_3dmodel_filename) {
final += led_3dmodel
}

final += standard_closing;
if (p.include_keepout) {
final += keepout;
Expand Down

0 comments on commit 1f265eb

Please sign in to comment.