Create Cone at Locator


#1

How can I create a cone at the selected Locator’s position but with the pivot of the Cone being at the base of the cone itself? It appears something is not working here. Here are my results

image

What i want…

image

my code…

def createMarkers(transforms, radius=1):
    markers = []

    for t in transforms:
        marker = cmds.polyCone(r=radius, h=radius*2, axis=(0, 1, 0)) # actually returns a list of 2 items, the transform and the polyCube input, so grab the first index.
        markerTM = marker[0]
        markers.append(markerTM)
        cmds.xform(markerTM, piv=[0,-radius,0], ws=True)

        pos = cmds.xform(t, q=1, ws=1, rp=1)
        cmds.xform(markerTM, t=pos, ws=1)
        # cmds.move(pos[0], pos[1], pos[2], markerTM, absolute=True)
        cmds.parent(markerTM, t)

    return markers


cmds.select( allDagObjects=True )
cmds.delete()
l = cmds.spaceLocator()
cmds.move(2, 3, 4, l, absolute=True)
transforms = [obj for obj in cmds.ls(sl=True) if cmds.listRelatives(obj)]
createMarkers(transforms)