Delete material in the Material folder inside Mechanical
Erik Kostson
Member, Employee Posts: 233
✭✭✭✭
How can we delete a material (say Structural Steel) in the Materials folder inside Mechanical?
0
Comments
-
This is not possible to do, either manually (say by RMB on that material in that folder and choose delete) or via pure mechanical scripting it seems like.
One way of doing this is though via wbjn workbench scripting inside the mechanical script console. The following sample code deletes the Structural Steel material in the Materials folder (and Engineering Data) of the first system in the workbench project (SYS).
import wbjn ScriptCmds = """ system1 = GetSystem(Name="SYS") engineeringData1 = system1.GetContainer(ComponentName="Engineering Data") material1 = engineeringData1.GetMaterial(Name="Structural Steel") material1.Delete() """ wbjn.ExecuteCommand(ExtAPI, ScriptCmds) Model.RefreshMaterials() ExtAPI.DataModel.Tree.Refresh()
0
This discussion has been closed.