def get_selected_bounding_box(remote): cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetBoundingBox() remote.runCommand(cmd) fMin = mmapi.floatArray(3) fMax = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetBoundingBox(key1, fMin, fMax) return ((fMin[0], fMin[1], fMin[2]), (fMax[0], fMax[1], fMax[2]))
def get_selected_bounding_box(remote): cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetBoundingBox() remote.runCommand(cmd) fMin = mmapi.floatArray(3) fMax = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetBoundingBox(key1, fMin, fMax) return ( (fMin[0],fMin[1],fMin[2]), (fMax[0],fMax[1],fMax[2]) )
def get_selected_bounding_box(remote): """return the axis-aligned bounding box of the selected objects as two 3-tuples (min, max)""" cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetBoundingBox() remote.runCommand(cmd) fMin = mmapi.floatArray(3) fMax = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetBoundingBox(key1, fMin, fMax) return ( (fMin[0],fMin[1],fMin[2]), (fMax[0],fMax[1],fMax[2]) )
def to_world_xyz(remote, x, y, z): """convert point from scene to world coords""" vScene = mmapi.floatArray(3) vScene[0] = x vScene[1] = y vScene[2] = z cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertPointToWorld(vScene) remote.runCommand(cmd2) vWorld = mmapi.floatArray(3) cmd2.GetQueryResult_ConvertPointToWorld(ckey, vWorld) return (vWorld[0], vWorld[1], vWorld[2])
def to_world_xyz(remote, x,y,z): """convert point from scene to world coords""" vScene = mmapi.floatArray(3) vScene[0] = x vScene[1] = y vScene[2] = z cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertPointToWorld(vScene) remote.runCommand(cmd2); vWorld = mmapi.floatArray(3) cmd2.GetQueryResult_ConvertPointToWorld(ckey, vWorld) return (vWorld[0],vWorld[1],vWorld[2])
def to_scene_xyz(remote, x,y,z): """convert a 3D point from World space to Scene space""" vWorld = mmapi.floatArray(3) vWorld[0] = x vWorld[1] = y vWorld[2] = z cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertPointToScene(vWorld) remote.runCommand(cmd2); vScene = mmapi.floatArray(3) cmd2.GetQueryResult_ConvertPointToScene(ckey, vScene) return (vScene[0],vScene[1],vScene[2])
def get_face_selection_bounding_box(remote): cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetSelectedFacesBoundingBox() remote.runCommand(cmd) fMin = mmapi.floatArray(3) fMax = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetSelectedFacesBoundingBox(key1, fMin, fMax) if bOK: return ( (fMin[0],fMin[1],fMin[2]), (fMax[0],fMax[1],fMax[2]) ) else: return ( (0,0,0), (0,0,0) )
def to_scene_xyz(remote, x, y, z): """convert a 3D point from World space to Scene space""" vWorld = mmapi.floatArray(3) vWorld[0] = x vWorld[1] = y vWorld[2] = z cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertPointToScene(vWorld) remote.runCommand(cmd2) vScene = mmapi.floatArray(3) cmd2.GetQueryResult_ConvertPointToScene(ckey, vScene) return (vScene[0], vScene[1], vScene[2])
def get_face_selection_bounding_box(remote): cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetSelectedFacesBoundingBox() remote.runCommand(cmd) fMin = mmapi.floatArray(3) fMax = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetSelectedFacesBoundingBox(key1, fMin, fMax) if bOK: return ((fMin[0], fMin[1], fMin[2]), (fMax[0], fMax[1], fMax[2])) else: return ((0, 0, 0), (0, 0, 0))
def get_face_selection_bounding_box(remote): """return the axis-aligned bounding box of the selected faces as two 3-tuples (min, max). Requires active face selection.""" cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetSelectedFacesBoundingBox() remote.runCommand(cmd) fMin = mmapi.floatArray(3) fMax = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetSelectedFacesBoundingBox(key1, fMin, fMax) if bOK: return ( (fMin[0],fMin[1],fMin[2]), (fMax[0],fMax[1],fMax[2]) ) else: return ( (0,0,0), (0,0,0) )
def to_scene_f(remote, f): """convert a scalar dimension from World space to Scene space""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToScene(f) remote.runCommand(cmd2) vScene = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToScene(ckey, vScene) return vScene[0]
def to_world_f(remote, f): """convert scalar from scene to world coords""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToWorld(f) remote.runCommand(cmd2); vWorld = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToWorld(ckey, vWorld) return vWorld[0]
def to_scene_f(remote, f): """convert scalar from world to scene coords""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToScene(f) remote.runCommand(cmd2) vScene = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToScene(ckey, vScene) return vScene[0]
def to_scene_f(remote, f): """convert a scalar dimension from World space to Scene space""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToScene(f) remote.runCommand(cmd2); vScene = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToScene(ckey, vScene) return vScene[0]
def to_world_f(remote, f): """convert scalar from scene to world coords""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToWorld(f) remote.runCommand(cmd2) vWorld = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToWorld(ckey, vWorld) return vWorld[0]
def to_world_f(remote, f): """convert a scalar dimension from Scene space to World space""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToWorld(f) remote.runCommand(cmd2) vWorld = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToWorld(ckey, vWorld) return vWorld[0]
def to_world_f(remote, f): """convert a scalar dimension from Scene space to World space""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToWorld(f) remote.runCommand(cmd2); vWorld = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToWorld(ckey, vWorld) return vWorld[0]
def to_scene_f(remote, f): """convert scalar from world to scene coords""" cmd2 = mmapi.StoredCommands() ckey = cmd2.AppendQueryCommand_ConvertScalarToScene(f) remote.runCommand(cmd2); vScene = mmapi.floatArray(1) cmd2.GetQueryResult_ConvertScalarToScene(ckey, vScene) return vScene[0]
def get_face_selection_centroid(remote): cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetSelectedFacesCentroid() remote.runCommand(cmd) vCentroid = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetSelectedFacesCentroid(key1, vCentroid) if bOK: return ( vCentroid[0], vCentroid[1], vCentroid[2] ) else: return ( 0,0,0 )
def get_face_selection_centroid(remote): cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetSelectedFacesCentroid() remote.runCommand(cmd) vCentroid = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetSelectedFacesCentroid(key1, vCentroid) if bOK: return (vCentroid[0], vCentroid[1], vCentroid[2]) else: return (0, 0, 0)
def get_face_selection_centroid(remote): """return the geometric centroid of the selected faces as a 3-tuple. Requires active face selection.""" cmd = mmapi.StoredCommands() key1 = cmd.AppendQueryCommand_GetSelectedFacesCentroid() remote.runCommand(cmd) vCentroid = mmapi.floatArray(3) bOK = cmd.GetQueryResult_GetSelectedFacesCentroid(key1, vCentroid) if bOK: return ( vCentroid[0], vCentroid[1], vCentroid[2] ) else: return ( 0,0,0 )