Skip to content

Commit

Permalink
Fix wiper position when potentiometer scaled #142
Browse files Browse the repository at this point in the history
  • Loading branch information
mph- committed Oct 4, 2024
1 parent 350c576 commit e86714f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 8 additions & 0 deletions lcapy/schematics/components/cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ def size(self):
val = self.default_width
return float(val) * self.shape_scale

@property
def width(self):
return self.w * self.size * self.sch.node_spacing

@property
def height(self):
return self.h * self.size * self.sch.node_spacing

@property
def scale(self):
return float(self.opts.get('scale', 1.0))
Expand Down
8 changes: 0 additions & 8 deletions lcapy/schematics/components/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ class Shape(FixedCpt):
'tl': ('l', -0.5, 0.5),
'tr': ('r', 0.5, 0.5)}

@property
def width(self):
return self.w * self.size * self.sch.node_spacing

@property
def height(self):
return self.h * self.size * self.sch.node_spacing

def pinpos_rotate(self, pinpos, angle):
"""Rotate pinpos by multiple of 90 degrees. pinpos is either 'l',
't', 'r', 'b'."""
Expand Down
8 changes: 5 additions & 3 deletions lcapy/schemcpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,14 +718,16 @@ class Potentiometer(Bipole):
"""Potentiometer Np, Nm, No"""

# This is not really a bipole but circuitikz treats it as such
# Note, the wiper position is not scaled if the component
# is stretched or scaled.

can_stretch = False

node_pinnames = ('p', 'n', 'wiper')
aliases = {'+': 'p', '-': 'n'}
pins = {'p': ('rx', 0, 0),
'n': ('rx', 1, 0),
'wiper': ('lx', 0.5, 0.3)}
pins = {'p': ('rx', -0.5, 0),
'n': ('rx', 0.5, 0),
'wiper': ('l', 0.0, 0.3)}


class VCS(Bipole):
Expand Down

0 comments on commit e86714f

Please sign in to comment.