• 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 Scripting - Skill
  3. Error running Create_Thermal_Flash.il sample from 24.1

Stats

  • State Verified Answer
  • Replies 2
  • Subscribers 18
  • Views 1101
  • Members are here 0
More Content

Error running Create_Thermal_Flash.il sample from 24.1

JS202408156358
JS202408156358 10 months ago

I am loading and running Create_Thermal_Flash.il sample from Orcad X Pro 24.1 install and I get this error *Error* fprintf: argument #1 should be an I/O port (type template = "ptg") - nil when I try to run it. I am assuming that it cannot create the temporary file "/tmp/ThermalForm". Any suggestions what I should change it to?

Here is a snippet of the code from the file that runs immediately when invoked.

defun( _THRP_MkForm ()
prog( ()
let( (tempformfile formPort)
   tempformfile = makeTempFileName("/tmp/Thermalform")
   tempformfile = strcat(tempformfile ".form")
   formPort = outfile( tempformfile )
    fprintf( formPort "FILE_TYPE=FORM_DEFN VERSION=2\n FORM\nFIXED\nPORT 64 26\n")
    fprintf( formPort "HEADER \"Thermal Pad Symbol Defaults\"\n\n")
    fprintf( formPort "POPUP <CURSANGLE>\"0\"\"0\",\"30\"\"30\",\"45\"\"45\",\"60\"\"60\",\"90\"\"90\".\n")
    fprintf( formPort "POPUP <CURSSPOKES>\"1\"\"1\",\"2\"\"2\",\"3\"\"3\",\"4\"\"4\".\n\n")
    fprintf( formPort "TILE\n\nGROUP \"Thermal Pad Definition\"\nGLOC 1 1\nGSIZE 30 24\nENDGROUP\n\n")
    fprintf( formPort "TEXT \"Inner Diameter:\"\n TLOC 2 8\n FGROUP \"Thermal Pad Definition\"\n ENDTEXT\n \n")
    fprintf( formPort "FIELD indiam\n FLOC 18 8\n REALFILLIN 9 9\n DECIMAL 4\n FGROUP \"Thermal Pad Definition\"\n ENDFIELD\n \n")
    fprintf( formPort "TEXT \"Outer Diameter:\"\n TLOC 2 13\n FGROUP \"Thermal Pad Definition\"\n ENDTEXT\n \n")
    fprintf( formPort "FIELD outdia\n FLOC 18 13\n REALFILLIN 9 9\n DECIMAL 4\n FGROUP \"Thermal Pad Definition\"\n ENDFIELD\n \n")
    fprintf( formPort "GROUP \"Spoke Definition\"\n GLOC 33 1\n GSIZE 30 24\n ENDGROUP\n \n")
    fprintf( formPort "TEXT \"Spoke Width:\"\n TLOC 34 8\n FGROUP \"Spoke Definition\"\n ENDTEXT\n \n")
    fprintf( formPort "FIELD spkwdth\n FLOC 50 8\n REALFILLIN 9 9\n DECIMAL 4\n FGROUP \"Spoke Definition\"\n ENDFIELD\n \n")
    fprintf( formPort "TEXT \"Num. of spokes\"\n TLOC 34 13\n FGROUP \"Spoke Definition\"\n ENDTEXT\n\n")
    fprintf( formPort "FIELD spknum\n FLOC 50 13\n INTSLIDEBAR 2 2\n MIN 1\n MAX 4\n FGROUP \"Spoke Definition\"\n ENDFIELD\n\n")
    fprintf( formPort "TEXT \"Spoke Angle:\"\n TLOC 34 18\n FGROUP \"Spoke Definition\"\n ENDTEXT\n\n")
    fprintf( formPort "FIELD spkangl\n FLOC 50 18\n ENUMSET 3\n POP \"CURSANGLE\"\n FGROUP \"Spoke Definition\"\n ENDFIELD\n\n")

    fprintf( formPort "GROUP \"Center Dot Option\"\n GLOC 1 28\n GSIZE 62 12\n ENDGROUP\n\n")
    fprintf( formPort "FIELD trgtdt\n FLOC 2 34\n CHECKLIST \"Add Center Dot\"\n FGROUP \"Center Dot Option\"\n ENDFIELD\n\n")
    fprintf( formPort "TEXT \"Dot Diameter\"\n TLOC 34 34\n FGROUP \"Center Dot Option\"\n ENDTEXT\n\n FIELD trgtdia\n FLOC 50 34\n")
    fprintf( formPort "REALFILLIN 9 9\n DECIMAL 4\n FGROUP \"Center Dot Option\"\n ENDFIELD\n\n")

    fprintf( formPort "FIELD okay\n FLOC 3 44\n MENUBUTTON \" OK \" 10 2\n ENDFIELD\n\n")
    fprintf( formPort "FIELD cancel\n FLOC 27 44\n MENUBUTTON \"Cancel\" 10 2\n ENDFIELD\n\n")
    fprintf( formPort "FIELD vhelp\n FLOC 49 44\n MENUBUTTON \" Help \" 10 2\n ENDFIELD\n\n")

    fprintf( formPort "ENDTILE\n ENDFORM\n")
   close( formPort )

   return( tempformfile )

))); defun
  • Sign in to reply
  • Cancel
Parents
  • JuanCR
    +1 JuanCR 10 months ago

    Hi JS202408156358

    I've debugged your code and I believe the issue can be either that the folder /tmp does not exist or that you don't have writing permissions. Let me walk you through what I found out: 

    When I executed the code as a whole, I realized that the very first fprintf was not executing (it was the one outputting the error you see). Then I started executing the function line by line. In this case, I found an anomaly in the outfile line (where the output file is supposed to be created). For that line, I was getting a "nil" as a response. This means that the output file was not getting created and, as a result, the fprintf never had valid data for its first parameter (which is the error that you're getting). 

    So, as a test, I tried changing the makeTempFileName line so it creates the file in the same location where the database is and then I realized this worked. My conclusion is, as I said before, either you don't have writing permissions on /tmp or you haven't created the /tmp folder prior to executing the outfile command. 

    Please use this code instead:

    https://community.cadence.com/cfs-file/__key/communityserver-discussions-components-files/137/Mkform.il

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • JS202408156358
    0 JS202408156358 9 months ago in reply to JuanCR

    Thank you for walking me through the process you used. This helps a lot as I learn skill api. Thank you for the modified file as well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • JS202408156358
    0 JS202408156358 9 months ago in reply to JuanCR

    Thank you for walking me through the process you used. This helps a lot as I learn skill api. Thank you for the modified file as well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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