So it works but only on the first.. Can anyone see why?
Code: Select all
xsi = Application
lm = LogMessage
from win32com.client import constants as c
sel = xsi.Selection
grab = sel(0)
cls = grab.Parent
par = cls.Parent
mesh = par.Parent
obj = mesh.Parent
lm (sel.count)
lm (grab)
lm (grab.Name)
lm (obj)
lm (mesh)
lm (cls)
lm (par)
for i in sel:
nam = (i.Name)
full = (i.FullName)
lm (nam)
lm (full)
dup = xsi.Duplicate(obj, "", 2, 1, 1, 0, 0, 1, 0, 1, "", "", "", "", "", "", "", "", "", "", 0)
Application.DeleteObj(str(dup(0))+".polymsh.cls.Shape")
Application.SetValue(str(dup(0))+".Name", nam, "")
tree = xsi.ApplyOp("ICETree", dup(0), "siNode", "", "", 0)
Application.AddICECompoundNode("MakeShapeMesh", tree)
Application.ConnectICENodes(str(tree)+".port1", str(tree)+".MakeShapeMesh.Execute")
Application.SetValue(str(tree)+".MakeShapeMesh.Reference", str(nam), "")
Application.SetValue(str(tree)+".MakeShapeMesh.Reference1", str(obj.Name), "")
xsi.FreezeObj((tree), "", "")
xsi.DeleteObj(tree)
Mod Edit ET: Added code tags which should be used in all posted code