Skip to content

Commit

Permalink
Merge pull request #138 from LibrePCB/add-sod-packages
Browse files Browse the repository at this point in the history
Add generator for SOD123, SOD323, SOD523 packages
  • Loading branch information
ubruhin authored Jan 20, 2025
2 parents 2ffeefe + b848ae7 commit c0b3a36
Show file tree
Hide file tree
Showing 3 changed files with 562 additions and 0 deletions.
15 changes: 15 additions & 0 deletions entities/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ def __lt__(self, other): # type: ignore
return self.uuid < other.uuid


class AlternativeName():
def __init__(self, name: str, reference: str):
self.name = name
self.reference = reference

def __str__(self) -> str:
return '(alternative_name "{}" (reference "{}"))'.format(
self.name, self.reference)


class AssemblyType(EnumValue):
NONE = 'none'
THT = 'tht'
Expand Down Expand Up @@ -305,12 +315,16 @@ def __init__(self, uuid: str, name: Name, description: Description,
self.deprecated = deprecated
self.generated_by = generated_by
self.categories = categories
self.alternative_names: List[AlternativeName] = []
self.assembly_type = assembly_type
self.pads: List[PackagePad] = []
self.models_3d: List[Package3DModel] = []
self.footprints: List[Footprint] = []
self.approvals: List[str] = []

def add_alternative_name(self, alternative_name: AlternativeName) -> None:
self.alternative_names.append(alternative_name)

def add_pad(self, pad: PackagePad) -> None:
self.pads.append(pad)

Expand All @@ -334,6 +348,7 @@ def __str__(self) -> str:
' {}\n'.format(self.deprecated) +\
' {}\n'.format(self.generated_by) +\
''.join([' {}\n'.format(cat) for cat in self.categories]) +\
''.join([' {}\n'.format(alt) for alt in self.alternative_names]) +\
' {}\n'.format(self.assembly_type)
ret += indent_entities(self.pads)
ret += indent_entities(self.models_3d)
Expand Down
Loading

0 comments on commit c0b3a36

Please sign in to comment.