How to import CAD data via script including all options?

Manuel Armbruester
Manuel Armbruester Altair Community Member
edited February 2022 in Community Q&A

Hello alls,

For importing CAD CATIA data into HyperMesh I want to create a macro instead of using the import-GUI.

 

Background:

we are using PartBrowser (import as parts) with defined entries for PDM-data and using a config-file.

To do all this by the user => will result in errors....

 

Problem:

I know, there is a command called "*feinputwithdata2"

But i d not know, how to provide all the required info to this one... (name of config file, to import as parts instead of as assemply/component and so on...)

 

Question:

Can someone tell me or provide an existing script,

how the "*feinputwithdata2" has to be set up to control all the options which I have in CAD-Import-GUI available?

Or can anybody tell me a different command for this...

 

Thanks a lot

and best regards

Manuel

 

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited August 2021

    Hi,

     

    I don't have the full description for this command, but usually waht I do is to open the GUI, import a few files manually, setting the desired options on importing, and after doing this, I open the 'command.tcl' and check the options written there. Usually this is quicker than figuring out all options.

  • Sanaa Mouzahir
    Sanaa Mouzahir Altair Community Member
    edited February 2022

    Hi,

     

    I don't have the full description for this command, but usually waht I do is to open the GUI, import a few files manually, setting the desired options on importing, and after doing this, I open the 'command.tcl' and check the options written there. Usually this is quicker than figuring out all options.

    That is a good idea! Could you give more details ? I want to run a Macro that imports a Solidworks File. According to what you wrote I should be able to just import the file manually, then find the code on the tcl console ? 

    I don't see anything on the console, but maybe I did not understand properly ? Thank you already.

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited February 2022

    That is a good idea! Could you give more details ? I want to run a Macro that imports a Solidworks File. According to what you wrote I should be able to just import the file manually, then find the code on the tcl console ? 

    I don't see anything on the console, but maybe I did not understand properly ? Thank you already.

    everything you do in HM is recorded to a file named 'command.tcl'.

    From the menus, you can open the contents of it, with each command that you've used manually.

    From there, you can copy the commands, search at the Help and automate these, by combining TCL commands, and create your own script. There are a few basic tutorials in the help of HyperMesh.

     

    image

     

    Usually the command.tcl files are written to your working directory, which tipically is Documents folder.

    image

  • Sanaa Mouzahir
    Sanaa Mouzahir Altair Community Member
    edited February 2022

    everything you do in HM is recorded to a file named 'command.tcl'.

    From the menus, you can open the contents of it, with each command that you've used manually.

    From there, you can copy the commands, search at the Help and automate these, by combining TCL commands, and create your own script. There are a few basic tutorials in the help of HyperMesh.

     

    image

     

    Usually the command.tcl files are written to your working directory, which tipically is Documents folder.

    image

    Thank you for this extremely helpful insight. I tried this and indeed obtained a tcl file named 'Command1.tcl'. 

    The thing is, when I copy what I have in the file to the console or to Python (Using tkinter), I obtain errors such as:invalid command name "*createstringarray", indicating the commands of the file are invalid. 

    I am a little lost regarding what I should do to solve the issue. Any leads? 

    Thank you so much!