Home > Community > Forums > PCB SKILL > skill code for placing components around circle (polar placement)

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 skill code for placing components around circle (polar placement) 

Last post Wed, Aug 6 2014 4:23 AM by KARPCB. 8 replies.
Started by KARPCB 28 Apr 2014 03:00 AM. Topic has 8 replies and 3116 views
Page 1 of 1 (9 items)
Sort Posts:
  • Mon, Apr 28 2014 3:00 AM

    • KARPCB
    • Top 100 Contributor
    • Joined on Fri, Sep 30 2011
    • CHENNAI, Tamil Nadu
    • Posts 67
    • Points 1,030
    skill code for placing components around circle (polar placement) Reply

     Hi ,

     

    Anyone have  skill code for placing components around circle (polar placement) ?

     

    Thanks,

    Karthik

    • Post Points: 5
  • Fri, May 2 2014 3:47 AM

    • KARPCB
    • Top 100 Contributor
    • Joined on Fri, Sep 30 2011
    • CHENNAI, Tamil Nadu
    • Posts 67
    • Points 1,030
    Re: skill code for placing components around circle (polar placement) Reply

    Hi All,

     i need skill code for following concept. Experts please help me.

    Step1 : select the required components in layout

    Step2 :Calculate the orgin of the components

    Step3 : enter the radius and angle

    Step3 : find the x and y location on the circle using below formula

    X = R cos(theta)

    Y = R sin(theta)

    P(X1,Y1)

    R=200

    THETA = 30DEGREE

    P(X2,Y2)

    R=200

    THETA = 60DEGREE

    .

    .

    .

    P(X12,Y12)

    R=200

    THETA = 0DEGREE

    Step4: move the component(orgin) and place into the x and y location of the circle

    plesae see the attached image.

    Thanks in advance,

    karthik.


    • Post Points: 20
  • Sun, May 4 2014 4:17 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 743
    • Points 16,110
    Re: skill code for placing components around circle (polar placement) Reply

    How much Skill experience do you have?

    Do you want some example snippets or for someone to write this code for you?

    Regards,

    Dave 

    Dave Elder, Tait Communications
    • Post Points: 20
  • Sun, May 4 2014 11:03 PM

    • KARPCB
    • Top 100 Contributor
    • Joined on Fri, Sep 30 2011
    • CHENNAI, Tamil Nadu
    • Posts 67
    • Points 1,030
    Re: skill code for placing components around circle (polar placement) Reply

    Dave,

    Thanks for reply

    Im 1 month experience in skill language. im not expert like you.

    some examples(step1 and 2) its enough for me to do that skill code.

    Thanks,

    Karthik.
    • Post Points: 20
  • Mon, May 5 2014 3:34 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 743
    • Points 16,110
    Re: skill code for placing components around circle (polar placement) Reply
    Try this code:
     
    defun( CircularPlace ()
     let((mypopup, syms, symbols, (continue t), centrePt, radiusStr, radius, angle, angleStr, pt, symAngle)
    ; Create the RMB popup options for Done and Cancel:
    mypopup = axlUIPopupDefine(nil (list (list "Done" 'axlFinishEnterFun), (list "Cancel" "axlCancelEnterFun(), continue = nil")))
    axlUIPopupSet(mypopup)
    ; Select and highlight the symbols to arrange:
    axlSetFindFilter(?enabled '("noall", "SYMBOLS"), ?onButtons '("SYMBOLS"))
    while(axlSelect(?prompt "Select symbols..."); will only continue if one or more objects are selected.
    syms = axlGetSelSet()
    symbols = append(symbols, syms)
    axlClearSelSet()
    axlHighlightObject(syms)
    )
    symbols = unique(symbols); We don't want duplicates
    axlDehighlightObject(symbols)
    and(; Stop if user cancels or anything fails
    continue; Don't continue if the user cancelled
    symbols; Only continue if at least one symbol was selected
    centrePt = axlEnterPoint(?prompts "Select the circle centre", ?gridSnap t); Request the circle centre point
    radiusStr = axlUIPrompt("Enter the radius", "200"); Request the circle radius (a string)
    radius = readstring(radiusStr); Convert the string to a number
    numberp(radius); Ensure that the radius is actually a number
    angle = 360.0 / length(symbols); Calculate the expected delta angle between symbols
    angleStr = axlUIPrompt("Enter the angle", sprintf(nil, "%L", angle)); Allow the user to select an angle
    angle = readstring(angleStr); Convert the string to a number
    numberp(angle); Ensure that the angle is actually a number
    angle = float(angle); The angle needs to be real for axlGeoRotatePt.
    pt = list(car(centrePt) + radius, cadr(centrePt)); This is the starting point.
    symAngle = 0.0; This is the starting angle. *** Change to 90.0 if the component requires it ***
    foreach(sym, symbols
    pt = axlGeoRotatePt(angle, pt, centrePt); Calculate the next point
    symAngle = symAngle + angle; Calculate the next symbol angle
    axlTransformObject(sym, ?move axlMXYSub(pt, sym ->xy), ?angle symAngle - sym ->rotation); Move the symbol.
    )
    )
    ))
     
    Dave 
     
    Dave Elder, Tait Communications
    • Post Points: 35
  • Fri, May 9 2014 4:31 AM

    • KARPCB
    • Top 100 Contributor
    • Joined on Fri, Sep 30 2011
    • CHENNAI, Tamil Nadu
    • Posts 67
    • Points 1,030
    Re: skill code for placing components around circle (polar placement) Reply

     Thanks a lot Dave.

    - karthik.

    • Post Points: 5
  • Fri, Aug 1 2014 3:49 AM

    • KARPCB
    • Top 100 Contributor
    • Joined on Fri, Sep 30 2011
    • CHENNAI, Tamil Nadu
    • Posts 67
    • Points 1,030
    Re: skill code for placing components around circle (polar placement) Reply

    Really you are great.

    what i am thinking its there in given your code. now i am adding some feature(cw and ccw) and form creation after that i will put a final code here.

    Thanks a lot dave.

    • Post Points: 20
  • Sun, Aug 3 2014 4:50 AM

    • Ejlersen
    • Top 10 Contributor
    • Joined on Mon, Jul 28 2008
    • Aalborg, Copenhagen
    • Posts 569
    • Points 10,080
    Re: skill code for placing components around circle (polar placement) Reply

    Hi

    You could also consider buying the polar grid utility from Flowcad

    Se video and info http://www.flowcad.com/FloWare-Polar_Grid.htm 

    I think that does everything you want + much more. 

    Best regards

    Ole 

    Best regards Ole
    • Post Points: 20
  • Wed, Aug 6 2014 4:23 AM

    • KARPCB
    • Top 100 Contributor
    • Joined on Fri, Sep 30 2011
    • CHENNAI, Tamil Nadu
    • Posts 67
    • Points 1,030
    Re: skill code for placing components around circle (polar placement) Reply

    Hi Ole,

    Thanks for given useful link.

    -Karthik.

    • Post Points: 5
Page 1 of 1 (9 items)
Sort Posts:
Started by KARPCB at 28 Apr 2014 03:00 AM. Topic has 8 replies.