It will be nice to have clear name space in Python. PAD_SMD is not same type as PAD_RECT, please add PAD_KIND_ and PAD_SHAPE_ prefix. was:Python scripting Pad. Type (KICAD_T *) has not any method to determine pad type

Bug #1393106 reported by LordBlick on 2014-11-16
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Wishlist
Unassigned

Bug Description

>>> brd = pcbnew
>>> pcb = brd.GetBoard()
>>> mods = list(pcb.GetModules())
>>> fp = mods[0]
>>> pads=fp.Pads()
>>> pad=pads[0]
>>> pdt = pad.Type()
>>> pdt
<Swig Object of type 'KICAD_T *' at 0x7f011287ca50>
>>> for strAttr in dir(pdt):
... _attr = getattr(pdt, strAttr)
... if callable(_attr):
... print("pdt.%s()" % strAttr)
...
pdt.__class__()
pdt.__cmp__()
pdt.__delattr__()
pdt.__eq__()
pdt.__format__()
pdt.__ge__()
pdt.__getattribute__()
pdt.__gt__()
pdt.__hash__()
pdt.__hex__()
pdt.__init__()
pdt.__int__()
pdt.__le__()
pdt.__long__()
pdt.__lt__()
pdt.__ne__()
pdt.__new__()
pdt.__oct__()
pdt.__reduce__()
pdt.__reduce_ex__()
pdt.__repr__()
pdt.__setattr__()
pdt.__sizeof__()
pdt.__str__()
pdt.__subclasshook__()
pdt.acquire()
pdt.append()
pdt.disown()
pdt.next()
pdt.own()
>>>

LordBlick (lordblick) on 2014-11-16
Changed in kicad:
importance: Undecided → High
tags: added: python

Type() is the type of a board item, not the pad type.
the "pad type" is GetAttribute().

LordBlick (lordblick) wrote :

In that case, I admire intuitiveness of the names. ;)
Pad has only one attribute ?

LordBlick (lordblick) wrote :

What from list below is kind of pad type ? :
>>> import pcbnew as brd
>>> for strAttr in dir(brd):
... if strAttr.startswith('PAD_'):
... print("brd.%s" % strAttr)
...
brd.PAD_BK_NETNAMES_VISIBLE
brd.PAD_BK_VISIBLE
brd.PAD_CIRCLE
+brd.PAD_CONN
brd.PAD_DRAWINFO
brd.PAD_DRAWINFO_swigregister
brd.PAD_DRILL_CIRCLE
brd.PAD_DRILL_OBLONG
brd.PAD_FR_NETNAMES_VISIBLE
brd.PAD_FR_VISIBLE
+brd.PAD_HOLE_NOT_PLATED
brd.PAD_List
brd.PAD_List_swigregister
brd.PAD_OVAL
brd.PAD_RECT
brd.PAD_ROUND
+brd.PAD_SMD
+brd.PAD_STANDARD
brd.PAD_TRAPEZOID
The elements that I consider likely, pointed a plus.
If they will start with „PAD_TYPE_” and pad shapes with „PAD_SHAPE_” it would be nicer and cleaner.
Thank you for your atention.

Nick Østergaard (nickoe) wrote :

The ones with the plus signs?

LordBlick (lordblick) wrote :

Of course they probably match pad types.

LordBlick (lordblick) wrote :

I propose names customization:
PAD_CONN → PAD_TYPE_CONN
PAD_HOLE_NOT_PLATED → PAD_TYPE_DRILL_NP
PAD_SMD → PAD_TYPE_SMD
PAD_STANDARD → PAD_TYPE_STANDARD

PAD_CIRCLE → PAD_SHAPE_CIRCLE
PAD_OVAL → PAD_SHAPE_OVAL
PAD_RECT → PAD_SHAPE_RECT
PAD_ROUND → PAD_SHAPE_ROUND
PAD_TRAPEZOID → PAD_SHAPE_TRAPEZOID

Wayne Stambaugh (stambaughw) wrote :

Is there any reason this bug report has a high severity setting? Critical and high severity settings are typically reserved for bugs that can cause data loss, corruption, memory leaks, and invalid manufacturing file outputs. All other bugs severity should be tagged as medium or lower. Are any of our Python devs interested in fixing this?

LordBlick (lordblick) wrote :

That in the final is some request for namespace clarification, same „PAD_” prefix is very unclear…

Changed in kicad:
importance: High → Wishlist
LordBlick (lordblick) on 2015-07-27
summary: - Python scripting Pad.Type (KICAD_T *) has not any method to determine
- pad type
+ It will be nice to have clear name space in Python. was:Python scripting
+ Pad.Type (KICAD_T *) has not any method to determine pad type
summary: - It will be nice to have clear name space in Python. was:Python scripting
+ It will be nice to have clear name space in Python. PAD_CONN is not same
+ type as PAD_RECT, please add PAD_TYPE_ prefix. was:Python scripting
Pad.Type (KICAD_T *) has not any method to determine pad type
summary: It will be nice to have clear name space in Python. PAD_CONN is not same
- type as PAD_RECT, please add PAD_TYPE_ prefix. was:Python scripting
- Pad.Type (KICAD_T *) has not any method to determine pad type
+ type as PAD_RECT, please add PAD_TYPE_ and PAD_SHAPE_ prefix. was:Python
+ scripting Pad.Type (KICAD_T *) has not any method to determine pad type

Forget Type() method. It is used at run time in sources to know the type of a Kicad item (in switches for instance).
D_PAD has only one type (PCB_PAD_T).

And yes, PAD_CONN is same type as PAD_RECT.

PAD_CONN, PAD_SMD, PAD_HOLE_NOT_PLATED, PAD_STANDARD are *pad Attributes*.
PAD_CIRCLE, PAD_OVAL, PAD_RECT, PAD_TRAPEZOID are *pad Shapes*.

My mistake, tittle corrected.

summary: - It will be nice to have clear name space in Python. PAD_CONN is not same
+ It will be nice to have clear name space in Python. PAD_SMD is not same
type as PAD_RECT, please add PAD_TYPE_ and PAD_SHAPE_ prefix. was:Python
- scripting Pad.Type (KICAD_T *) has not any method to determine pad type
+ scripting Pad. Type (KICAD_T *) has not any method to determine pad type
LordBlick (lordblick) wrote :

Apart from the programmer's language, pads have their own types or in other calling - kinds. Prefix „PAD_KIND_” also welcome…

summary: It will be nice to have clear name space in Python. PAD_SMD is not same
- type as PAD_RECT, please add PAD_TYPE_ and PAD_SHAPE_ prefix. was:Python
+ type as PAD_RECT, please add PAD_KIND_ and PAD_SHAPE_ prefix. was:Python
scripting Pad. Type (KICAD_T *) has not any method to determine pad type
LordBlick (lordblick) wrote :

Attribute means set of something possible in parallel, not enumerate…

LordBlick (lordblick) wrote :

My request is logical and ordinal based.
In everyday language, just the shape, kind, color, etc. can be called attributes…
I'm going to introduce some patch in the future, now in my free time I'm constructing search & replace & diff generator (search part I have already.).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers