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) writing values in object variables
  • 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 2 replies
  • Subscribers 188 subscribers
  • Views 626 views
  • Users 0 members are here
Related

writing values in object variables

e14 Contributor
e14 Contributor over 13 years ago

In the design of a DSN converter, I need to build a list of objects, in

this case VIA's. Instead of storing the individual data members in

multiple arrays, I see that I can define (arrays of) object types.

Starting simple, according to the manual:

 

UL_VIA xyz; works fine as definition.

 

However, I have found no way to write data in the object, e.g. xyz.start

= 1; gives an error. Reading xyz.start gives ( correctly) an error as

the object variable is invalid (not initialized).

 

How do I get values in an object variable?

 

The example in the manual:

 

UL_SIGNAL signals[];

...

UL_SIGNAL s = signals[0];

printf("%s", s.name);

 

suggest it is somehow possible...

 

Should this take place in a higher level context, for instance within a

UL_SIGNAL context?

 

Thanks for a suggestion.

 

Regards, Robert

 

  • Sign in to reply
  • Cancel
  • e14 Contributor
    e14 Contributor over 13 years ago in reply to e14 Contributor

    Hi Warren,

     

    Thanks for your reply. I am not trying to modify a board or schematic. I

    am writing a replacement of the brd_to_dsn.ulp, improving the design

    (especially curve handling and keepout assignments), and adding

    functionality like layer specific keepouts and locking individual line

    segments before routing.

     

    Queuing the objects (Pads, Via's, wire segments) before processing makes

    the design more modular. At the moment I store these queues in many

    object component arrays, but directly using objects would be much

    cleaner. I can read them as objects from the Board of course, but

    sometimes the conversion process itself must generate objects (default

    Via's after decoding the layer structure for instance) to allow correct

    routing.

     

    It seems that the language cannot change object content in its

    workspace. No showstopper, it just would improve clarity and reduce code

    size).

     

    Regards, Robert

     

    On 22/01/2013 02:27, Warren Brayshaw wrote:

    Hi Robert

     

    I'll have a go at answering this. If I get it wrong I feel Alf will chime

    in.

    In short, you cannot write/modify the Schematic, Board and Library from

    within a ULP. You effect changes upon exiting the ULP. Eagle runs the

    commands in the exit() command directly or using a script, created in the

    ULP, and called from within the commands in the exit() command.

    There are a number of other actions that can be made within the ULP, like

    cfgget and cfgset that affect settings and constants/variables created in

    eagle.usr. You can create and read files. You can have the operating system

    run apps and batch files. Alas you need to exit the ULP to make changes to

    the Board etc.

     

    The example you gave from the manual was interesting as I had not

    considered using the objects that way and have not seen a ULP use it. It

    offers a possiblity that may be useful. See later.

     

    It don't feel it suggests you can write to the property of an object but in

    the past I have been guilty of feeling I wanted to.

     

    The example in the manual:

     

    UL_SIGNAL signals[]; <Defines an array of type object  >

    ...

    UL_SIGNAL s = signals[0]; <Defines an variable 's' of type object and makes

    it equal to object signals[0]>

    printf("%s", s.name); <..and uses the .name property>

     

    So it's just passing stuff around.

    You can write to signals[0].name but that is not the Board's object but a

    copy of it and so it is not what you are after.

     

    I see a possible use for these object arrays. Normally you loop through

    UL_SIGNALS but if your ULP has to do this a few times in different places

    it may be faster to identify which element of the object array is the one

    of interest and just target that one which you can do without looping

    through them all.

     

    The attached ULP shows renaming the array copy of the first element's

    properties within the ULP but the names on the board do not change,

    naturally enough.

     

    HTH

    Warren

     

    >

    >

     

     

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

    Hi Robert

     

    I'll have a go at answering this. If I get it wrong I feel Alf will chime

    in.

    In short, you cannot write/modify the Schematic, Board and Library from

    within a ULP. You effect changes upon exiting the ULP. Eagle runs the

    commands in the exit() command directly or using a script, created in the

    ULP, and called from within the commands in the exit() command.

    There are a number of other actions that can be made within the ULP, like

    cfgget and cfgset that affect settings and constants/variables created in

    eagle.usr. You can create and read files. You can have the operating system

    run apps and batch files. Alas you need to exit the ULP to make changes to

    the Board etc.

     

    The example you gave from the manual was interesting as I had not

    considered using the objects that way and have not seen a ULP use it. It

    offers a possiblity that may be useful. See later.

     

    It don't feel it suggests you can write to the property of an object but in

    the past I have been guilty of feeling I wanted to.

      

    The example in the manual:

     

    UL_SIGNAL signals[];

     

    So it's just passing stuff around.

    You can write to signals[0].name but that is not the Board's object but a

    copy of it and so it is not what you are after.

     

    I see a possible use for these object arrays. Normally you loop through

    UL_SIGNALS but if your ULP has to do this a few times in different places

    it may be faster to identify which element of the object array is the one

    of interest and just target that one which you can do without looping

    through them all.

     

    The attached ULP shows renaming the array copy of the first element's

    properties within the ULP but the names on the board do not change,

    naturally enough.

     

    HTH

    Warren

     

     

     

    --

    Web access to CadSoft support forums at www.eaglecentral.ca.  Where the CadSoft EAGLE community meets.

     

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