<?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 Re: Maya Python: Query for invalid mesh, get `maya.cmds.polyCheck` output in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13230249#M109</link>
    <description>&lt;P&gt;Hi Roy,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case, you can try to add&amp;nbsp;&lt;STRONG&gt;-log&amp;nbsp;&lt;/STRONG&gt;parameter when launching Maya. It'll write the outputs in the output window to a file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.,&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;maya -log d:\log.txt&lt;/LI-CODE&gt;
&lt;P&gt;Then you can monitor it with your own Python scripts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
    <pubDate>Thu, 26 Dec 2024 06:54:40 GMT</pubDate>
    <dc:creator>cheng_xi_li</dc:creator>
    <dc:date>2024-12-26T06:54:40Z</dc:date>
    <item>
      <title>Maya Python: Query for invalid mesh, get `maya.cmds.polyCheck` output</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13215748#M106</link>
      <description>&lt;P&gt;I had some scenes with an invalid mesh - that when exported using Alembic and reimported the mesh would have lost its UVs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An easy way to produce such a mesh is with this little code snippet. It's the `mergeVertices=False` (which is also the default for that argument) that makes this break:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import maya.cmds as cmds

# Create hexagon and position it
hexagon = cmds.polyCylinder(r=1, h=4, sx=5, sy=1, sz=1)[0]

# Select sharp edges with angle above 80 degrees
cmds.select(hexagon + ".e[*]")  # Select all edges first
cmds.polySelectConstraint(mode=3, type=0x8000, angle=True, anglebound=(80, 180))

# Bevel the selected edges
cmds.polyBevel(fraction=0.2, segments=3, offsetAsFraction=True, mergeVertices=False)

# Clear selection constraints
cmds.polySelectConstraint(disable=True)

