Home > Community > Forums > PCB SKILL > axlSingleSelectPoint not accurately !

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: *

 axlSingleSelectPoint not accurately ! 

Last post Mon, Nov 26 2012 10:37 PM by luanvn81. 4 replies.
Started by luanvn81 11 Nov 2012 06:39 PM. Topic has 4 replies and 1005 views
Page 1 of 1 (5 items)
Sort Posts:
  • Sun, Nov 11 2012 6:39 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 58
    • Points 875
    axlSingleSelectPoint not accurately ! Reply

     Hi all!
       I'm writting a skill to check at start point & end point of a cline if pin exist or not, if pin exist and pin's netname ="dummy",
       then assign that cline to that pin. AND , if the coordinate is in the restrict area (box_xy) then do nothing. But I got the problem,
       when I put the code to get restrict area, the code still run but the function axlSingleSelectPoint not accurately, otherwise, it's ok.
       Who can show me where's wrong? and how can I fix it?.
       
    ..............


    ; =====Get box  xy, (default: leftdonwn- rightup)=====
    box_xy = axlEnterBox(?prompts list("First rectangle point, please...", "Second rectangle point, please..."))
    axlClearSelSet()
    loc1_x = xCoord(car(box_xy))
    loc1_y = yCoord(car(box_xy))
    loc2_x = xCoord(cadr(box_xy))
    loc2_y = yCoord(cadr(box_xy))

    ;=====process if user pick from any coner for making axlEnterBox()=====
    if(loc1_x < loc2_x && loc1_y < loc2_y then
      box1x = loc1_x
      box1y = loc1_y
      box2x = loc2_x
      box2y = loc2_y
    else
    if(loc1_x < loc2_x && loc1_y > loc2_y then
      box1x = loc1_x
      box1y = loc2_y
      box2x = loc2_x
      box2y = loc1_y
    else
    if(loc1_x > loc2_x && loc1_y < loc2_y then
      box1x = loc2_x
      box1y = loc1_y
      box2x = loc1_x
      box2y = loc2_y
    else
      box1x = loc2_x
      box1y = loc2_y
      box2x = loc1_x
      box2y = loc1_y
    );enf if 1
    );end if 2
    );end if 3

    ;=====Prepare =====
    axlSetFindFilter(?enabled '(noall pins) ?onButtons '(noall pins))
    axlClearSelSet()
    axlVisibleDesign(nil)
    axlVisibleUpdate(t)
    axlVisibleLayer("Pin/top" t)
    axlUIWUpdate(nil)
    axlClearSelSet()

    ;=====Main process=====
    foreach(clines allWiresInDesign
    netname = clines->net->name
    if(stringp(netname) then
    when(nindex(netname, "__")    
    ;=====get location xy at start cline & end cline=====
    cline_seg = clines->segments            ;get all segment in a cline
    first_seg = car(cline_seg)                ;get first segment
    last_seg = car(last(cline_seg))            ;get last segment
    first_seg_xy = car(first_seg->startEnd)
    last_seg_xy = cadr(last_seg->startEnd)    

    x1= xCoord(car(first_seg->startEnd))           
    y1= yCoord(car(first_seg->startEnd))
    x2= xCoord(lastelem(last_seg->startEnd))
    y2= yCoord(lastelem(last_seg->startEnd))

    ;===CHECK LOCATION X1:Y1 IF PIN EXIST OR NOT=====
    if(and(x1>box1x, x1<box2x, y1>box1y, y1<box2y) == nil then
    pinselect = axlGetSelSet(axlSingleSelectPoint(x1:y1))
    axlClearSelSet()
    if( pinselect != nil then
    pinselect = car(pinselect)
    sym_name = pinselect->component->name
    pin_net_name = pinselect->net->name
    pin_number = pinselect->number
    if(pin_net_name == "" then
      fprintf(writeOutFile, "%s %s\n", "FORM mini netlist ", netname)
      fprintf(writeOutFile, "%s %s.%s\n", "FORM mini pinname ", sym_name, pin_number)
      fprintf(writeOutFile, "next\n")
    );endif
    );end if pinselect==nil
    );end if

    ;===CHECK LOCATION X2:Y2 IF PIN EXIST OR NOT=====
    if(and(x2>box1x, x2<box2x, y2>box1y, y2<box2y) == nil then
    pinselect = axlGetSelSet(axlSingleSelectPoint(x2:y2))
    axlClearSelSet()
    if( pinselect != nil then
    pinselect = car(pinselect)
    sym_name = pinselect->component->name
    pin_net_name = pinselect->net->name
    pin_number = pinselect->number
    if(pin_net_name == "" then
      fprintf(writeOutFile, "%s %s\n", "FORM mini netlist ", netname)
      fprintf(writeOutFile, "%s %s.%s\n", "FORM mini pinname ", sym_name, pin_number)
      fprintf(writeOutFile, "next\n")
    );end if - (1-24)
    );end if pinselect==nil)
    );end if

    );end when
    );end if stringp
    );end foreach via allWiresInDesign

    .........


    Tks!
    Luan.

    • Post Points: 20
  • Sun, Nov 11 2012 7:42 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 715
    • Points 15,510
    Re: axlSingleSelectPoint not accurately ! Reply

    I think your logic is reversed in the two lines:

     if(and(x1>box1x, x1<box2x, y1>box1y, y1<box2y) == nil then

    and  if(and(x2>box1x, x2<box2x, y2>box1y, y2<box2y) == nil then

    Should they have == nil at the end?

    Also, I suggest you look at using min and max functions :

    ;=====process if user pick from any corner for making axlEnterBox()=====

    box1x = min(loc1_x, loc2_x)

    box1y = min(loc1_y, loc2_y)

    box2x = max(loc1_x, loc2_x)

    box2y = max(loc1_y, loc2_y) 

    Dave Elder, Tait Communications
    • Post Points: 20
  • Sun, Nov 11 2012 8:59 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 58
    • Points 875
    Re: axlSingleSelectPoint not accurately ! Reply

     Hi Dave!

    Thank for your advices, and I want to check at all position  except for checking in restrict area, it's mean if a location having co-ordinate is in restrict area, skill will inorge it and check other position. so I think command "if(and(x1>box1x, x1<box2x, y1>box1y, y1<box2y) == nil" is right. But I don't know when I "only" put the function  "axlEnterBox" in the code (all "IF" condition for checking positon in restrict area are skipped), axlSingleSelectPoint will not  run exactly. Otherwise, my skill run OK. Could  you please show me what's wrong in my code?.

    Tks.

    Luan.

    • Post Points: 20
  • Mon, Nov 12 2012 12:23 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 715
    • Points 15,510
    Re: axlSingleSelectPoint not accurately ! Reply

    Hi Luan,

    You need to thoroughly check your logic.

    Try using "when" and "unless" instead of "if(a == b" and "if(a != b".

    Don't forget that axlSingleSelectPoint depends on the trap size so will give arbitrary results if you are not careful. 

    Dave Elder, Tait Communications
    • Post Points: 20
  • Mon, Nov 26 2012 10:37 PM

    • luanvn81
    • Top 150 Contributor
    • Joined on Fri, Sep 18 2009
    • dnai, Vietnam
    • Posts 58
    • Points 875
    Re: axlSingleSelectPoint not accurately ! Reply

     Hi Dave! Sorry for announcement to you too late, but as your advice, the reason that my code didn't run exactly depend on trap size, and i have repaired it by function axlZoomToDbid. Once more, thank you very much.

    Luan.

    • Post Points: 5
Page 1 of 1 (5 items)
Sort Posts:
Started by luanvn81 at 11 Nov 2012 06:39 PM. Topic has 4 replies.