• 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 3347
  • 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
  • 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
  • Hoangkhoipcb
    0 Hoangkhoipcb 4 months ago in reply to andakConsultingLtd

    Hello AnDak

    ... Two men holding hands...Motorcycle

    Cheers,
    HoangKhoi.

    • 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
  • Hoangkhoipcb
    +1 Hoangkhoipcb 3 months ago in reply to Xiaome8

    Hi Xiaome8,

    you can refer this code.

    axlCmdRegister("offset_line" `offset_line)
    (defun offset_line ()
        axlVisibleLayer( "anti etch/all", t)                                              
        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 'anyLayer)
                if(airgap > 0 then
                    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 airgap 'NONE))
                    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)
                    tmp_list = nil
                    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)
                            else
                                tmp_list = cons(seg->parent tmp_list)
                            )  
                        )
                    )
                    axlClearSelSet()
                    axlAddSelectPoly(exp_poly  t)
                    clines = setof(e axlGetSelSet() e != cline  )
                    if(tmp_list != nil then
                        clines = setof(e clines member(e tmp_list) != nil )
                    )
                    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
                            axlDeleteObject(item)
                        )          
                   
                    )
                    axlShell("offset_line")

                )
            )
        )
    )
    Regards,
    HoangKhoi.
    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Xiaome8
    0 Xiaome8 3 months ago in reply to Hoangkhoipcb

    Hi HoangKhoi ,

    Thanks for the help ,the code works well ,

    Now I need to use axlSelect() then RMB to select the trace center then give the offset value (ix XXX or iyXXX).

    if when trace is selected and automaticly pick its center that would be more convenient.

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