64 from builtins
import range
65 import maya.OpenMaya
as OpenMaya
66 import maya.OpenMayaMPx
as OpenMayaMPx
69 kPluginCmdName=
"spHelix"
72 kPitchLongFlag =
"-pitch"
74 kRadiusLongFlag =
"-radius"
77 class scriptedCommand(OpenMayaMPx.MPxCommand):
79 OpenMayaMPx.MPxCommand.__init__(self)
85 nknots = spans+2*deg-1
91 if argData.isFlagSet(kPitchFlag):
92 pitch = argData.flagArgumentDouble(kPitchFlag, 0)
93 if argData.isFlagSet(kRadiusFlag):
94 radius = argData.flagArgumentDouble(kRadiusFlag, 0)
101 for i
in range(0, ncvs):
103 pitch * i, radius * math.sin(i) ) )
105 for i
in range(0, nknots):
106 knotSequences.append( i )
120 curveFn.create( controlVertices,
122 OpenMaya.MFnNurbsCurve.kOpen,
126 curveFn.createWithEditPoints(controlVertices,
127 3, OpenMaya.MFnNurbsCurve.kOpen,
130 sys.stderr.write(
"Error creating curve.\n" )
136 return OpenMayaMPx.asMPxPtr( scriptedCommand() )
141 syntax.addFlag(kPitchFlag, kPitchLongFlag, OpenMaya.MSyntax.kDouble)
142 syntax.addFlag(kRadiusFlag, kRadiusLongFlag, OpenMaya.MSyntax.kDouble)
146 def initializePlugin(mobject):
147 mplugin = OpenMayaMPx.MFnPlugin(mobject,
"Autodesk",
"1.0",
"Any")
149 mplugin.registerCommand( kPluginCmdName, cmdCreator, syntaxCreator )
151 sys.stderr.write(
"Failed to register command: %s\n" % kPluginCmdName )
155 def uninitializePlugin(mobject):
156 mplugin = OpenMayaMPx.MFnPlugin(mobject)
158 mplugin.deregisterCommand( kPluginCmdName )
160 sys.stderr.write(
"Failed to unregister command: %s\n" % kPluginCmdName )