<?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 Set boolean mode from expression? in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11281161#M2325</link>
    <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I'd like to override the boolean mode (ie: difference vs intersect) for a certain render layer, but can't see to find the right attribute to change from an expression.&lt;/P&gt;&lt;P&gt;polyBoolean1.booleanMode seems to be only 0 or 1 - not the mode I'm looking for.&lt;/P&gt;&lt;P&gt;polyBoolean1.inputPoly may get to what I need but can't find details on how to access.&lt;/P&gt;&lt;P&gt;I saw a post here referencing polyCBoolOp but I'm not sure what that is?&lt;/P&gt;&lt;P&gt;If I look in the attribute editor for a boolean output object - I can change the boolean operation there for one of the input meshes - just trying to find out how to do that via mel.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 06 Jul 2022 18:15:04 GMT</pubDate>
    <dc:creator>DavidHenion</dc:creator>
    <dc:date>2022-07-06T18:15:04Z</dc:date>
    <item>
      <title>Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11281161#M2325</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I'd like to override the boolean mode (ie: difference vs intersect) for a certain render layer, but can't see to find the right attribute to change from an expression.&lt;/P&gt;&lt;P&gt;polyBoolean1.booleanMode seems to be only 0 or 1 - not the mode I'm looking for.&lt;/P&gt;&lt;P&gt;polyBoolean1.inputPoly may get to what I need but can't find details on how to access.&lt;/P&gt;&lt;P&gt;I saw a post here referencing polyCBoolOp but I'm not sure what that is?&lt;/P&gt;&lt;P&gt;If I look in the attribute editor for a boolean output object - I can change the boolean operation there for one of the input meshes - just trying to find out how to do that via mel.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Jul 2022 18:15:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11281161#M2325</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-06T18:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11281798#M2326</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you are looking for is the "operation" attribute on the "polyCBoolOp" object that is responsible for creating the boolean. You can find this object by going over the connection of the "outMesh" on one of the shapeNodes used to create the boolean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of how to set all booleans connected to selected object to intersection:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;proc changeBoolType(){
  string $sel[] = `ls -sl`;

  for ($s in $sel){
      string $rel[] = `listRelatives -ad -type "mesh" $s`;
      for ($r in $rel){
          
          string $bools[] = `listConnections -t "polyCBoolOp" -s 1 ($r + ".outMesh") `;
          if (size($bools) &amp;gt; 0){
              setAttr ($bools[0] + ".operation") 3;
          }
      }
      
  }  
}


