import maya.mel as mm
import pymel.core as pm
createSphereCtlmel = '''createNode transform -n "sphere_ctl";
	setAttr ".ove" yes;
	setAttr ".ovc" 23;
createNode nurbsCurve -n "sphere_ctlShape" -p "sphere_ctl";
	setAttr -k off ".v";
	setAttr ".cc" -type "nurbsCurve" 
		1 52 0 no 3
		53 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
		 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
		53
		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007
		2.4002848877378454e-006 2.3097001415645648 -0.95670729667575005
		2.7936796139264932e-006 1.7677677313243909 -1.7677674211967007
		2.7617604729952385e-006 0.95670778586711669 -2.3097000577147804
		2.3093885378047716e-006 2.9688893404612974e-007 -2.5000001854458858
		1.5054352855951999e-006 -0.95670723728763729 -2.3097002849447095
		4.7228999894414808e-007 -1.7677673114600272 -1.7677678410634667
		-6.3275739712905504e-007 -2.3096999143360941 -0.95670784525822505
		-1.6414698113439104e-006 -2.5000000302533381 -2.9689054428722985e-007
		-2.4002848664217759e-006 -2.3097001415648775 0.95670729667575316
		-2.7936795926104216e-006 -1.7677677313247036 1.7677674211967014
		-2.7617604729954079e-006 -0.95670778586737248 2.3097000577147817
		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889
		-1.505435271384518e-006 0.9567072372873815 2.3097002849447117
		-4.7228998473346594e-007 1.7677673114597714 1.7677678410634685
		6.327574255505687e-007 2.3096999143358099 0.95670784525822861
		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007
		-0.95670577731741913 2.3097006561127609 -6.0947216232185142e-007
		-1.7677659583679914 1.7677686820868006 -1.4230508009838491e-006
		-2.3096988741188569 0.95670902809828551 -2.0199821124968874e-006
		-2.4999994612736018 1.6414696409585508e-006 -2.3093876663635853e-006
		-2.309700130444051 -0.95670599505644005 -2.2472120413914027e-006
		-1.7677682797576066 -1.7677663606976743 -1.8429175670665804e-006
		-0.95670881035970401 -2.3096993997878981 -1.158054636895729e-006
		-1.6414698113439104e-006 -2.5000000302533381 -2.9689054428722985e-007
		0.95670577731743334 -2.3097006561130451 6.0947216409818783e-007
		1.7677659583679914 -1.7677686820871132 1.4230508027601689e-006
		2.3096988741188711 -0.95670902809856972 2.0199821147173127e-006
		2.4999994612736156 -1.6414698399105289e-006 2.3093876681399316e-006
		2.3097001304440652 0.95670599505618426 2.2472120431677422e-006
		1.7677682797576066 1.7677663606973333 1.8429175688428968e-006
		0.95670881035971111 2.3096993997876138 1.1580546386720588e-006
		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007
		6.327574255505687e-007 2.3096999143358099 0.95670784525822861
		-4.7228998473346594e-007 1.7677673114597714 1.7677678410634685
		-1.505435271384518e-006 0.9567072372873815 2.3097002849447117
		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889
		0.95670516024070007 -9.0245255476855184e-007 2.3097010550931469
		1.7677654860779997 -1.3706271712630089e-006 1.7677692641142704
		2.30969861851773 -1.6301355558039744e-006 0.95670970456406801
		2.4999994612736156 -1.6414698399105289e-006 2.3093876681399316e-006
		2.3097003860451992 -1.4029067728967838e-006 -0.95670543736990976
		1.7677687520476055 -9.5076255193408841e-007 -1.7677659981458989
		0.95670942743645149 -3.5387284792947253e-007 -2.3096992875663442
		2.3093885378047716e-006 2.9688893404612974e-007 -2.5000001854458858
		-0.95670516024068586 9.0245232739486411e-007 -2.3097010550931456
		-1.7677654860779997 1.3706269438893307e-006 -1.7677692641142688
		-2.3096986185177228 1.6301353000085815e-006 -0.9567097045640649
		-2.4999994612736018 1.6414696409585508e-006 -2.3093876663635853e-006
		-2.3097003860451779 1.4029065455230916e-006 0.95670543736991198
		-1.7677687520475842 9.5076226771697664e-007 1.7677659981458995
		-0.95670942743643728 3.5387256371236536e-007 2.3096992875663456
		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889
		;
select sphere_ctl;'''
createPinCtlmel = '''
createNode transform -n "pin_ctl";
	setAttr ".ove" yes;
	setAttr ".ovrgbf" yes;
	setAttr ".ovrgb" -type "float3" 0 0.34999999 1 ;
createNode nurbsCurve -n "pin_ctlShape" -p "pin_ctl";
	setAttr -k off ".v";
	setAttr ".cc" -type "nurbsCurve" 
		1 25 0 no 3
		26 0 0.37689 0.75376699999999996 1.130657 1.5075460000000001 1.884423 2.2613129999999999
		 2.6382029999999999 3.0150800000000002 3.3919700000000002 3.768859 4.1457369999999996
		 4.5226249999999997 4.8995129999999998 5.2763910000000003 5.6532799999999996 6.0301710000000002
		 6.4070470000000004 6.7839369999999999 7.1608270000000003 7.5377039999999997 7.9145940000000001
		 8.2914840000000005 8.6683610000000009 9.0452510000000004 19.157319000000001
		26
		-1.575261882735e-007 4.2054683464182183 0
		-0.37349322563385101 4.2559573395113564 0
		-0.72168229276648799 4.4001823197814769 0
		-1.0214823544731599 4.6285802885367886 0
		-1.2498804061955291 4.9283802475243554 0
		-1.3941054448074195 5.2765691998923412 0
		-1.4445944677487039 5.6500621487987566 0
		-1.3941054727876261 6.0235550977051719 0
		-1.2498804602602571 6.3717430500732952 0
		-1.0214824309974251 6.6715440090607263 0
		-0.72168238640113869 6.8999409778161738 0
		-0.37349333007318419 7.0441679580860201 0
		-2.6574741500836927e-007 7.094643951180938 0
		0.37349280235976079 7.0441679580860201 0
		0.72168186949247259 6.8999409778161738 0
		1.0214819311991072 6.6715440090607263 0
		1.2498799829215139 6.3717430500732952 0
		1.3941050215333668 6.0235550977051719 0
		1.4445940444746512 5.6500621487987566 0
		1.3941050495135734 5.2765691998923412 0
		1.2498800369862419 4.9283802475243554 0
		1.0214820077233724 4.6285802885367886 0
		0.72168196312712329 4.4001823197814769 0
		0.37349290679909397 4.2559573395113564 0
		-1.575261882735e-007 4.2054683464182183 0
		0 0 0
		;
select pin_ctl;'''
def createSphereCtl(name='sphere_ctl01'):
    mm.eval(createSphereCtlmel)
    temp = pm.selected()
    new = pm.duplicate(temp[0], name=name)[0]
    pm.delete(temp)
    return new
