Assigning a Dielectric Medium to an Imported Geometries in Lua Script

Hamad
Hamad Altair Community Member
edited November 2020 in Community Q&A

Hi there, 

 

I have a question about using lua script to assign a dielectric medium to an imported geometry in lua script. The imported geometry consists of three adjacent pieces which are unionized in the script (see the attached file). I am trying to create assign the defined dielectric medium to all those unionized geometry (the three pieces) all at once, so can anyone help me with that? 

 

I was successfully assigning the medium to the individual pieces (see the attached script), but I need a script that do the assignment to all the pieces in the union all at once (just like how I perform the union). 

 

Test1.lua (attached script) includes the command to import the geometry in test1.dxf which contains the three pieces. 

Unable to find an attachment - read this blog

Answers

  • Hamad
    Hamad Altair Community Member
    edited August 2017

    The following script will do: 

     

    Union1 = project.Geometry['Union1']

    for key,value in pairs(Union1.Regions) do
        value.Medium = dielectric
    end

     

    This works and if you have any comment let me know.