• 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 Scripting - Skill
  3. SKlLL to Offsets lines and arcs by a specified distance...

Stats

  • State Verified Answer
  • Replies 11
  • Subscribers 17
  • Views 3353
  • Members are here 0
More Content

SKlLL to Offsets lines and arcs by a specified distance,

Xiaome8
Xiaome8 4 months ago

Hi Bro, 

would you help to provide the skill which can offsets lines and arcs by a specified distance ,like the following picture show, (the original command offset copy is not good for any angle copy , only support X or Y direction offset copy)

thanks in advanced!

  • Cancel
  • Sign in to reply
Parents
  • andakConsultingLtd
    0 andakConsultingLtd 4 months ago

    This is not a trivial piece of code, I'd rate it mid level complexity Slight smile.

    I am curious to see if/how others have managed it.

    I personally prefer the hug option instead

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Xiaome8
    0 Xiaome8 4 months ago in reply to andakConsultingLtd

    This function has accomplished by the Daltools skill which is a Commercial tool, but can not get the source code to know how does it go

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Xiaome8
    0 Xiaome8 3 months ago in reply to Hoangkhoipcb

    Hi HoangKhoi ,

    The code has improve as the pattern I mention above, but it is a little strange that the cline width is sometime is 0um width(wrong), sometimes use the one default(right value)

    and the axlUIPrompt dialog box (250 spacing)is always on ,so every time need to put the offset value to replace 250,

    so can you help optimize the offset value can keep the value which user give? thanks again~

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Hoangkhoipcb
    +1 Hoangkhoipcb 3 months ago in reply to Xiaome8

    Hi Xiaome8,

    Here your the code:


    ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    axlCmdRegister("offset_line" `offset_line)
    offset_value_s = ""
    (defun offset_line ()
    offset_value = axlUIPrompt( "Enter offset value:" offset_value_s)
    if(offset_value != nil && atof(offset_value) > 0.0 then
    offset_value_s = offset_value
    axlClearSelSet()
    axlSetFindFilter(?enabled '(noall CLINES NAMEFORM) ?onButtons '(noall ALL))
    axlSingleSelectPoint()
    cline = car(axlGetSelSet())
    axlClearSelSet()
    if( cline != nil then
    pick_airgap = axlEnterPoint()
    if(pick_airgap != nil then
    _airgap = axlAirGap(cline pick_airgap nil 'enhanced)
    airgap = axlAirGap(cline pick_airgap nil 'anyLayer)
    if(_airgap != nil && _airgap->airgap > 0.0 then
    ol = axlGeoCircleLineInt2(_airgap->location1 _airgap->location2 _airgap->location1 atof(offset_value))
    dis1 = axlDistance(_airgap->location2 car(ol))
    dis2 = axlDistance(_airgap->location2 cadr(ol))
    pick_airgap = car(ol)
    if(dis2 < dis1 then
    pick_airgap = cadr(ol)
    )
    segs = cline->segments
    st_end_list = segs~>startEnd
    st_seg = car(segs)
    first_seg_point = car(st_seg->startEnd)
    tmp = setof(e st_end_list e != st_seg->startEnd && member(first_seg_point e) != nil)
    if(tmp != nil then first_seg_point = cadr(st_seg->startEnd))
    last_seg = lastelem(segs)
    last_seg_point = car(last_seg->startEnd)
    tmp = setof(e st_end_list e != last_seg->startEnd && member(last_seg_point e) != nil)
    if(tmp != nil then last_seg_point = cadr(last_seg->startEnd))
    cline_poly = axlPolyFromDB(cline ?endCapType 'ROUND )
    if(length(cline_poly)>1 then
    cline_poly = car(axlPolyOperation(car(cline_poly) cdr(cline_poly) 'OR))
    )
    exp_poly = car(axlPolyExpand(cline_poly atof(offset_value) + car(cline->segments)->width*0.5 'NONE))
    axlClearSelSet()
    axlAddSelectPoly(exp_poly t)
    cline_displays = axlGetSelSet()
    axlDBAddProp(cline_displays list( "FIXED" t))
    axlDBRefreshId(nil)
    shape = car(axlDBCreateShape(exp_poly t "anti etch/all"))
    rpath = axlDB2Path(shape)
    new_cline = car(axlDBCreatePath(rpath cline->layer nil ) )
    seg_width = car(cline->segments)->width
    axlChangeWidth(car(new_cline), car(cline->segments)->width )
    axlDeleteObject(shape)
    new_cline = car(new_cline)
    foreach(seg new_cline->segments
    if(seg->xy != nil then
    if(axlDistance(seg->xy first_seg_point) <= seg_width || axlDistance(seg->xy last_seg_point)<= seg_width then
    axlDeleteObject(seg)
    )
    )
    )
    axlClearSelSet()
    axlAddSelectPoly(exp_poly t)
    clines = axlGetSelSet()
    foreach(item clines
    cline_poly = axlPolyFromDB(item ?endCapType 'NONE )
    if(length(cline_poly)>1 then
    cline_poly = car(axlPolyOperation(car(cline_poly) cdr(cline_poly) 'OR))
    )
    exp_poly = car(axlPolyExpand(cline_poly seg_width 'NONE))
    if(!axlGeoPointInShape(pick_airgap exp_poly nil) then
    if(axlDBIsFixed(item) == nil then
    axlDeleteObject(item)
    )
    )
    )
    axlDBDeleteProp(cline_displays list( "FIXED"))
    axlShell("offset_line")
    )
    )
    )
    )
    )

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Xiaome8
    0 Xiaome8 3 months ago in reply to Hoangkhoipcb

    Hi HoangKhoi ,

    This one is good ! thanks!

     Niubility!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Xiaome8
    0 Xiaome8 3 months ago in reply to Hoangkhoipcb

    Hi HoangKhoi,

    Good day!

    For the offset cline skill code is perfect, I have a new idea for further development this code to replace the Resize/Respace Diff Pairs command (the cadence command is not good for arc type  and non-45 degree diff-pair adjustment)
    (To get the code more simple,I thinks no need to update the constrain DRC or change cline width . for they can use another command), just need to offset 2 P/N clines to the space we want.
    so if you have time ,would you help to study for it?as far as I know currently ,there is few skill for diff-pair adjustment.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Hoangkhoipcb
    0 Hoangkhoipcb 3 months ago in reply to Xiaome8

    Hi Xiaome8,

    Can we switch to email? It’s just a quick chat.

    Please contact me : hoangkhoipcb -> g_mail

    Regards,

    HoangKhoi.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Hoangkhoipcb
    0 Hoangkhoipcb 3 months ago in reply to Xiaome8

    Hi Xiaome8,

    Can we switch to email? It’s just a quick chat.

    Please contact me : hoangkhoipcb -> g_mail

    Regards,

    HoangKhoi.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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