Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » sidiq
  • » Profile

Posts

Posts

Hello Adeel thanks for replying,

I tried out generate_icons.py. I used the commands python generate_icons.py (.mo file). I ran into some issues. First of all, I had to execute generate_icons.py in C: //OpenModelica1.13.264bit to avoid path errors.

If I used python generate_icons.py lib/omlibrary/Modelica\ 3.2.3/Fluid/Examples/HeatingSystem.mo, I get the error
Error: Failed to insert class HeatingSystem within Modelica.Fluid.Examples

I realized that the path was an issue because I had to copy BouncingBall.mo into lib/omlibrary/ and OpenModelica1.13.264bit which allowed me to execute python generate_icons.py BouncingBall.mo. This did not return any error and created an svg file. However, it was an empty icon. This is understandable because BouncingBall.mo has an empty diagram view.

When I copied FeedDriveLibrary.mo to C: //OpenModelica1.13.264bit and ran python generate_icons.py FeedDriveLibrary.mo, it also managed to execute and create many other icons including the modelica logo. However the diagram view of all the examples were not created.

I only changed this part in the script

    PACKAGES_TO_LOAD = []
    PACKAGES_TO_LOAD_FROM_FILE = args
    PACKAGES_TO_GENERATE = PACKAGES_TO_LOAD_FROM_FILE

because PACKAGES_TO_LOAD probably had some regex issues when reading the filename.

So, my question is, can this script create the Diagram View or only icons. If it could generate the Diagram Views, could someone please help guide me to do so. Thanks again. 


Hello friends!

Thank you for allowing me to post in this forum.

I know it's possible to right click and "Export as an image" any .mo file from OMEdit.

May I ask if it's possible from OMPython or the command line? Are there any scripting APIs that would allow me to do this?

OMNotebook would allow me to export as a pdf the image of the model but again I can't find an API that would allow me to export as an OMNotebook from python or the command line.

Thanks for any help. Cheers!

  • Index
  • » Users
  • » sidiq
  • » Profile
You are here: