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
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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) Change Style problem in ulp code
  • 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
  • State Not Answered
  • Replies 6 replies
  • Subscribers 178 subscribers
  • Views 719 views
  • Users 0 members are here
Related

Change Style problem in ulp code

Former Member
Former Member over 9 years ago

Hello, I am trying to make a dotted wire in ulp code using  e.g.  cmd = "CHANGE STYLE WIRE_STYLE_SHORTDASH" but the wire stays as a continuous line. Any idea how to make CHANGE STYLE work ? 

Thank you,

Bob

 

// run this file as a .ulp file

// Problem: CHANGE STYLE doesn't work as expected

// Q. how to make the line be drawn as a dotted line ??

 

string cmd = "";

 

real x1 = 10.0;

real y1 = 10.0;

real x2 = 50.0;

real y2 = 50.0;

 

sprintf(cmd, "The number is %d", WIRE_STYLE_SHORTDASH);

 

dlgMessageBox(cmd); // just confirms that WIRE_STYLE_SHORTDASH = 2

 

cmd = "";

  

cmd = "CHANGE STYLE WIRE_STYLE_SHORTDASH"; 

  

cmd = cmd + "\n";

 

sprintf(cmd,"WIRE 1 (%f %f) (%f %f) ;", x1, y1, x2, y2 ); 

 

cmd = cmd + "\n";

 

cmd = cmd + "Window Fit;\n";

 

exit(cmd);

  • Sign in to reply
  • Cancel
Parents
  • rachaelp
    0 rachaelp over 9 years ago

    Hi Bob,

     

    Aren't you overwriting cmd in your final sprintf()? It looks to me like the only thing passed in cmd to exit() is the actual wire and not the style information.

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to rachaelp

    That made me take a closer look.  I added a missing ';' after wire_style_short_dash, and modified the code, but still no luck :-(

    Happy to try anything else ...

     

     

    //--------------- latest attempt ------------------

    string cmd = "";

    string temp = "";

     

    real x1 = 10.0;

    real y1 = 10.0;

    real x2 = 50.0;

    real y2 = 50.0;

     

    sprintf(cmd, "The number is %d", WIRE_STYLE_SHORTDASH);

    dlgMessageBox(cmd); // just confirms that WIRE_STYLE_SHORTDASH = 2

    cmd = "";

     

    cmd = "CHANGE STYLE WIRE_STYLE_SHORTDASH;"; 

     

    cmd = cmd + "\n";

     

    sprintf(temp,"WIRE 1 (%f %f) (%f %f) ; ", x1, y1, x2, y2 ); 

     

    cmd = cmd + temp + "\n";

     

    cmd = cmd + "Window Fit;\n";

     

    exit(cmd);

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to Former Member

    Hi Bob,

     

    You are right it still won't work doing it that way. I should have thought on this a little more before my last comment although that was still an issue in your ULP which needed correcting. Ignoring ULP for a second, if you just issue the CHANGE STYLE WIRE_STYLE_SHORTDASH; command in the editor window you will see it has no effect on the next wire that is drawn. It only works this way if you skip the semicolon and then select the option from the menu (which defeats the purpose of typing the desired style into the command). I'd suggest playing around with the commands in the editor first and see if you can work out a sequence of commands which does what you need and then write your ULP to create those commands.

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to rachaelp

    Hi Bob,

     

    Okay so I have just had another quick look at this and the problem is that the style name is not WIRE_STYLE_SHORTDASH when used with this command. That is one of the constants used for the style attribute of a UL_WIRE object. It's simply SHORTDASH with the CHANGE command. If you issue the command:

     

    CHANGE STYLE SHORTDASH; WIRE (0.0 0.0) (5.0 5.0);

     

    You will see a dashed wire is drawn.

     

    Best Regards,


    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to rachaelp

    That's wonderful !!

     

    It now works.

     

    I changed my code to:

     

    cmd = "CHANGE STYLE SHORTDASH;\n";

     

    So happy.

     

    Thanks very much.

     

    Bob.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 9 years ago in reply to rachaelp

    That's wonderful !!

     

    It now works.

     

    I changed my code to:

     

    cmd = "CHANGE STYLE SHORTDASH;\n";

     

    So happy.

     

    Thanks very much.

     

    Bob.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • rachaelp
    0 rachaelp over 9 years ago in reply to Former Member

    Hi Bob,

     

    That's great, I'm glad to hear you now have your ULP working :-)

     

    Best Regards,


    Rachael

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

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube