• 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 159
  • Views 20308
  • 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")
)

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

    Hi Jerry,

    Just add the following line at the start:

    <!DOCTYPE html>

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 8 years ago
    Some of the codes have changed in 17.2. I have raised a case asking for some documentation.
    <b> no longer works for bold. Try <h1>, <h2> etc for headings, <u> for underline.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JerryWilson
    JerryWilson over 8 years ago
    Hi Dave
    I tried to add <!DOCTYPE html>, below is the output.It s not red.

    MCL CHECK LOG ............................... Created:Aug 16 05:40:53 2017


    -----------------------------CHECK DRAWING PARAMETERS----------------------------
    <!DOCTYPE html><font color="red">
    FAILED :INVALID ACCURACY., 4 </font></b>


    i added it at the start, as per below. Do i need to add anywhere else or am missing something here.?
    fprintf(M, "<!DOCTYPE html><font color=\"red\">\nFAILED :INVALID ACCURACY., %d </font></b>\n" y->accuracy)


    I did a few testing on the code you provided earlier, to my surprise it works & the bold works too. Below is the code i tested. Below 2 codes works perfectly in 17.2. I cant figure out what is going on as what you earlier claimed that bold is not working, below 2 codes was able to bold the text. Please help.

    defun( _testHTML1 ()
    let((p)

    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")
    fprintf(p, "<b><font color=\"red\">\nFAILED :HEADER WITH CORRECT DATA ELEMENT BUT INCORRECT DATA TYPE.</font><b>")
    fprintf(p, "<b><font color=\"red\">\nFAILED :INVALID DRAWING EXTENT HEIIGHT.</font><b>")
    drain(p)
    axlDMClose(p)


    )
    )
    axlUIViewFileCreate("aaa.log", "Sample2", nil)
    )



    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

    I see varying results. It may be my eyes but I don't see bolding in 17.2.

    It appears that the interpretation of HTML content just requires the first character of the text file to be a "<" in 17.2.

    I'm still waiting for a response to my service request.

    16.6:

    17.2:

    defun( testHTML2 ()
    let((p)
    p = axlDMOpenLog("aaa")
    when(p
    ;fprintf(p, "<>The quick brown fox at (0.0 0.0) ...\n")
    fprintf(p, "<font color=\"red\">This is red text.</font>\n")
    fprintf(p, "<font color=\"red\">FAILED :HEADER WITH CORRECT DATA ELEMENT BUT INCORRECT DATA TYPE.</font>\n")
    fprintf(p, "<b><font color=\"red\">FAILED :HEADER WITH CORRECT DATA ELEMENT BUT INCORRECT DATA TYPE. (BOLD)</font></b>\n")
    fprintf(p, "<font color=\"green\">This is green text.</font>\n")
    fprintf(p, "<b><font color=\"green\">This is bold green text.</font></b>\n")
    fprintf(p, "<b><font color=\"red\">This is bold red text.</font></b>\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

    I have manged to add the command in my code. However as what you said the bold is not working. Please keep me posted on the updated bold command. I also found out that the tracef(t) command is not working in 17.2. Its giving a warning. Do you have any idea if the trace command is being updated?

    W- *WARNING* Setting trace to 't' is not permitted as it could cause severe performance degradation during SKILL evaluation. To disable this check, type sstatus( traceTEnable t ) in the CIW.

    Thanks

    Jerry

    • 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