🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Demo extension with Python code

User: "Michal Stefuca"
Altair Employee
Updated by Michal Stefuca

Overview

A simple extension example demonstrating how to link custom Python code to a ribbon icon in HyperMesh. Upon clicking the icon, a message will be printed in the IPython console.

image

Usage/Installation Instructions

1. Unzip the DemoExtensionWithPython.zip

2. Register the extension - File > Extensions and click Add Extension in the Extension Manager dialog

Find more posts tagged with

Comments

Sort by:
1 - 2 of 21
    User: "AndreasAltmann"
    Altair Community Member

    Hello Michal,
    Thanks for sharing.

    When I tried to adapt the example to our environment, I encountered an issue. I received the following error:

    TypeError: myFunc() got an unexpected keyword argument 'charmap'

    The solution was to modify the function definition to include *args and **kwargs:

    def myFunc():             ⇒                def myFunc(*args, **kwargs):
    

    I hope this helps anyone else facing a similar issue.

    User: "Michal Stefuca"
    Altair Employee
    OP

    Hi @AndreasAltmann

    Thank you for adding your comment. You are absolutely right - the functions are internally passed some arguments which they need to be able to "consume".

    FYI We will make sure to include this information in the future documentation updates and in the training package that is currently being worked on.

    Best regards,
    Michal

Share projects with the Community

Share your models, scripts, workspaces, and more with the Altair Community.
New Exchange Project