changeBoolType()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ofcourse there are also other ways to find the "polyCBoolOp" object, if you are creating the boolean via code you can store the output of the "polyBoolOp" command in a string Array and the item with index 1 should be your "polyCBoolOp" node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 00:50:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11281798#M2326</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-07-07T00:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283585#M2327</link>
      <description>&lt;P&gt;Thank you - I think this is what I'm looking for, however I can't get the listConnections command to find the BoolOp node, testing here with a torus and cube:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;listConnections pCubeShape1;&lt;BR /&gt;// Result: polyBoolean1 initialShadingGroup groupId3 initialShadingGroup groupParts2 polyBoolean1 initialShadingGroup groupId4&lt;BR /&gt;listConnections pCubeShape1.outMesh;&lt;BR /&gt;// Result: polyBoolean1&lt;BR /&gt;listConnections -s 1 pCubeShape1.outMesh;&lt;BR /&gt;// Result: polyBoolean1&lt;BR /&gt;listConnections -t "polyCBoolOp" -s 1 pCubeShape1.outMesh;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283585#M2327</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-07T16:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283655#M2328</link>
      <description>&lt;P&gt;What is the result if you run the following line in the same Scene?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;objectType("polyBoolean1")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:43:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283655#M2328</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-07-07T16:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283661#M2329</link>
      <description>&lt;P&gt;Have been poking at the polyBoolean1 node - seems to do the trick, but I'm kinda guessing at what I'm setting:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;getAttr polyBoolean1.operation;&lt;BR /&gt;// Result: 2 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # currently in difference mode&lt;BR /&gt;setAttr polyBoolean1.operation -type Int32Array 2 2 0 0;&lt;BR /&gt;// Error: Cannot perform boolean operation.&lt;BR /&gt;setAttr polyBoolean1.operation -type Int32Array 2 2 1 1;&amp;nbsp;&amp;nbsp;&amp;nbsp; # sets to union&lt;BR /&gt;setAttr polyBoolean1.operation -type Int32Array 2 2 3 3;&amp;nbsp;&amp;nbsp; # sets to interect&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't know why getAttr returns 2 values but setting it requires 4, and the operation value for the polyBoolOp command is a single value.....&amp;nbsp;&amp;nbsp;&amp;nbsp; The first value seems to be the number of objects (set first value to 1 and it expects 3 total args, setting first value to 2 it expects 4 total args, etc.) but not sure really what I'm setting &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can't find docs on this - any links?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:44:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283661#M2329</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-07T16:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283663#M2330</link>
      <description>&lt;P&gt;objectType("polyBoolean1");&lt;BR /&gt;// Result: polyBoolean&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:45:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283663#M2330</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-07T16:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283667#M2331</link>
      <description>&lt;P&gt;Hmm, are you using maya 2023? Because MEL in 2022.3 doesn't even seem to know the objectType "polyBoolean"&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:49:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283667#M2331</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-07-07T16:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283673#M2332</link>
      <description>&lt;P&gt;Yes, 2023.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The bigger problem I'm having is when one of the input meshes is animated, maya either constantly recalculates it driving up high cpu, or spits out non-stop can't perfrom bool op messages - when just sitting there with the bool fine and dandy on screen, not playing or scrubbing the timeline.&amp;nbsp; I switched to 2023 hoping that was fixed, but alas no.&amp;nbsp; Sometimes when I open a scene with an animated boolean its fine for a bit, but soon starts acting up.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:53:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283673#M2332</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-07T16:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283675#M2333</link>
      <description>PS: Its not too late in the project to switch back to 2022 if that would be better - the animated bool recalculating issue may be worse though.</description>
      <pubDate>Thu, 07 Jul 2022 16:55:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283675#M2333</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-07T16:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283706#M2334</link>
      <description>&lt;P&gt;If you work a lot with booleans, I think Maya 2023 will give you better results from looking at the way they handle in the new version. Sadly I can't really try out code for you or analyse the node network myself, since I'm currently obligated by my employer to stick with 2022.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The performance issue sounds like a problem, but There seems to be a discussion going on about that in the Modelling forum so I thinks the Devs should be aware of that problem.&lt;BR /&gt;&lt;BR /&gt;As to how you set your attributes. Looking at the differences in how booleans work from 2022 to 2023, I'm assuming, that the difference in amounts of values you need to set stems from the fact that some operations like difference allow you to dynamically change operation order between the objects which doesn't matter for other operations like combine or intersect where the result is always the same. Also I could imagine that some of the new numbers that need to be set refere to the shading mode and smoothmesh settings that the new boolen node brings with it.&lt;BR /&gt;&lt;BR /&gt;But that is just pure speculation, sadly I can't really help you any further with this since I don't know how the node functions in your Maya version&lt;BR /&gt;Out of curiosity, could you make a screenshot of the polyBoolean Node with all the Attributes extended in the Node Editor?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 17:15:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283706#M2334</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-07-07T17:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set boolean mode from expression?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283770#M2335</link>
      <description>&lt;P&gt;Thank you very much for your help - this definitely saved me a ton of time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Screenshot attached of the polyBoolean node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 17:56:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-boolean-mode-from-expression/m-p/11283770#M2335</guid>
      <dc:creator>DavidHenion</dc:creator>
      <dc:date>2022-07-07T17:56:51Z</dc:date>
    </item>
  </channel>
</rss>

