How to use the RunHMTclString() function?

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi everybody,

 

I am working with HyperMesh using its External C/C++ API with Visual Studio 2005. I would just like to import a .stp model and after that process it. But I can not get it to import the required file. This is how I have tried so far:


bool model = false;
model = hm_api->ImportModel (HM_ExtAPI::STEP, 'E:\WAP09Celsius1_Lucian\Verformungsmodell\99_Daten_CATPart\00_Werkstueck_eingriff.stp', true);
printf('model = %d \n', model);

for which the output is simply:


model = 0

And by using:


hm_api->RunHMTclString ('*feinputwithdata2 #granite\step E:/WAP09Celsius1_Lucian/Verformungsmodell/99_Daten_CATPart/00_Werkstueck_eingriff.stp 1 0 -0.01 0 0 1 1 1 0');

with the following output:


Error:   reader is not supported on this platform.
Tcl/Tk script error:
0
    while executing
'*feinputwithdata2 #granitestep E:/WAP09Celsius1_Lucian/Verformungsmodell/99_Daten_CATPart/00_Werkstueck_eingriff.stp 1 0 -0.01 0 0 1 1 1 0'

Any advice is helpful.

 

Cheers,

Lucian.

--

 

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2014

    Hi Lucian,

     

        I have met a similar problem. I am working with HyperMesh11.0 via Visual Studio 2010. I type an example program on HyperMesh Refenrence Guide, and its function is delete all free lines from the model and saves the model without lines in the same file.

        When the program runs to the follow sentence:


    hm_api->RunHMTclString('*createmark lines 1 all')

        it will break off and tells me: 'package require tbcload 1.4'. But in fact I have found tbcload 1.7 in my <Altair_Home>. I wonder the problem will occur as long as the function RunHMTclString is invoked.But Idon't known how to solve it.The whole error message is as follow:


    Tbcload error: couldn't load library 'C:/Program Files/Altair/11.0/hw/tcl/tcl8.5.6/win64/lib/tbcload1.7/tbcload17.dll': this library or a dependent library could not be found in library path while executing 'load {C:/Program Files/Altair/11.0/hw/tcl/tcl8.5.6/win64/lib/tbcload1.7/tbcload17.dll}'
    ('package ifneeded tbcload 1.7' script)
    invoked from within 'package require tbcload 1.4'

        Did you finally solve your problem and will you give me some advice? Thanks a lot! image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'> :)

        Cheers,

        Oscar.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2014

    Hi,

        I have work out this problem.It is because of the version of HyperMesh.I Wonder there is something wrong with the HyperMesh 11.0 file, tbcload17.dll and tbcload17.lib, in the folder 'C:/Program Files/Altair/11.0/hw/tcl/tcl8.5.6/win64/lib/tbcload1.7', or at least some problem linking HyperMesh 11.0 with VS2010.When I copy the file,tbcload17.dll and tbcload17.lib,from the folder 'C:\Program Files\Altair\12.0\hw\tcl\tcl8.5.9\win64\lib\tbcload1.7' of HyperMesh 12.0,and replace the original file,tbcload17.dll and tbcload17.lib of  HyperMesh 11.0, The function hm_api->RunHMTclString will work!

        Wonderful image/emoticons/default_biggrin.png' alt=':D' srcset='/emoticons/biggrin@2x.png 2x' width='20' height='20'>

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2014

    Lucian,

     

    in C/C++, the character '\' is used for escape sequences, i.e a new lines. For windows paths, you should use '\\'. 

     

    Try changing your code to:

     


    bool model = false;
    model = hm_api->ImportModel (HM_ExtAPI::STEP, 'E:\\WAP09Celsius1_Lucian\\Verformungsmodell\\99_Daten_CATPart\\00_Werkstueck_eingriff.stp', true);
    printf('model = %d \n', model);

    Please, share if you have success with this change.

     

    Edit:

     

    There is an error in your RunHMTclString arguments, also used \\ in the #granite\step, remember that \ is a escape sequence., try added an extra \


    hm_api->RunHMTclString ('*feinputwithdata2 #granite\\step E:/WAP09Celsius1_Lucian/Verformungsmodell/99_Daten_CATPart/00_Werkstueck_eingriff.stp 1 0 -0.01 0 0 1 1 1 0');