🎉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

Hypermesh External API

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

How to open external instance of HM using Visual Studio? I'm trying examples provided in the documentation of HM Ext API but not getting success ? Can somebody help me in writing a sample program to start the session, import the model and end the session. ?

 

Thanks!!!

Find more posts tagged with

Sort by:
1 - 10 of 101
    User: "tinh"
    Altair Community Member
    Updated by tinh

    What do you mean 'not getting success'?

     

    You should find out the cause first instead of searching a new one.

     

    I did that example and it works!

    Check your VS version, it must be compatible with the one built HM

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Can you please share the demo code which worked for you and the process to link the library files?

    I'm getting  the following Error:  'module machine type 'x86' conflicts with target machine type 'x64' ' . I tried to get Visual studio 64-bit, but didn't get, so how you did? Whether you had tried with 32-bit hypermesh?

     

     

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Demo code is in hm folder

    Everything targets to x64.

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    I did in the same way you suggested, but now there's another issue, debugging is taking a lot of time. 

    User: "tinh"
    Altair Community Member
    Updated by tinh

    That means you did something wrong.

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    I'll share the below code:

     

    #include <stdio.h>
    #include <stdlib.h>

    #include 'hm_extapi.h'
    #include 'hm_extapi_error.h'

    HM_ExtAPI*  xAPI = NULL;

    void open_api();
    void close_api();

    int main()
    {
        open_api();

        bool model = false;
        model = xAPI->ImportModel(HM_ExtAPI::AUTO, 'D:\veer\HM Files\HSG.stp', true);
        printf('model value is %B\n',model);
        close_api();
        scanf('Enter something to continue');
        return 0;
    }

    void open_api()
    {
        int err_code;

        printf('Opening API...\n');

        xAPI = Open_HM_ExtAPI(&err_code);

        if (err_code != ERR_XAPI_SUCCESS)
        {

            printf('Error \n');

        }

        printf('API ready.\n');
    }

    void close_api()
    {
        if (xAPI)
        {
            printf('Closing API...\n');
            Close_HM_ExtAPI(xAPI, true);
            printf('API closed.\n');
        }
    }

     

     

    I have linked the required library and header files, and trying to run simple code to import the model, 

    Can you please briefly share the whole process?

    Thanks!!! 

    User: "tinh"
    Altair Community Member
    Updated by tinh

     

    What is your result?

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hey Tinh,

    I was able to create session of hypermesh. Can I get the Id's of components , surfaces only using external api functions?

    Thanks!!

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Yes, you can do it. I don't remember the functions, search it in samples

    User: "Kudupudi Balaji"
    Altair Community Member
    Updated by Kudupudi Balaji

    Hi veer/tinh

     

    I'm trying to compile demo codes in visual studio but can't able to do anything.

    after running the code I'm getting this message shown in the pic

    I don't have much programing skills will you guys please help me.

     

    Thank you 

    <?xml version="1.0" encoding="UTF-8"?>hmapi.PNG