Softimage Curve CopyIcon


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
from win32com.client import constants as c
from win32com.client import Dispatch as d
 
xsi = Application
log = xsi.LogMessage
collSel = xsi.Selection
 
DEBUG = 0
 
def copyIcon():
 
	if collSel.Count < 1:
		log("No target curves selected.",4)
		return False
 
	collPreSelection = d("XSI.Collection")
	collPreSelection.SetAsText(collSel.GetAsText())
 
	oPick = xsi.PickElement(c.siCurveFilter,"Pick Source Curve","Pick Source Curve")
	if oPick(0) == 0:
		log("Copy Icon cancelled",4)
		return False
 
	oSrcCurve = oPick(2)
	oSrcCurveGeo = oSrcCurve.ActivePrimitive.Geometry
	oSrcCrvList = oSrcCurveGeo.Curves
	intSrcCrvCount = oSrcCrvList.Count
 
	for eachCurve in collPreSelection:
		xsi.FreezeModeling(eachCurve)
		oCrvGeo = eachCurve.ActivePrimitive.Geometry
		oCrvList = oCrvGeo.Curves
 
		for i in range(intSrcCrvCount):
			aSrcCrvDef = oSrcCrvList(i).Get2(c.siSINurbs)
 
			if i > oCrvList.Count - 1:
				oCrvGeo.AddCurve(aSrcCrvDef[0],None,aSrcCrvDef[2],aSrcCrvDef[3],c.siNonUniformParameterization,c.siSINurbs)
			else:
				oCrvList(i).Set(aSrcCrvDef[0],None,aSrcCrvDef[2],aSrcCrvDef[3],c.siNonUniformParameterization,c.siSINurbs)
 
copyIcon()