← Back to team overview

kicad-developers team mailing list archive

Re: D_PAD class questions.

 

forget about the last question ':D

module.m_Reference.SetPos0(wxPointMM(-10,-10))

2012/4/8 Miguel Angel Ajo Pelayo <miguelangel@xxxxxxx>

> Another question I forgot about, Is there anyway to move the "M1"
> reference of my module
> around?
>
>
>
> 2012/4/8 Miguel Angel Ajo Pelayo <miguelangel@xxxxxxx>
>
>> I've been working to make some examples (and take the chance to test the
>> scripting as much as I can),
>> and I got a little bit crazy trying to put some pads in a module, finally
>> SetPos0 worked for me.
>>
>> Finally It worked, but at the start I didn't know what was the right
>> method:  SetPosition or  SetPos0.
>>
>> a) What's the difference with SetPosition and SetPos0 (this is the origin
>> I guess)?
>>
>> b) I also played with SetOffset, what I don't know what is it for.
>>
>>
>>
>> #!/usr/bin/env python2.7
>> from pcbnew import *
>>
>> size_0_6mm = wxSizeMM(0.6,0.6)
>> size_1_0mm = wxSizeMM(1.0,1.0)
>>
>>
>> # create a blank board
>> pcb = BOARD()
>>
>> pcb.m_NetClasses.GetDefault().SetClearance(int(FromMM(0.1)))
>>
>> # create a new module, it's parent is our previously created pcb
>> module = MODULE(pcb)
>> module.SetReference("M1")   # give it a reference name
>> pcb.Add(module)             # add it to our pcb
>> m_pos = wxPointMM(50,50)
>> module.SetPosition(m_pos)
>>
>> # create a pad array and add it to the module
>> n = 1
>> for y in range (0,10):
>>     for x in range (0,10):
>>         pad = D_PAD(module)
>>         pad.SetDrillSize(size_0_6mm)
>>         pad.SetSize(size_1_0mm)
>>         pt = wxPointMM(1.27*x,1.27*y)
>> *        pad.SetPos0(pt)*
>> *        #pad.SetPosition(pt)
>>  <-----------------------------------------------*
>> *   *     pad.SetPadName(str(n))
>>         module.Add(pad)
>>         n+=1
>>
>>
>> # save the PCB to disk
>> pcb.Save("/tmp/my2.brd")
>>
>>
>> --
>>
>> Miguel Angel Ajo Pelayo
>> http://www.nbee.es
>> +34 636 52 25 69
>> skype: ajoajoajo
>>
>
>
>
> --
>
> Miguel Angel Ajo Pelayo
> http://www.nbee.es
> +34 636 52 25 69
> skype: ajoajoajo
>



-- 

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 636 52 25 69
skype: ajoajoajo

References