Problems with .lua scripting

Student_21133
Student_21133 Altair Community Member
edited January 2023 in Community Q&A

Hello,

I try to write a .lua script in order to automatize the creation of a scene.

For instance, I can add a cuboid to this scene, then translate it and scale it (cf. "Script1.lua").

It's then appreciable to use the macro recording to understand the feko lua coding.

But in this case, I have the messages " Macro recording is not supported…" when scripting the translation/scaling (lines 17 and 25). If I delete this lines, the .lua file works fine (i.e. creates and translates/scales correctly my cuboid).

Would anyone have an explanation ?

 

I also need to add some items of the component library (for instance helicopters, ships, cars…) :

image

but it seems that Feko doesn't allow to script that in a .lua file : when I record the adding of an helicopter, I get the message "Macro recording is not supported for the Component Library."

Would someone know a command to put in a .lua script in order to add component library items ?

Thank you in advance.

Best Answer

  • Torben Voigt
    Torben Voigt Altair Community Member
    edited January 2023 Answer ✓

    Hi @Student ,

    The problem with scaling seems to be related to the local workplane. However, I could not reproduce the problem quickly. Do you depend on a local workplane?

    Maybe a workaround for the component library would be to save the model (e.g. a helicopter) as a model first and then import it in the script?

    Best regards,
    Torben

Answers

  • Torben Voigt
    Torben Voigt Altair Community Member
    edited January 2023 Answer ✓

    Hi @Student ,

    The problem with scaling seems to be related to the local workplane. However, I could not reproduce the problem quickly. Do you depend on a local workplane?

    Maybe a workaround for the component library would be to save the model (e.g. a helicopter) as a model first and then import it in the script?

    Best regards,
    Torben

  • Student_21133
    Student_21133 Altair Community Member
    edited January 2023

    Hi Mr. Voigt,

    No, I used the default workplane. This problem disappears anyway when I reuse the .lua script produced by the macro recording, while deleting the error message.

    Concerning the workaround that you described, I applied it and it seems to work well : I simply save my component list item alone (for instance an helicopter) in a .cfx file, which I import later in my main other .cfx, as described in this link :

    https://community.altair.com/community?id=community_question&sys_id=fb560cf61b2bd0908017dc61ec4bcbc9

    This can be scripted, and it seems also to work fine.

    Thank you for your help !