Setting base material in material plugins problem


#1

I can set the base material in material plugins from the software, but using the script to do it it says “The material’s Base Material property is not available”. I can set all the parameters fro the script except for the base material, what is the problem with that?
Thanks


#2

Hi Shaimaa,

At the moment, it is not possible to set the base material using script command. This is a feature that will be added in the future.


#3

Thank you.


#4

So, what’s the solution if I want to build all the model by script and if I need to use a material that is not in the standard material library?
Today, I load an empty .fsp (or no-empty and use deleteall) in which I have set the materials I need (sample material). Is there another way?

Best regards,
Jérôme


#5

Adding a sampled data type material to the Material Database should be possible through script, ie, addmaterial. However, I think loading the sampled data in is kind of a GUI process. One way I would suggest you taking a look is making your own default database, if you need to create new projects frequency with some non-default material.

https://kb.lumerical.com/en/index.html?materials_default_optical_database.html

If you do not want to modify default database, the other way could be making your own material_library.fsp. That way, you can create you materials and save it in the material_library.fsp file. When you create a new project file, the first line of the script file is going to be load(“material_library.fsp”). This will also inherit the material you created previously for your new project. Obviously, make sure you save the new project file with a different name that the library file can be re-used in the future.


#6

I think I wasn’t 100% correct and in fact it should be possible to load material data to Sampled data material using scripting commands, see the second example of the setmaterial command. Alongside with the readdata command, it makes it possible to load the data stored in a text file within the scripting environment.