• 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. Custom IC SKILL
  3. bindkey to plot.il

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 143
  • Views 15063
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

bindkey to plot.il

thecalman
thecalman over 15 years ago

 I need to set a bindkey to schPlot("plot.il"), which I can do alright except that I need to have the outputfile to be different each time so that I am not overwriting anything!

I was thinking maybe append a date/time string to a base filename.  I tried to use the getCurrentTime() function but I need to format it somehow! for an example, I would like "Mar 1 05:23:37 2010" to be "03.01.2010.052337" and then concat this to become my outputfile. ex. "myplotfile_03.01.2010.052337.ps".  Could someone please help me.

  • Cancel
  • eDave
    eDave over 15 years ago

    Get the current time using: tm = timeToTm(stringToTime(getCurrentTime()))

    Use tm ->?? to see what info is now available. From there is it easy to concatenate a time string using sprintf although you will need to add 1900 to the year and do some string manipulation to prefix your numbers with "0". Here's one example:

    minutesString = substring(sprintf(nil, "%d", tm ->tm_min + 100), -2)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • thecalman
    thecalman over 15 years ago

    This works great. Thank you.  Now I just need to generate jpeg images from my .ps files.  I was going to create a script that would loop through all files in the folder and use ghostscript to convert the .ps files.  I would have to execute this script manually!  Is there a way (I imagine there is...) to get this done using SKILL immediately after each .ps file is plotted?  I have been playing with the system() command and will keep experimenting to get its correct syntax!! ...maybe that is the command I need?  ...is there somewhere that I can get a good SKILL command reference manual?  

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • eDave
    eDave over 15 years ago

    The Skill language reference manual is what you need:

    <install dir>\doc\sklangref\sklangref.pdf

    Yes, you can use the system command. Here's a line from an old file that I have used in the past to convert ps to pdf using ghostscript:

    system(strcat("\"C:/gs/gs8.14/bin/gswin32c.exe\" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=", fileName, ".pdf -c save pop -f ", fileName, ".ps"))

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • thecalman
    thecalman over 15 years ago

     The postscript file gets generated correctly now and my ghostscript command can convert this file, but the system("gs...") command is executing before the file is completely saved and ghostscript reports a file error. So now I need to be able to detect that the postscript file has been completed before I continue with my ghostscript command...  any ideas?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Bit hard to know where your problem lays without seeing the code. If you can't post it here, I'd suggest contacting customer support (http://support.cadence.com)

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ebecheto
    ebecheto over 15 years ago

    Dear thecalman.

    I think I have something for you. To convert your picture you have the linux command 'convert' (imagemagick). Very usefull! I recommand to change the postscript option setlinwidth to 5 instead of 1. It gives a netter black line. You do not necessaryneed the full code underneath. May be just sprintf(nil "Your linux command %s" "ls ps pwd whatever") followed by (system cmd) will be enough for your need. You may have notice in the code that the line : while( isFile( filename=sprintf(nil "%s-%s-%s_%d.ps" cvId~>libName cvId~>cellName cvId~>viewName i)) i++)  prevent overwriting existing pics. 

    Hope it help,

    Regards.

     

     

     (procedure prettyPrint(@optional (imprimante "lprdcrv"))
    let( (cmd cvId i pt filename eko)
    cmd=sprintf(nil "if grep \"%s|\" ~/.cdsplotinit; then echo yes; else echo \"%s|default: :type=postscript2: :resolution#600: :maximumPages#30: :paperSize=\\\"A4\\\" 4810 6330 172 132:\n\" >> ~/.cdsplotinit; fi" imprimante imprimante)
    (system cmd)
    ;; eko=sprintf(nil "%s" cmd)
    eko=sprintf(nil "echo \"%s\"" imprimante)
    (system eko)

    cvId=geGetWindowCellView()
    ;schematic or symbol plot
    if( member(cvId~>viewName list("schematic" "symbol")) then pt="sch" else pt="le" ) i=0;
    while( isFile( filename=sprintf(nil "%s-%s-%s_%d.ps" cvId~>libName cvId~>cellName cvId~>viewName i)) i++)

    ;; set(concat(pt "PlotOptions") '(nil area "whole" plot "cellview" header nil plotToFile t plotterType "postscript2" papersize "A4"  display "display" tmpdir "/tmp" fit t center t orientation "automatic") )
    set(concat(pt "PlotOptions") '(nil area "whole" plot "Viewing Area" header nil plotToFile t plotterType "postscript2" papersize "A4"  display "display" tmpdir "/tmp" center t orientation "automatic") )
    eval(concat(pt "PlotOptions"))->view=eval(cvId~>viewName)
    eval(concat(pt "PlotOptions"))->cell=eval(cvId~>cellName)
    eval(concat(pt "PlotOptions"))->library=eval(cvId~>libName)
    ; eval(concat(pt "PlotOptions"))->bBox=cvId~>bBox
    eval(concat(pt "PlotOptions"))->viewlist=eval(cvId~>viewName)
    eval(concat(pt "PlotOptions"))->outputfile=filename
    eval(concat(pt "PlotOptions"))->plotter=imprimante

    ; plot schematic or layout
    ;; schPlot() || lePlot()
    ; eval(concat(pt "Plot()"));<== ... does not work
    evalstring(strcat(pt "Plot()"));<== yeah Works

    cmd=sprintf(nil "convert -trim -rotate 90 %s %s.png" filename filename filename )
    cmd=sprintf(nil "%s; cat %s |sed \"s/1 setlinewidth/5 setlinewidth/\">%s.sed.ps" cmd  filename filename )
    cmd=sprintf(nil "%s; convert -trim -rotate 90 %s.sed.ps %s.png" cmd  filename filename )
    cmd=sprintf(nil "%s; cat %s.sed.ps |sed \"s/lineBlue *exch def/lineBlue def/;s/lineRed *exch def/lineRed def/;s/lineGreen exch def/lineGreen def/;\"  > %s.sed_bw.ps" cmd  filename filename )
    cmd=sprintf(nil "%s; convert -trim -rotate 90 %s.sed_bw.ps %s_bw.png" cmd  filename filename )
    cmd=sprintf(nil "%s; rm %s.sed.ps" cmd  filename )
    (system cmd)
    eko=sprintf(nil "Following files had been created in %s :\n%s\n%s.sed_bw.ps\n%s.png\n%s_bw.png\n" pwd() filename filename filename filename)
    printf("%s" eko)
    eko=sprintf(nil "echo \"%s\"" eko)
    (system eko)
    );let
    );proc

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dmay
    dmay over 15 years ago

    You can setup a spool entry in your .cdsplotinit to do everything in one step:

            :spool=ps2pdf13 - > /tmp/plot_${LOGNAME}.pdf ; (acroread /tmp/plot_${LOGNAME}.pdf &):

    We use the above line to send the stdin as output by the plot command to ps2pdf13 (the dash tells this command to read stdin). This is redirected to a file using the environment variable called $LOGNAME in the filename. When finished, acroread is invoked to open the pdf file.

    I tested this out and found that you can use setShellEnvVar("MYFILENAME=abc") before plotting. You can then use the MYFILENAME variable instead of LOGNAME in the spool line. This way you can dynamically change your file name in Cadence, plot to the printer with the spool line that automatically converts to jpg and wrap everything in a foreach loop to get it done.

    I hope that helps.

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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