I'm really new to Blender, and want to script an octahedron with all parts neatly placed inside its own collection.
But somehow, when I create a new collection and link objects to my newly created collection, the objects also stay linked to the original "Scene Collection".
In a new scene, when I drag and drop a manual added object to the scene, that I than add to the personal collection this does not happen?
myCollections = bpy.data.collections
colOcta = myCollections.new('col_Octahedron')
bpy.context.scene.collection.children.link(colOcta)
vtxAmount = 6
vtxPositions = [(0, 0, 10), (10, 0, 0), (0, 10, 0), (-10, 0, 0), (0, -10, 0), (0, 0, -10)]
for i in range(vtxAmount):
iSolve = i + 1
nowPos = vtxPositions[i]
myX = nowPos[0]
myY = nowPos[1]
myZ = nowPos[2]
#print(myX)
newObj = bpy.ops.mesh.primitive_uv_sphere_add(radius=1, enter_editmode=False, location=(myX, myY, myZ))
myObj = bpy.context.object
myObj.name = "obj_Sphere%s" %iSolve
myObj.data.name = "dat_Sphere%s" %iSolve
grpOcta.objects.link(myObj)

