• 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 PCB Editor
  3. How to color a string using SKill

Stats

  • Replies 11
  • Subscribers 160
  • Views 18902
  • Members are here 0
More Content

How to color a string using SKill

JerryWilson
JerryWilson over 8 years ago

Hi Dave, all

I have a code to check footprint prints in our library. In my code i will output it into a log file called MCL log file. 

In the code i have pass/fail messages in which for pass messages, i want to color it green & fail message as red.

How do i do that. Below is a portion of the code.Hope anyone can help.

Thanks

JerryWilson

defun( _mcl_start ()

let((errors overallerrors)
overallerrors=0

mcl_log.log=axlDMOpenLog("mcl")

fprintf(mcl_log.log " MCL CHECK LOG ............................... Created:")

Date=(getCurrentTime)
fprintf(mcl_log.log "%s\n\n" Date)

axlDBGetDesignUnits()

fprintf(mcl_log.log "\n-----------------------------CHECK DRAWING PARAMETERS----------------------------\n")


errors=0
let((y m p)
y = axlGetParam('paramDesign)
if(y->units=="millimeters" then
;fprintf(mcl_log.log "\nPASSED :USER UNITS." )

else
errors++
overallerrors++
fprintf(mcl_log.log "\nFAILED :INVALID USER UNITS., %s" y->units)
)
if(y->accuracy==3 then
;fprintf(mcl_log.log "\nPASSED :ACCURACY." )
else
errors++
overallerrors++
fprintf(mcl_log.log "\nFAILED :INVALID ACCURACY., %d" y->accuracy)
)
if(y->height==210 then
;fprintf(mcl_log.log "\nPASSED :DRAWING EXTENT HEIGHT." )
else
errors++
overallerrors++
fprintf(mcl_log.log "\nFAILED :INVALID DRAWING EXTENT HEIIGHT., %f" y->height)
)
if(y->width==297 then
;fprintf(mcl_log.log "\nPASSED :DRAWING EXTENT WIDTH." )
else
errors++
overallerrors++
fprintf(mcl_log.log "\nFAILED :INVALID DRAWING EXTENT WIDTH., %f" y->width)
)
if(y->xy==list(-150 -105) then
;fprintf(mcl_log.log "\nPASSED :DRAWING EXTENT LOWER X AND LOWER Y." )
else
errors++
overallerrors++
fprintf(mcl_log.log "\nFAILED :INVALID DRAWING EXTENT LOWER X AND LOWER Y., %P\n" y->xy)
)
m = axlDesignType(t)
if( or( m=="PACKAGE" m=="SHAPE" m=="FLASH" ) then
;fprintf(mcl_log.log "\nPASSED :SYMBOL TYPE., %s\n" m)
else
errors++
overallerrors++
fprintf(mcl_log.log "\nFAILED :INVALID SYMBOL TYPE., %s\n" m)
)

if(errors==0 then
fprintf(mcl_log.log "\n\t%d ERROR(S) ON DRAWING PARAMETERS SETTINGS.\n", errors)
else
fprintf(mcl_log.log "\n\t%d ERROR(S) ON DRAWING PARAMETERS SETTINGS\n", errors)
)
;fprintf(mcl_log.log "***CHECK DRAWING PARAMETERS-END*****\n\n")
)

  • Sign in to reply
  • Cancel
  • eDave
    eDave over 8 years ago

    defun( _testHTML ()
    let((p)
    p = axlDMOpenFile("ALLEGRO_HTML", "aaa.log", "w")
    when(p
    fprintf(p, "<!DOCTYPE html>\n")
    fprintf(p, "<html>\n")
    fprintf(p, "<body>\n")
    fprintf(p, "The quick brown ...<Br>\n")
    fprintf(p, "<font color=\"red\">This is red text.</font>\n")
    fprintf(p, "</body>\n")
    fprintf(p, "</html>\n")
    drain(p)
    axlDMClose(p)
    )
    axlUIViewFileCreate("aaa.log", "Sample", nil)
    ))

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 8 years ago
    Or just this:

    p = axlDMOpenLog("aaa")
    when(p
    fprintf(p, "The quick brown fox at (0.0 0.0) ...<Br>\n")
    fprintf(p, "<font color=\"red\">This is red text.</font>\n")
    drain(p)
    axlDMClose(p)
    )
    axlUIViewFileCreate("aaa.log", "Sample2", nil)
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JerryWilson
    JerryWilson over 8 years ago
    Hi Dave
    Thanks So much. I have successfully added the color in my code. I was wondering if i can bold the fonts. Is a way to do it?
    Regards
    Jerry
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 8 years ago
    <b>This text is bold</b>
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JerryWilson
    JerryWilson over 8 years ago

    Hi Dave

    Thanks so much for your help. I have an issue now. I have updated my code & testing it in 16.6, it works perfectly fine. We are moving to 17.2 soon, & i was testing it in 17.2, to my surprise its not working at all.

    Any reason why. Here i captured how the message came out. Is there any extra command needs to be added. Please help.

    THIS IS HOW I ADDED IN THE FPRINTF

    fprintf(mcl_log.log "<b><font color=\"red\">\nFAILED :LINE WIDTH IN PACKAGE GEOMETRY/ASSEMBLY_TOP IS %.3f</font></b>" width)

    Below is the message, the whole command is being printed out.

    <b><font color="red">
    FAILED :LINE WIDTH IN PACKAGE GEOMETRY/ASSEMBLY_TOP IS 0.076</font></b><b><font color="red">
    FAILED :LINE WIDTH IN PACKAGE GEOMETRY/ASSEMBLY_TOP IS 0.076</font></b><b><font color="red">
    FAILED :LINE WIDTH IN PACKAGE GEOMETRY/ASSEMBLY_TOP IS 0.076</font></b><b><font color="red">
    FAILED :LINE WIDTH IN PACKAGE GEOMETRY/ASSEMBLY_TOP IS 0.076</font></b><b><font color="red">
    FAILED :LINE WIDTH IN PACKAGE GEOMETRY/ASSEMBLY_TOP IS 0.076</font></b><b><font color="red">


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