# Clear history to avoid conflicts
cmds.delete(hexagon, ch=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Export and reimport the mesh - and voila, no UVs at all. You do get this nice little warning though:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;// Warning: |pCylinder2|pCylinderShape1 normal vector scope does not match size of data, skipping normals
// Warning: UV set sample size is: 230 expecting: 42 or 170&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now what I want to do - is actually &lt;STRONG&gt;detect&lt;/STRONG&gt; this issue before exporting on the meshes in the scene. I've found out that `maya.cmds.polyCheck` actually captures it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select the mesh and run:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from maya import cmds
result = cmds.polyCheck()
print(result)
# Result: 30&lt;/LI-CODE&gt;&lt;P&gt;It prints the amount of errors detected. The Maya Output Window however is more informative - it states:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;... DUPLICATE EDGE REFERENCE (0) IN SAME FACE : face 45, offset 172, local offset 2
... DUPLICATE EDGE REFERENCE (4) IN SAME FACE : face 45, offset 173, local offset 3
... DUPLICATE EDGE REFERENCE (7) IN SAME FACE : face 45, offset 175, local offset 5
... DUPLICATE EDGE REFERENCE (2) IN SAME FACE : face 46, offset 178, local offset 2
... DUPLICATE EDGE REFERENCE (6) IN SAME FACE : face 46, offset 179, local offset 3
... DUPLICATE EDGE REFERENCE (9) IN SAME FACE : face 46, offset 181, local offset 5
... DUPLICATE EDGE REFERENCE (18) IN SAME FACE : face 47, offset 184, local offset 2
... DUPLICATE EDGE REFERENCE (21) IN SAME FACE : face 47, offset 185, local offset 3
... DUPLICATE EDGE REFERENCE (23) IN SAME FACE : face 47, offset 187, local offset 5
... DUPLICATE EDGE REFERENCE (25) IN SAME FACE : face 48, offset 190, local offset 2
... DUPLICATE EDGE REFERENCE (28) IN SAME FACE : face 48, offset 191, local offset 3
... DUPLICATE EDGE REFERENCE (30) IN SAME FACE : face 48, offset 193, local offset 5
... DUPLICATE EDGE REFERENCE (16) IN SAME FACE : face 49, offset 196, local offset 2
... DUPLICATE EDGE REFERENCE (14) IN SAME FACE : face 49, offset 197, local offset 3
... DUPLICATE EDGE REFERENCE (11) IN SAME FACE : face 49, offset 199, local offset 5
... DUPLICATE EDGE REFERENCE (35) IN SAME FACE : face 50, offset 202, local offset 2
... DUPLICATE EDGE REFERENCE (39) IN SAME FACE : face 50, offset 203, local offset 3
... DUPLICATE EDGE REFERENCE (42) IN SAME FACE : face 50, offset 205, local offset 5
... DUPLICATE EDGE REFERENCE (51) IN SAME FACE : face 51, offset 208, local offset 2
... DUPLICATE EDGE REFERENCE (49) IN SAME FACE : face 51, offset 209, local offset 3
... DUPLICATE EDGE REFERENCE (46) IN SAME FACE : face 51, offset 211, local offset 5
... DUPLICATE EDGE REFERENCE (58) IN SAME FACE : face 52, offset 214, local offset 2
... DUPLICATE EDGE REFERENCE (56) IN SAME FACE : face 52, offset 215, local offset 3
... DUPLICATE EDGE REFERENCE (53) IN SAME FACE : face 52, offset 217, local offset 5
... DUPLICATE EDGE REFERENCE (65) IN SAME FACE : face 53, offset 220, local offset 2
... DUPLICATE EDGE REFERENCE (63) IN SAME FACE : face 53, offset 221, local offset 3
... DUPLICATE EDGE REFERENCE (60) IN SAME FACE : face 53, offset 223, local offset 5
... DUPLICATE EDGE REFERENCE (37) IN SAME FACE : face 54, offset 226, local offset 2
... DUPLICATE EDGE REFERENCE (41) IN SAME FACE : face 54, offset 227, local offset 3
... DUPLICATE EDGE REFERENCE (44) IN SAME FACE : face 54, offset 229, local offset 5

FOUND 30 ERRORS in poly object 000001603759E590&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now - what I really want is to be able to access the "invalid data" like what faces/edges are invalid, and why, from Python so I could report it to the user myself - and expose maybe a "select invalid" option for it too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I can't seem to find any way to actually query the reported errors in a meaningful way and access the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are my options to detect this issue, and maybe other issues too?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 11:34:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13215748#M106</guid>
      <dc:creator>BigRoy</dc:creator>
      <dc:date>2024-12-17T11:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Maya Python: Query for invalid mesh, get `maya.cmds.polyCheck` output</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13226648#M107</link>
      <description>&lt;P&gt;Hi BigRoy,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can try &lt;A href="https://help.autodesk.com/view/MAYADEV/2025/ENU/?guid=__CommandsPython_scriptEditorInfo_html" target="_blank" rel="noopener"&gt;scriptEditorInfo&lt;/A&gt; command to save these outputs into a file and check the file later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that wasn't working, you could try &lt;A href="https://help.autodesk.com/view/MAYADEV/2025/ENU/?guid=__CommandsPython_cmdFileOutput_html" target="_blank" rel="noopener"&gt;cmdFileOutput&lt;/A&gt; command instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 08:46:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13226648#M107</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2024-12-23T08:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Maya Python: Query for invalid mesh, get `maya.cmds.polyCheck` output</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13228540#M108</link>
      <description>&lt;P&gt;Thanks, &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2777035"&gt;@cheng_xi_li&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately both commands do not provide me with the intended result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, capturing `polyCheck` in a&amp;nbsp; `cmdFileOutput` does not capture the output window text from the poly check command. It does capture regular Script Editor output, like a `print` statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from maya import cmds

cmds.cmdFileOutput(o="E:/test.txt")
cmds.polyCheck()  # with the invalid mesh selected
print("TEST")
cmds.cmdFileOutput(close=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The same goses for the `scriptEditorInfo` command:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from maya import cmds

cmds.scriptEditorInfo(historyFilename='E:/test.txt', writeHistory=True)
cmds.polyCheck()
print("TEST")
cmds.scriptEditorInfo(writeHistory=False)&lt;/LI-CODE&gt;&lt;P&gt;None of the output window text is redirected nor written to the file.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 13:46:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13228540#M108</guid>
      <dc:creator>BigRoy</dc:creator>
      <dc:date>2024-12-24T13:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Maya Python: Query for invalid mesh, get `maya.cmds.polyCheck` output</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13230249#M109</link>
      <description>&lt;P&gt;Hi Roy,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case, you can try to add&amp;nbsp;&lt;STRONG&gt;-log&amp;nbsp;&lt;/STRONG&gt;parameter when launching Maya. It'll write the outputs in the output window to a file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.,&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;maya -log d:\log.txt&lt;/LI-CODE&gt;
&lt;P&gt;Then you can monitor it with your own Python scripts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2024 06:54:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/maya-python-query-for-invalid-mesh-get-maya-cmds-polycheck/m-p/13230249#M109</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2024-12-26T06:54:40Z</dc:date>
    </item>
  </channel>
</rss>

