Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

typeCAD Passives

NotificationsYou must be signed in to change notification settings

typecad/passives

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a typeCAD package that includes simple access to many passive components.

Resistors, capacitors, LEDs, diodes, fuses, and inductors

This package uses a named parameter-like interface. Any parameter can be included or left out. They can be access and modified later in code.

import{Schematic}from'@typecad/typecad'import{Resistor,LED,Capacitor,Diode,Inductor,Fuse}from'@typecad/passives/0805'import*as_0603from'@typecad/passives/0603'lettypecad=newSchematic('passives');letresistor=newResistor({reference:"R1",value:"4.7 kOhm"});letcapacitor=newCapacitor({value:"100 nF",voltage:"6 V"});letdiode=newDiode();letinductor=newInductor({value:"2.2 uH"});letfuse=newFuse({reference:"F1"});letled=new_0603.LED();// a 0603 instead of 0805typecad.create(resistor,led,capacitor,inductor,diode,fuse);

All of the sizes are:

  • @typecad/passives/1210
  • @typecad/passives/1206
  • @typecad/passives/0805
  • @typecad/passives/0603
  • @typecad/passives/0402
  • @typecad/passives/0201 *no fuses

Auto designation

If{ reference } is not included, the component will be auto-numbered. If there are any name collisions, the new name will be suffixed with a_1, ieR1_1.

☠️ Watch out

If auto-designation is used, components have the potential to move/switch/replace each other in the PCB Editor. The first component created will be x1, then x2 and so on. If there is a component added above x1 in the code, that topmost component will now be x1 and the old x1 will now be x2. This will cause them to switch places when imported into the PCB Editor. Specifying the reference for every component avoids this.

Connectors

Connectors can be created similarly.

import{Connector}from'./module/passives/connector'// create a 10-pin connector using the JST footprint passed in the last parameterletj1=newConnector({number:10,footprint:"Connector_JST:JST_SH_SM10B-SRSS-TB_1x10-1MP_P1.00mm_Horizontal"});// create a 5-pin connector using a default 2.54 mm pin-headerletj2=newConnector({number:5});

Power

Power is abstracted intypeCAD. This package includes aPower class which progressively does more as different parameters are passed.

lettypecad=newSchematic('power');letvcc_3v3=newPower({voltage:3.3,schematic:typecad});
  • creates aPower instance,voltage is optional, but allows for assertion checking voltage ranges
  • a Power Flag is also created for both power and ground


letlipo=newPower({voltage:3.3,maximum:4.2,minimum:3.2,schematic:typecad});
  • passing optionalmaximum andminimum allows for more voltage assertions


lettypecad=newSchematic('power');letvcc_5v0=newPower({voltage:5.0,schematic:typecad,power_name:"+5v0"});
  • creates a power symbol named+5v0:power
  • creates a ground symbol namedground

lettypecad=newSchematic('power');letiso_3v3=newPower({voltage:3.3,schematic:typecad,ground_name:"iso_ground"});
  • creates a power symbol named3.3:power
  • creates a ground symbol namediso_ground with a PWR_Flag attached


[8]ページ先頭

©2009-2025 Movatter.jp