So I have this code where I try to find if two meshes intersect or not:
import maya.cmds as cmds import pymel.core as pmc mesh_list = pmc.ls(type="mesh") char_transform = pmc.listRelatives(mesh_list,parent=True) def vtxPose(mesh): return pmc.general.PyNode(mesh).getPoints() transform_list = iter(char_transform) next_one = next(transform_list) for one in transform_list: cmds.polyCBoolOp(one, next_one, op=3, n="intersection") vtx_list = vtxPose("intersection") if len(vtx_list) > 0: cmds.undo() print("intersection found") else: cmds.undo() print("no intersection found") Anyways, when I execute it Maya gives this error:
# Error: TypeError: file <maya console> line 14: Object pSphere1 is invalid # I can't find the problem(i'm not very experienced in coding especially in Maya:( ) I also thought about doing the same thing with OpenMaya's MFnMesh::allIntersections() but thought that learning how to use that one can be time consuming.
So, if you could tell me my code's problem that'd be cool;)
Thanks in advance
pip install maya, it installed successfully so i think that you are using that package.