def createPinCtl(name='pin_ctl01'):
    mm.eval(createPinCtlmel)
    temp = pm.selected()
    new = pm.duplicate(temp[0], name=name)[0]
    pm.delete(temp)
    return new
import maya.mel as mm
import pymel.core as pm
createSphereCtlmel = '''createNode transform -n "sphere_ctl";
	setAttr ".ove" yes;
	setAttr ".ovc" 23;
createNode nurbsCurve -n "sphere_ctlShape" -p "sphere_ctl";
	setAttr -k off ".v";
	setAttr ".cc" -type "nurbsCurve" 
		1 52 0 no 3
		53 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
		 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
		53
		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007
		2.4002848877378454e-006 2.3097001415645648 -0.95670729667575005
		2.7936796139264932e-006 1.7677677313243909 -1.7677674211967007
		2.7617604729952385e-006 0.95670778586711669 -2.3097000577147804
		2.3093885378047716e-006 2.9688893404612974e-007 -2.5000001854458858
		1.5054352855951999e-006 -0.95670723728763729 -2.3097002849447095
		4.7228999894414808e-007 -1.7677673114600272 -1.7677678410634667
		-6.3275739712905504e-007 -2.3096999143360941 -0.95670784525822505
		-1.6414698113439104e-006 -2.5000000302533381 -2.9689054428722985e-007
		-2.4002848664217759e-006 -2.3097001415648775 0.95670729667575316
		-2.7936795926104216e-006 -1.7677677313247036 1.7677674211967014
		-2.7617604729954079e-006 -0.95670778586737248 2.3097000577147817
		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889
		-1.505435271384518e-006 0.9567072372873815 2.3097002849447117
		-4.7228998473346594e-007 1.7677673114597714 1.7677678410634685
		6.327574255505687e-007 2.3096999143358099 0.95670784525822861
		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007
		-0.95670577731741913 2.3097006561127609 -6.0947216232185142e-007
		-1.7677659583679914 1.7677686820868006 -1.4230508009838491e-006
		-2.3096988741188569 0.95670902809828551 -2.0199821124968874e-006
		-2.4999994612736018 1.6414696409585508e-006 -2.3093876663635853e-006
		-2.309700130444051 -0.95670599505644005 -2.2472120413914027e-006
		-1.7677682797576066 -1.7677663606976743 -1.8429175670665804e-006
		-0.95670881035970401 -2.3096993997878981 -1.158054636895729e-006
		-1.6414698113439104e-006 -2.5000000302533381 -2.9689054428722985e-007
		0.95670577731743334 -2.3097006561130451 6.0947216409818783e-007
		1.7677659583679914 -1.7677686820871132 1.4230508027601689e-006
		2.3096988741188711 -0.95670902809856972 2.0199821147173127e-006
		2.4999994612736156 -1.6414698399105289e-006 2.3093876681399316e-006
		2.3097001304440652 0.95670599505618426 2.2472120431677422e-006
		1.7677682797576066 1.7677663606973333 1.8429175688428968e-006
		0.95670881035971111 2.3096993997876138 1.1580546386720588e-006
		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007
		6.327574255505687e-007 2.3096999143358099 0.95670784525822861
		-4.7228998473346594e-007 1.7677673114597714 1.7677678410634685
		-1.505435271384518e-006 0.9567072372873815 2.3097002849447117
		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889
		0.95670516024070007 -9.0245255476855184e-007 2.3097010550931469
		1.7677654860779997 -1.3706271712630089e-006 1.7677692641142704
		2.30969861851773 -1.6301355558039744e-006 0.95670970456406801
		2.4999994612736156 -1.6414698399105289e-006 2.3093876681399316e-006
		2.3097003860451992 -1.4029067728967838e-006 -0.95670543736990976
		1.7677687520476055 -9.5076255193408841e-007 -1.7677659981458989
		0.95670942743645149 -3.5387284792947253e-007 -2.3096992875663442
		2.3093885378047716e-006 2.9688893404612974e-007 -2.5000001854458858
		-0.95670516024068586 9.0245232739486411e-007 -2.3097010550931456
		-1.7677654860779997 1.3706269438893307e-006 -1.7677692641142688
		-2.3096986185177228 1.6301353000085815e-006 -0.9567097045640649
		-2.4999994612736018 1.6414696409585508e-006 -2.3093876663635853e-006
		-2.3097003860451779 1.4029065455230916e-006 0.95670543736991198
		-1.7677687520475842 9.5076226771697664e-007 1.7677659981458995
		-0.95670942743643728 3.5387256371236536e-007 2.3096992875663456
		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889
		;
select sphere_ctl;'''
createPinCtlmel = '''
createNode transform -n "pin_ctl";
	setAttr ".ove" yes;
	setAttr ".ovrgbf" yes;
	setAttr ".ovrgb" -type "float3" 0 0.34999999 1 ;
createNode nurbsCurve -n "pin_ctlShape" -p "pin_ctl";
	setAttr -k off ".v";
	setAttr ".cc" -type "nurbsCurve" 
		1 25 0 no 3
		26 0 0.37689 0.75376699999999996 1.130657 1.5075460000000001 1.884423 2.2613129999999999
		 2.6382029999999999 3.0150800000000002 3.3919700000000002 3.768859 4.1457369999999996
		 4.5226249999999997 4.8995129999999998 5.2763910000000003 5.6532799999999996 6.0301710000000002
		 6.4070470000000004 6.7839369999999999 7.1608270000000003 7.5377039999999997 7.9145940000000001
		 8.2914840000000005 8.6683610000000009 9.0452510000000004 19.157319000000001
		26
		-1.575261882735e-007 4.2054683464182183 0
		-0.37349322563385101 4.2559573395113564 0
		-0.72168229276648799 4.4001823197814769 0
		-1.0214823544731599 4.6285802885367886 0
		-1.2498804061955291 4.9283802475243554 0
		-1.3941054448074195 5.2765691998923412 0
		-1.4445944677487039 5.6500621487987566 0
		-1.3941054727876261 6.0235550977051719 0
		-1.2498804602602571 6.3717430500732952 0
		-1.0214824309974251 6.6715440090607263 0
		-0.72168238640113869 6.8999409778161738 0
		-0.37349333007318419 7.0441679580860201 0
		-2.6574741500836927e-007 7.094643951180938 0
		0.37349280235976079 7.0441679580860201 0
		0.72168186949247259 6.8999409778161738 0
		1.0214819311991072 6.6715440090607263 0
		1.2498799829215139 6.3717430500732952 0
		1.3941050215333668 6.0235550977051719 0
		1.4445940444746512 5.6500621487987566 0
		1.3941050495135734 5.2765691998923412 0
		1.2498800369862419 4.9283802475243554 0
		1.0214820077233724 4.6285802885367886 0
		0.72168196312712329 4.4001823197814769 0
		0.37349290679909397 4.2559573395113564 0
		-1.575261882735e-007 4.2054683464182183 0
		0 0 0
		;
select pin_ctl;'''
def createSphereCtl(name='sphere_ctl01'):
    mm.eval(createSphereCtlmel)
    temp = pm.selected()
    new = pm.duplicate(temp[0], name=name)[0]
    pm.delete(temp)
    return new
