element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) UL_TEXT value resolves
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 5 replies
  • Subscribers 189 subscribers
  • Views 482 views
  • Users 0 members are here
Related

UL_TEXT value resolves

dukepro
dukepro over 13 years ago

Good morning,

 

I have some text on the tPlace layer (21) of a board that has the value

">DRAWING_NAME".  In a ULP, the value of this element resolves to the

actual drawing name.  How can I get it's unresolved value?

 

    board(B) {

        B.texts(T) {

            if (T.layer == 21 && T.value == ">DRAWING_NAME") {

                dlgMessagebox("Drawing name found in layer 21.");

            }

        }

    }

 

The above code never presents a dialog box.

 

Ideas?

 

Thanks,

    - Chuck

 

Attachments:
6303.att1.html.zip
  • Sign in to reply
  • Cancel
Parents
  • e14 Contributor
    e14 Contributor over 13 years ago

    This maybe what you are after

     

    board(B) {

        B.texts(T) {

            if (T.layer == 21 && T.value == "\">DRAWING_NAME\"") {

                dlgMessagebox("Drawing name found in layer 21.");

            }

        }

    }

     

     

    Warren

    --

    Viewed / responded via the newsgroup at

    news.cadsoft.de

     

    "Chuck Huber" <chuck.huber@dukepro.com> wrote in message

    news:k1qjrc$h3g$1@cheetah.cadsoft.de...

    Good morning,

     

    I have some text on the tPlace layer (21) of a board that has the value

    ">DRAWING_NAME".  In a ULP, the value of this element resolves to the actual

    drawing name.  How can I get it's unresolved value?

     

    board(B) {

        B.texts(T) {

            if (T.layer == 21 && T.value == ">DRAWING_NAME") {

                dlgMessagebox("Drawing name found in layer 21.");

            }

        }

    }

     

    The above code never presents a dialog box.

     

    Ideas?

     

    Thanks,

        - Chuck

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dukepro
    dukepro over 13 years ago in reply to e14 Contributor

    On 08/31/2012 05:23 PM, Warren Brayshaw wrote:

    This maybe what you are after

     

    board(B) {

        B.texts(T) {

            if (T.layer == 21 && T.value == "\">DRAWING_NAME\"") {

                dlgMessagebox("Drawing name found in layer 21.");

            }

        }

    }

     

    Hmmm... nope.  That didn't work either.

     

    Here's some more specifics...  The board file is saved as 513942.

    If I just spin through all the text elements on a layer, the T.value has

    already resolved to "513942".

     

    board(B) {

        B.texts(T) {

            if (T.layer == 21) {

                sprintf(buf, "Text found in layer %d: %s.",

              T.layer, T.value);

                dlgMessageBox(buf);

                if (T.value == ">DRAWING_NAME") {

                    dlgMessageBox("Drawing name found in layer.");

                }

            }

        }

    }

     

    I get several message boxes with "Text found..." (appropriately).

    What's displayed is "513942", not ">DRAWING_NAME".

     

    The goal is to take this board and save it as 513942-Array.brd.  In this

    case, all the drawing name texts become "513942-Array".  I want the ULP

    to spin through the texts and produce script to replace all the

    occurrences of ">DRAWING_NAME" with "513942".

     

    The problem is that the value of the UL_TEXT object has already resolved

    when the ULP is run.

     

    Using the GUI, if i do a Change->Text, the string ">DRAWING_NAME" shows

    up in the value.

     

    So... why is the value different in the GUI that in ULP?

     

    Thanks,

        - Chuck

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 13 years ago in reply to dukepro

    Chuck Huber wrote:

     

    Here's some more specifics...  The board file is saved as 513942.

    If I just spin through all the text elements on a layer, the T.value

    has already resolved to "513942".

     

    board(B) {

        B.texts(T) {

            if (T.layer == 21) {

                sprintf(buf, "Text found in layer %d: %s.",

    T.layer, T.value);

                dlgMessageBox(buf);

                if (T.value == ">DRAWING_NAME") {

                    dlgMessageBox("Drawing name found in layer.");

                }

            }

        }

    }

     

    I get several message boxes with "Text found..." (appropriately).

    What's displayed is "513942", not ">DRAWING_NAME".

     

    The goal is to take this board and save it as 513942-Array.brd.  In

    this case, all the drawing name texts become "513942-Array".  I want

    the ULP to spin through the texts and produce script to replace all

    the occurrences of ">DRAWING_NAME" with "513942".

     

    The problem is that the value of the UL_TEXT object has already

    resolved when the ULP is run.

     

    Using the GUI, if i do a Change->Text, the string ">DRAWING_NAME"

    shows up in the value.

     

    So... why is the value different in the GUI that in ULP?

     

    Thanks,

        - Chuck

     

     

    Hi Chuck

     

    I have no idea why the CHANGE command can recover the original text but

    UL_TEXT cannot.

    It  works differently in version 4 than it does in v5 and v6

    In v4  CHANGE  TEXT reveals the resolved text as you see it on the board.

    You dont get to see  >DRAWING_NAME  again once its been resolved for the

    initial placement on the board. It is active though because if you change

    the board file name the text changes with it, after a refresh.

     

    It's an easy job to code your ULP to calculate what  >DRAWING_NAME will

    resolve to so you can test for that and not  >DRAWING_NAME

     

     

    HTH

    Warren

     

    --

    Viewed / responded via the newsgroup at

    news.cadsoft.de

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dukepro
    dukepro over 13 years ago in reply to e14 Contributor

    On 09/11/2012 06:20 AM, Warren Brayshaw wrote:

     

    Hi Chuck

     

    I have no idea why the CHANGE command can recover the original text but

    UL_TEXT cannot.

    It  works differently in version 4 than it does in v5 and v6

    In v4  CHANGE  TEXT reveals the resolved text as you see it on the board.

    You dont get to see  >DRAWING_NAME  again once its been resolved for the

    initial placement on the board. It is active though because if you change

    the board file name the text changes with it, after a refresh.

     

    It's an easy job to code your ULP to calculate what  >DRAWING_NAME will

    resolve to so you can test for that and not  >DRAWING_NAME

     

    Warren,

     

    That's exactly what I've had to do.  Just for brevity, below are some

    code snippets.

     

    We usually keep the part number of each board encoded in the board's

    file name, such as "513456.brd".  We use this to place the board's file

    name in copper or silkscreen.  So with a board in hand, it's relatively

    easy to quickly identify it and the schematic/drawing from whence it

    originated.

     

    As soon as it gets saved as "xxx-Array", the resolved text expands to

    interfere with other board elements (component names if the text is on

    the silkscreen, or traces, pads, smd's, vias if the text is on a copper

    layer).  What passed DRC as the original file name, now has clearance

    and overlap errors.  So part of the panelization ULP converts anything

    based on the file name to just the base part number.

     

    It's not the perfect way to do it, but it works for now.

     

    Thanks for your input.

     

    B/R,

        - Chuck

     

     

        board(B) {

            //

            // Extract the base part number.  This really should be

            // a project level attribute, but for the time being, just

            // pull everything in the file name up to but not including

            // the first dash.

            //

            int dashIndex = strchr(filename(B.name), '-');

            if (dashIndex > 0)

                drawing = strsub(filename(B.name), 0, dashIndex);

            else

                drawing = filesetext(filename(B.name), "");

     

            ...

            //

            // Convert the drawing names to the base drawing number

            //

            cmd += "display none 21 22 1 16;\n";

            B.texts(T) {

                if (T.layer == 21 || T.layer == 22      // tplace or bplace

                 || T.layer ==  1 || T.layer == 16) {   // or top or bottom

                    /*

                    

    • For some reason, this does not work properly

                    

    • T.value is the resolved string.

                     *

                    

    • if (T.value == ">DRAWING_NAME") {

                     *

                    

    • The workaround is below.

                     */

                    if (strsub(T.value, 0, strlen(drawing)) == drawing) {

                        sprintf(tmp, "change text '" + drawing + "' (%f %f);\n",

                            u2mil(T.x), u2mil(T.y));

                        cmd += tmp;

                    }

                }

            }

            cmd += "display last;\n";

            ...

            exit(cmd);

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • dukepro
    dukepro over 13 years ago in reply to e14 Contributor

    On 09/11/2012 06:20 AM, Warren Brayshaw wrote:

     

    Hi Chuck

     

    I have no idea why the CHANGE command can recover the original text but

    UL_TEXT cannot.

    It  works differently in version 4 than it does in v5 and v6

    In v4  CHANGE  TEXT reveals the resolved text as you see it on the board.

    You dont get to see  >DRAWING_NAME  again once its been resolved for the

    initial placement on the board. It is active though because if you change

    the board file name the text changes with it, after a refresh.

     

    It's an easy job to code your ULP to calculate what  >DRAWING_NAME will

    resolve to so you can test for that and not  >DRAWING_NAME

     

    Warren,

     

    That's exactly what I've had to do.  Just for brevity, below are some

    code snippets.

     

    We usually keep the part number of each board encoded in the board's

    file name, such as "513456.brd".  We use this to place the board's file

    name in copper or silkscreen.  So with a board in hand, it's relatively

    easy to quickly identify it and the schematic/drawing from whence it

    originated.

     

    As soon as it gets saved as "xxx-Array", the resolved text expands to

    interfere with other board elements (component names if the text is on

    the silkscreen, or traces, pads, smd's, vias if the text is on a copper

    layer).  What passed DRC as the original file name, now has clearance

    and overlap errors.  So part of the panelization ULP converts anything

    based on the file name to just the base part number.

     

    It's not the perfect way to do it, but it works for now.

     

    Thanks for your input.

     

    B/R,

        - Chuck

     

     

        board(B) {

            //

            // Extract the base part number.  This really should be

            // a project level attribute, but for the time being, just

            // pull everything in the file name up to but not including

            // the first dash.

            //

            int dashIndex = strchr(filename(B.name), '-');

            if (dashIndex > 0)

                drawing = strsub(filename(B.name), 0, dashIndex);

            else

                drawing = filesetext(filename(B.name), "");

     

            ...

            //

            // Convert the drawing names to the base drawing number

            //

            cmd += "display none 21 22 1 16;\n";

            B.texts(T) {

                if (T.layer == 21 || T.layer == 22      // tplace or bplace

                 || T.layer ==  1 || T.layer == 16) {   // or top or bottom

                    /*

                    

    • For some reason, this does not work properly

                    

    • T.value is the resolved string.

                     *

                    

    • if (T.value == ">DRAWING_NAME") {

                     *

                    

    • The workaround is below.

                     */

                    if (strsub(T.value, 0, strlen(drawing)) == drawing) {

                        sprintf(tmp, "change text '" + drawing + "' (%f %f);\n",

                            u2mil(T.x), u2mil(T.y));

                        cmd += tmp;

                    }

                }

            }

            cmd += "display last;\n";

            ...

            exit(cmd);

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube