Say we have many named selections (NS) /groups in Spaceclaim, consisting of Solid 3D bodies. How can we automatically get the centroid of all these bodies belonging to the different NS/groups?
Below is a code that does that (loops and gets the centroind / cen ):
groups = GetActiveWindow().ActiveWindow.Groups for ns in groups: nm=ns.GetName() print(nm) me=ns.Members for mem in me: if isinstance(mem, DesignBody): # only DesignBodies mp=mem.MassProperties.RawSubject cen=mp.Center # get centroid print(cen[1]) # print y coordinate