def createPinCtl(name='pin_ctl01'):
    mm.eval(createPinCtlmel)
    temp = pm.selected()
    new = pm.duplicate(temp[0], name=name)[0]
    pm.delete(temp)
    return new
createNode transform -n "sphere_ctl"; 	setAttr ".ove" yes; 	setAttr ".ovc" 23; createNode nurbsCurve -n "sphere_ctlShape" -p "sphere_ctl"; 	setAttr -k off ".v"; 	setAttr ".cc" -type "nurbsCurve"  		1 52 0 no 3 		53 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 		 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 		53 		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007 		2.4002848877378454e-006 2.3097001415645648 -0.95670729667575005 		2.7936796139264932e-006 1.7677677313243909 -1.7677674211967007 		2.7617604729952385e-006 0.95670778586711669 -2.3097000577147804 		2.3093885378047716e-006 2.9688893404612974e-007 -2.5000001854458858 		1.5054352855951999e-006 -0.95670723728763729 -2.3097002849447095 		4.7228999894414808e-007 -1.7677673114600272 -1.7677678410634667 		-6.3275739712905504e-007 -2.3096999143360941 -0.95670784525822505 		-1.6414698113439104e-006 -2.5000000302533381 -2.9689054428722985e-007 		-2.4002848664217759e-006 -2.3097001415648775 0.95670729667575316 		-2.7936795926104216e-006 -1.7677677313247036 1.7677674211967014 		-2.7617604729954079e-006 -0.95670778586737248 2.3097000577147817 		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889 		-1.505435271384518e-006 0.9567072372873815 2.3097002849447117 		-4.7228998473346594e-007 1.7677673114597714 1.7677678410634685 		6.327574255505687e-007 2.3096999143358099 0.95670784525822861 		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007 		-0.95670577731741913 2.3097006561127609 -6.0947216232185142e-007 		-1.7677659583679914 1.7677686820868006 -1.4230508009838491e-006 		-2.3096988741188569 0.95670902809828551 -2.0199821124968874e-006 		-2.4999994612736018 1.6414696409585508e-006 -2.3093876663635853e-006 		-2.309700130444051 -0.95670599505644005 -2.2472120413914027e-006 		-1.7677682797576066 -1.7677663606976743 -1.8429175670665804e-006 		-0.95670881035970401 -2.3096993997878981 -1.158054636895729e-006 		-1.6414698113439104e-006 -2.5000000302533381 -2.9689054428722985e-007 		0.95670577731743334 -2.3097006561130451 6.0947216409818783e-007 		1.7677659583679914 -1.7677686820871132 1.4230508027601689e-006 		2.3096988741188711 -0.95670902809856972 2.0199821147173127e-006 		2.4999994612736156 -1.6414698399105289e-006 2.3093876681399316e-006 		2.3097001304440652 0.95670599505618426 2.2472120431677422e-006 		1.7677682797576066 1.7677663606973333 1.8429175688428968e-006 		0.95670881035971111 2.3096993997876138 1.1580546386720588e-006 		1.6414698326599991e-006 2.5000000302530538 2.9689054650766197e-007 		6.327574255505687e-007 2.3096999143358099 0.95670784525822861 		-4.7228998473346594e-007 1.7677673114597714 1.7677678410634685 		-1.505435271384518e-006 0.9567072372873815 2.3097002849447117 		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889 		0.95670516024070007 -9.0245255476855184e-007 2.3097010550931469 		1.7677654860779997 -1.3706271712630089e-006 1.7677692641142704 		2.30969861851773 -1.6301355558039744e-006 0.95670970456406801 		2.4999994612736156 -1.6414698399105289e-006 2.3093876681399316e-006 		2.3097003860451992 -1.4029067728967838e-006 -0.95670543736990976 		1.7677687520476055 -9.5076255193408841e-007 -1.7677659981458989 		0.95670942743645149 -3.5387284792947253e-007 -2.3096992875663442 		2.3093885378047716e-006 2.9688893404612974e-007 -2.5000001854458858 		-0.95670516024068586 9.0245232739486411e-007 -2.3097010550931456 		-1.7677654860779997 1.3706269438893307e-006 -1.7677692641142688 		-2.3096986185177228 1.6301353000085815e-006 -0.9567097045640649 		-2.4999994612736018 1.6414696409585508e-006 -2.3093876663635853e-006 		-2.3097003860451779 1.4029065455230916e-006 0.95670543736991198 		-1.7677687520475842 9.5076226771697664e-007 1.7677659981458995 		-0.95670942743643728 3.5387256371236536e-007 2.3096992875663456 		-2.309388530699498e-006 -2.9688916141981296e-007 2.5000001854458889 		; select sphere_ctl; createNode transform -n "pin_ctl"; 	setAttr ".ove" yes; 	setAttr ".ovrgbf" yes; 	setAttr ".ovrgb" -type "float3" 0 0.34999999 1 ; createNode nurbsCurve -n "pin_ctlShape" -p "pin_ctl"; 	setAttr -k off ".v"; 	setAttr ".cc" -type "nurbsCurve"  		1 25 0 no 3 		26 0 0.37689 0.75376699999999996 1.130657 1.5075460000000001 1.884423 2.2613129999999999 		 2.6382029999999999 3.0150800000000002 3.3919700000000002 3.768859 4.1457369999999996 		 4.5226249999999997 4.8995129999999998 5.2763910000000003 5.6532799999999996 6.0301710000000002 		 6.4070470000000004 6.7839369999999999 7.1608270000000003 7.5377039999999997 7.9145940000000001 		 8.2914840000000005 8.6683610000000009 9.0452510000000004 19.157319000000001 		26 		-1.575261882735e-007 4.2054683464182183 0 		-0.37349322563385101 4.2559573395113564 0 		-0.72168229276648799 4.4001823197814769 0 		-1.0214823544731599 4.6285802885367886 0 		-1.2498804061955291 4.9283802475243554 0 		-1.3941054448074195 5.2765691998923412 0 		-1.4445944677487039 5.6500621487987566 0 		-1.3941054727876261 6.0235550977051719 0 		-1.2498804602602571 6.3717430500732952 0 		-1.0214824309974251 6.6715440090607263 0 		-0.72168238640113869 6.8999409778161738 0 		-0.37349333007318419 7.0441679580860201 0 		-2.6574741500836927e-007 7.094643951180938 0 		0.37349280235976079 7.0441679580860201 0 		0.72168186949247259 6.8999409778161738 0 		1.0214819311991072 6.6715440090607263 0 		1.2498799829215139 6.3717430500732952 0 		1.3941050215333668 6.0235550977051719 0 		1.4445940444746512 5.6500621487987566 0 		1.3941050495135734 5.2765691998923412 0 		1.2498800369862419 4.9283802475243554 0 		1.0214820077233724 4.6285802885367886 0 		0.72168196312712329 4.4001823197814769 0 		0.37349290679909397 4.2559573395113564 0 		-1.575261882735e-007 4.2054683464182183 0 		0 0 0 		; select pin_ctl;