• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. skill code for placing components around circle (polar placement...

Stats

  • Replies 18
  • Subscribers 161
  • Views 24311
  • Members are here 0
More Content

skill code for placing components around circle (polar placement)

KARPCB
KARPCB over 11 years ago

 Hi ,

 

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

 

Thanks,

Karthik

  • Sign in to reply
  • Cancel
  • KARPCB
    KARPCB over 11 years ago

    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.

    • polar.jpg
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 11 years ago

    How much Skill experience do you have?

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

    Regards,

    Dave 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • KARPCB
    KARPCB over 11 years ago

    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.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 11 years ago
    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 
     
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • KARPCB
    KARPCB over 11 years ago

     Thanks a lot Dave.

    - karthik.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
>
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information