<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python Script to create objects from intSlider in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/python-script-to-create-objects-from-intslider/m-p/7214174#M11631</link>
    <description>&lt;P&gt;Hey guys,&amp;nbsp;&lt;BR /&gt;i am very new to python and want to create a Script to create joints.&lt;/P&gt;&lt;P&gt;The Idea is to get a window and there I can set the number with the intSlider.&lt;BR /&gt;Once i press CreateJoints it should create the number i set in the intSlider:&lt;/P&gt;&lt;P&gt;I just can't figer out what's wrong here:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;import maya.cmds as cmds&lt;BR /&gt;cmds.window(title = "Create Joints", width = 300, height = 100)&lt;BR /&gt;cmds.columnLayout("CreateJointsLayout", adjustableColumn = True)&lt;BR /&gt;slider = cmds.intSliderGrp ( "CreateJoints", label = "Joints", field = True, fieldMinValue = 1, fieldMaxValue = 10, minValue = 1, maxValue = 100, columnWidth3 = [50, 50, 50], columnAlign3 = ["left", "both", "left"], value = 0, parent = "CreateJointsLayout")&lt;BR /&gt;cmds.showWindow()&lt;BR /&gt;Number = cmds.intSliderGrp ( "CreateJoints", query = True, value = True)&lt;BR /&gt;CreateOne = cmds.button(label = "click me", parent = "CreateJointsLayout", command = CreateJoints)&lt;BR /&gt;print Number&lt;/P&gt;&lt;P&gt;def CreateJoints():&lt;BR /&gt;for Number in slider:&lt;BR /&gt;sel = cmds.joint( p=(0, 0, 0) )&lt;BR /&gt;cmds.select( sel, tgl=True )&lt;BR /&gt;&lt;BR /&gt;Thanks for your help and time!&lt;/P&gt;</description>
    <pubDate>Sat, 08 Jul 2017 07:44:07 GMT</pubDate>
    <dc:creator>strubefabian4</dc:creator>
    <dc:date>2017-07-08T07:44:07Z</dc:date>
    <item>
      <title>Python Script to create objects from intSlider</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-script-to-create-objects-from-intslider/m-p/7214174#M11631</link>
      <description>&lt;P&gt;Hey guys,&amp;nbsp;&lt;BR /&gt;i am very new to python and want to create a Script to create joints.&lt;/P&gt;&lt;P&gt;The Idea is to get a window and there I can set the number with the intSlider.&lt;BR /&gt;Once i press CreateJoints it should create the number i set in the intSlider:&lt;/P&gt;&lt;P&gt;I just can't figer out what's wrong here:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;import maya.cmds as cmds&lt;BR /&gt;cmds.window(title = "Create Joints", width = 300, height = 100)&lt;BR /&gt;cmds.columnLayout("CreateJointsLayout", adjustableColumn = True)&lt;BR /&gt;slider = cmds.intSliderGrp ( "CreateJoints", label = "Joints", field = True, fieldMinValue = 1, fieldMaxValue = 10, minValue = 1, maxValue = 100, columnWidth3 = [50, 50, 50], columnAlign3 = ["left", "both", "left"], value = 0, parent = "CreateJointsLayout")&lt;BR /&gt;cmds.showWindow()&lt;BR /&gt;Number = cmds.intSliderGrp ( "CreateJoints", query = True, value = True)&lt;BR /&gt;CreateOne = cmds.button(label = "click me", parent = "CreateJointsLayout", command = CreateJoints)&lt;BR /&gt;print Number&lt;/P&gt;&lt;P&gt;def CreateJoints():&lt;BR /&gt;for Number in slider:&lt;BR /&gt;sel = cmds.joint( p=(0, 0, 0) )&lt;BR /&gt;cmds.select( sel, tgl=True )&lt;BR /&gt;&lt;BR /&gt;Thanks for your help and time!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 07:44:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-script-to-create-objects-from-intslider/m-p/7214174#M11631</guid>
      <dc:creator>strubefabian4</dc:creator>
      <dc:date>2017-07-08T07:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script to create objects from intSlider</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-script-to-create-objects-from-intslider/m-p/7338715#M11632</link>
      <description>&lt;P&gt;There are a few things going on here, I'll tell you what they are and then show a finished example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The intSliderGrp "command" argument needs to refer to a known Python method, so you have to move the definition of CreateJoints before it&lt;/LI&gt;
&lt;LI&gt;In order to iterate over your new value you have to query it from the intSliderGrp.&lt;/LI&gt;
&lt;LI&gt;The CreateJoints callback from a button requires a single argument, which can be ignored for your purposes&lt;/LI&gt;
&lt;LI&gt;Your "for" loop should iterate over a numeric range. "slider" is a UI widget&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;import maya.cmds as cmds

cmds.window(title = "Create Joints", width = 300, height = 100)
cmds.columnLayout("CreateJointsLayout", adjustableColumn = True)
slider = cmds.intSliderGrp ( "CreateJoints", label = "Joints", field = True, fieldMinValue = 1, fieldMaxValue = 10, minValue = 1, maxValue = 100, columnWidth3 = [50, 50, 50], columnAlign3 = ["left", "both", "left"], value = 0, parent = "CreateJointsLayout")
cmds.showWindow()

def CreateJoints(button_value):
    slider_value = cmds.intSliderGrp( slider, query=True, value=True )
    print slider_value
    for Number in range(0,slider_value):
        sel = cmds.joint( p=(0, 0, 0) )
        cmds.select( sel, tgl=True )
        
CreateOne = cmds.button(label = "click me", parent = "CreateJointsLayout", command = CreateJoints)
&lt;/PRE&gt;
&lt;P&gt;Hope that leads you in the right direction...&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 11:31:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-script-to-create-objects-from-intslider/m-p/7338715#M11632</guid>
      <dc:creator>kevin.picott</dc:creator>
      <dc:date>2017-08-30T11:31:48Z</dc:date>
    </item>
  </channel>
</rss>

