-
Notifications
You must be signed in to change notification settings - Fork 173
Ring pad support inspired by wuerth electronics smd mounting hardware #351
Conversation
Code Climate has analyzed commit 6385473 and detected 85 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
010fc96
to
2a4ea5b
Compare
4808380
to
7f45734
Compare
c543fc5
to
26ce593
Compare
@pointhi do you have any feedback? Or simply no time? |
I did a rough check and think it should be ok. I would suggest to not rely on Multiple Inheritance to much, because it makes code harder to read and more error prone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some points that cannot be tied to a specific line:
- Can the file
KicadModTree/nodes/specialized/Rotation.py
and related tests be removed? I don't see what it does, its not used at all. And based on the name it seems to be redundant. - I did not do a in depth review of the new tests. Just a quick look around.
- geometry_utils.py is quite a lot of stuff. I read the whole thing, but did only verify a few of the geometric heavy functions
Some files I did not review yet:
- The actual generator script and the .yaml file
- RingPad.py
* *origin* (``Vector2D``) | ||
origin point for the rotation. default: (0, 0) | ||
* *use_degrees* (``boolean``) | ||
rotation angle is given in degrees. default:True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the other option is 'radians', but thats not mentioned anywhere.
This also applies to the rotate() function in Vector2D
def to_homogeneous(self): | ||
r""" Get homogeneous representation | ||
""" | ||
|
||
return Vector3D(self.x, self.y, 1) | ||
|
||
@staticmethod | ||
def from_homogeneous(source): | ||
r""" Recover 2d vector from its homogeneous representation | ||
|
||
:params: | ||
* *source* (``Vector3D``) | ||
3d homogeneous representation | ||
""" | ||
|
||
return Vector2D(source.x/source.z, source.y/source.z) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unused.
Nevermind, I found where its used.
def cross_product(self, other): | ||
other = Vector3D.__arithmetic_parse(other) | ||
|
||
return Vector3D({ | ||
'x': self.y*other.z - self.z*other.y, | ||
'y': self.z*other.x - self.x*other.z, | ||
'z': self.x*other.y - self.y*other.x}) | ||
|
||
def dot_product(self, other): | ||
other = Vector3D.__arithmetic_parse(other) | ||
|
||
return self.x*other.x + self.y*other.y + self.z*other.z | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: this seems to be unused.
Can you give an example use-case for those functions?
def _initType(self, **kwargs): | ||
self.type = kwargs['type'] | ||
if self.type not in Text._TYPES: | ||
raise ValueError('Illegal type selected for text field.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for type should get updated as well.
- Specify that the argument is mandatory (I assume this will fail for None)
- Specify the 3 options for the type
i += 1 | ||
|
||
file_handler = KicadFileHandler(kicad_mod) | ||
file_handler.writeFile('test.kicad_mod') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment this line out
alternative to angle | ||
arcs of this form are given as start, end and center | ||
* *angle* (``float``) -- | ||
angle of arc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify degrees here
) | ||
self._initAngle(ep_a - sp_a) | ||
|
||
if kwargs.get('long_way', False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long_way
not described as parameter
I would opt to make this a CW/CCW parameter instead.
return (rad_p, ang_p_s) | ||
|
||
def _compareAngles(self, a1, a2, tolerance=1e-7): | ||
r""" compare which of the two angles given in the local coordinate system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compare what?
def _toLocalCoordinates(self, point): | ||
rad_s, ang_s = self.start_pos.to_polar(origin=self.center_pos) | ||
rad_p, ang_p = Vector2D(point).to_polar(origin=self.center_pos) | ||
|
||
ang_p_s = (ang_p - ang_s) % 360 | ||
if self.angle < 0: | ||
ang_p_s -= 360 | ||
return (rad_p, ang_p_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to _toLocalPolarCoordinates
return self | ||
|
||
def cut(self, *other): | ||
raise NotImplemented("cut for circles not yet implemented") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if its not implemented, you could call the cut function of the base class. Once its implemented you only need to change one code location.
Note this is work in progress. For ringed pads to work i will also need to implement:
I noticed that the serializer class can not really deal with inheritance. But i do not think i will have time to look into this.