[
  {
    "path": "AjustaTomo.py",
    "content": "import bpy\nimport os\nimport os.path\nimport json\nimport re\nimport shutil\n# from datetime import datetime\nimport tempfile\nimport os\nimport platform\nimport subprocess\nimport pydicom as dicom\nimport csv\nimport fnmatch\nfrom os.path import expanduser\n\nfrom .GeraModelosTomo import *\n\nif platform.system() == \"Darwin\" or platform.system() == \"Linux\":\n    import pyexifinfo as p\n\ndef AjustaTomoDef(self, context):\n\n\n    scn = context.scene\n\n\n    #Cria diretorios temporarios e copia o conteudo para um deles\n    #os.chdir('DEL')\n\n#    scene = context.scene\n#    rd = scene.render\n\n    if scn.my_tool.path == \"\":\n        bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n        return {'FINISHED'}\n\n    else:\n\n        tmpdirCopy = tempfile.mkdtemp()\n\n        tmpdirTomo = tempfile.mkdtemp()\n\n        shutil.copytree(scn.my_tool.path, tmpdirCopy+'COPY')\n\n        # Lista os arquivos e salva arquivo de texto\n\n        # Testa se existe e remove\n        if os.path.exists('ListaArquivos.txt'):\n            os.remove('ListaArquivos.txt')\n\n\n        #for dirname, dirnames, filenames in os.walk('.'):\n        for dirname, dirnames, filenames in os.walk(tmpdirCopy+'COPY'):\n            # print path to all subdirectories first.\n        #    for subdirname in dirnames:\n        #        print(os.path.join(dirname, subdirname))\n\n            for filename in filenames:\n                #print(os.path.join(dirname, filename))\n                ArquivosListados = os.path.join(dirname, filename)+'\\n'\n\n                with open(\"ListaArquivos.txt\", \"a\") as arq:\n                    arq.write(ArquivosListados)\n                    arq.close()\n\n\n        # Conta linhas do arquivo\n\n        def obter_n_linhas (nomeDoArquivo):\n            arquivo = open(nomeDoArquivo, \"r\")\n            n_linhas = sum(1 for linha in arquivo)\n            arquivo.close()\n            return n_linhas\n\n\n        def InstanceNumber(Arquivo):\n\n\n            try:\n                ds = dicom.dcmread(Arquivo, force=True) # Diretório e arquivo concatenados\n                #ds = dicom.dcmread(Arquivo, force=True) # Diretório e arquivo concatenados\n\n\n                instance_number = ds.data_element(\"InstanceNumber\")\n                instanceLimpa1 = str(instance_number).split('IS: ')\n                instanceLimpa2 = str(instanceLimpa1[1]).strip('\"')\n\n\n            except:\n                print(\"Não rolou leitura do DICOM!\")\n                instanceLimpa2 = \"Error\"\n\n            return instanceLimpa2\n\n        NumeroLinhas = obter_n_linhas ('ListaArquivos.txt')\n\n        #-----------------------------------------------------------\n\n        # Le arquivo e cria pastas\n\n        #ContadorLinhas = 0\n\n        with open('ListaArquivos.txt','r') as f:\n                ListaArquivos=f.readlines()\n                print(\"Criado Lista Arquivo1\")\n\n        DCMNum = 0\n\n        for x in range(NumeroLinhas):\n            ArquivoAtual = ListaArquivos[x].strip('\\n') # mostra linha 1 sem o caractere de quebra de linha\n        #\tprint(ArquivoAtual)\n\n            DCMInstanceNumber = InstanceNumber(ArquivoAtual)\n            os.chdir(tmpdirTomo)\n\n            shutil.copy(ArquivoAtual, \"Copy-\"+DCMInstanceNumber.zfill(5)+\"-\"+str(DCMNum))\n            print(\"Copiado de: \", ArquivoAtual, \" Para: \", \"Copy-\"+DCMInstanceNumber+\"-\"+str(DCMNum))\n    #        shutil.copy(ArquivoAtual, str(datetime.now()).replace(\":\",\"\").replace(\".\",\"\").replace(\" \",\"\").replace(\"-\",\"\"))\n    #        print(\"Copiado de: \", ArquivoAtual, \" Para: \", str(datetime.now()).replace(\":\",\"\").replace(\".\",\"\").replace(\" \",\"\").replace(\"-\",\"\"))\n        #\tos.chdir('..')\n            DCMNum += 1\n\n        # Lista os arquivos e salva arquivo de texto\n\n        # Testa se existe e remove\n        if os.path.exists('ListaArquivos.txt'):\n            os.remove('ListaArquivos.txt')\n            print(\"Apagado ListaArquivo\")\n\n\n\n        #for dirname, dirnames, filenames in os.walk('.'):\n        for dirname, dirnames, filenames in os.walk(tmpdirTomo):\n            # print path to all subdirectories first.\n        #    for subdirname in dirnames:\n        #        print(os.path.join(dirname, subdirname))\n\n            for filename in filenames:\n                #print(os.path.join(dirname, filename))\n                ArquivosListados = os.path.join(dirname, filename)+'\\n'\n\n                with open('ListaArquivos.txt', \"a\") as arq:\n                    print(\"Criado ListaArquivo 2\")\n                    arq.write(ArquivosListados)\n                    arq.close()\n\n\n        # Conta linhas do arquivo\n\n        def obter_n_linhas (nomeDoArquivo):\n            arquivo = open(nomeDoArquivo, \"r\")\n            n_linhas = sum(1 for linha in arquivo)\n            arquivo.close()\n            return n_linhas\n\n\n        NumeroLinhas = obter_n_linhas ('ListaArquivos.txt')\n\n\n        # Le arquivo e cria pastas\n\n        #ContadorLinhas = 0\n\n        with open('ListaArquivos.txt','r') as f:\n                ListaArquivos=f.readlines()\n\n    # PYEXIFINFO\n\n        if platform.system() == \"Darwin\" or platform.system() == \"Linux\":\n            print(\"EH MAC E LIN\")\n            for x in range(NumeroLinhas):\n                ArquivoAtual = ListaArquivos[x].strip('\\n') # mostra linha 1 sem o caractere de quebra de linha\n        #\tprint(ArquivoAtual)\n\n                data = p.get_json(ArquivoAtual)\n\n                data2 = json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))\n\n                with open(\"deletar.txt\", \"a\") as arq:\n                    arq.write(data2)\n                    arq.close()\n\n                    palavra = \"SeriesNumber\"\n\n                    for line in open(\"deletar.txt\"):\n                        if palavra in line:\n                            SeriesRaw = line\n                            SeriesLimpa1 = SeriesRaw.strip('\"DICOM:SeriesNumber\": \"')\n                            SeriesLimpa2 = SeriesLimpa1.strip('\",'+'\\n')\n                            SeriesLimpo = SeriesLimpa2.strip(\" \")\n                            print(\"SERIES\", SeriesLimpo)\n\n                            if SeriesLimpo != '':\n                                if not os.path.exists(SeriesLimpo):\n                                    os.mkdir(SeriesLimpo)\n\n                            if SeriesLimpo != '':\n                                shutil.copy(ArquivoAtual, SeriesLimpo)\n                                print(\"Copiado de: \", ArquivoAtual, \" Para: \", SeriesLimpo)\n                                os.remove(ArquivoAtual)\n\n\n                    os.remove('deletar.txt')\n\n    # PYTHON DICOM\n\n        if platform.system() == \"Windows\":\n            print(\"EH WIN\")\n            for x in range(NumeroLinhas):\n                ArquivoAtual = ListaArquivos[x].strip('\\n') # mostra linha 1 sem o caractere de quebra de linha\n                print(\"AQUIVO ATUAL: \"+ArquivoAtual)\n\n                try:\n                    ds = dicom.dcmread(ArquivoAtual)\n\n                    series_number = ds.data_element(\"SeriesNumber\")\n\n                    SeriesLimpa1 = str(series_number).strip('(0020, 0011) Series Number IS:')\n                    SeriesLimpo2 = SeriesLimpa1.strip('\"')\n                    SeriesLimpo = SeriesLimpo2.strip(\" \")\n\n                except:\n                    print(\"Não rolou leitura do DICOM!\")\n                    SeriesLimpo = \"Error\"\n\n\n                if not os.path.exists(SeriesLimpo):\n                    os.mkdir(SeriesLimpo)\n                    print(\"Diretorio \"+SeriesLimpo+\" criado\")\n\n                #os.chdir(tmpdirTomo)\n                shutil.copy(ArquivoAtual, SeriesLimpo)\n                print(\"Copiado de: \", ArquivoAtual, \" Para: \", SeriesLimpo)\n                os.remove(ArquivoAtual)\n\n\n\n            #os.remove('deletar.txt')\n    #        os.remove('deletar.txt')\n        try:\n            shutil.rmtree(tmpdirCopy+'COPY')\n            shutil.rmtree(tmpdirCopy)\n        except:\n            print(\"Erro de permissão ao apagar os diretório do TMP!\")\n\n        print(\"CT-SCAN ready!\")\n\n# Lista diretórios e arquivos\n        try:\n            tmpdirCSV = tempfile.mkdtemp()\n\n            diretorio = tmpdirTomo+\"/\"\n\n            lista_compara = []\n\n            lista = [ name for name in os.listdir(diretorio) if os.path.isdir(os.path.join(diretorio, name)) ]\n\n            #print(lista)\n            try:\n                for i in lista:\n                #    print(\"\\n\")\n                #    print(\"Directory:\", i)\n                #    print(os.listdir(diretorio+i)[0])\n                #    print(\"Number of files:\", len(os.listdir(diretorio+i)))\n                    ArquivoAtual = os.listdir(diretorio+i)[0]\n                #    print(diretorio+i+\"/\"+ArquivoAtual)\n                    ds = dicom.dcmread(diretorio+i+\"/\"+ArquivoAtual, force=True)\n\n                    if ds.data_element(\"SeriesDescription\"):\n                        SeriesDescription = ds.data_element(\"SeriesDescription\")\n                        SeriesDescriptionLimpa1 = str(SeriesDescription).split('LO: ')\n                        SeriesDescriptionLimpa2 = str(SeriesDescriptionLimpa1[1]).strip('\"')\n                    #    print(SeriesDescriptionLimpa2)\n                    #    print(\"Directory:\", i, \"|| Number of files:\", len(os.listdir(diretorio+i)), \"||\", SeriesDescriptionLimpa2, \"\\n\")\n                        lista_compara.append([len(os.listdir(diretorio+i)), i, SeriesDescriptionLimpa2])\n                        lista_compara.sort(reverse = True)\n                        #print(\"LISTA COMPARA!!!\")\n                        #print(lista_compara)\n                    if not ds.data_element(\"SeriesDescription\"):\n                        SeriesDescriptionLimpa2 = (\"Erro O!\")\n                    #    print(SeriesDescriptionLimpa2)\n                    #    print(\"Directory:\", i, \"|| Number of files:\", len(os.listdir(diretorio+i)), \"||\", SeriesDescriptionLimpa2, \"\\n\")\n                        lista_compara.append([len(os.listdir(diretorio+i)), i, SeriesDescriptionLimpa2])\n                        lista_compara.sort(reverse = True)\n            except:\n                print(\"Erro no SeriesDescription\")\n                try:\n                    SeriesDescriptionLimpa2 = (\"Erro 1!\")\n                #    print(SeriesDescriptionLimpa2)\n                #    print(\"Directory:\", i, \"|| Number of files:\", len(os.listdir(diretorio+i)), \"||\", SeriesDescriptionLimpa2, \"\\n\")\n                    lista_compara.append([len(os.listdir(diretorio+i)), i, SeriesDescriptionLimpa2])\n                    lista_compara.sort(reverse = True)\n                except:\n                    print(\"Problema ao inserir o SeriesDescription!\")\n\n\n            lista_diretorios_mole = []\n            print(\"LISTA COMPARA MOLE\", lista_compara)\n\n            try:\n\n                print(\"lista compara:\",lista_compara)\n                for i in lista_compara:\n                    print(\"Comecou a comparar!\")\n                    print(\"i Atual:\", i)\n                    if fnmatch.fnmatchcase(str(i[2]), \"*PM*\") or fnmatch.fnmatchcase(str(i[2]), \"*P/M*\") or fnmatch.fnmatchcase(str(i[2]), \"*Soft*\") or fnmatch.fnmatchcase(str(i[2]), \"*Sft Tissue*\") or fnmatch.fnmatchcase(str(i[2]), \"*STD*\") or fnmatch.fnmatchcase(str(i[2]), \"*PARTES MOLES*\") or fnmatch.fnmatchcase(str(i[2]), \"*Head*\") or fnmatch.fnmatchcase(str(i[2]), \"*SEM CONTRASTE*\") or fnmatch.fnmatchcase(str(i[2]), \"*FACE*\") or fnmatch.fnmatchcase(str(i[2]), \"*Recon 3*\") or fnmatch.fnmatchcase(str(i[2]), \"*ARQUIVO*\") or fnmatch.fnmatchcase(str(i[2]), \"*RECON*\") or fnmatch.fnmatchcase(str(i[2]), \"*Cranio*\") or fnmatch.fnmatchcase(str(i[2]), \"*VOLUME STD*\")  or fnmatch.fnmatchcase(str(i[2]), \"*VOL*\") or fnmatch.fnmatchcase(str(i[2]), \"*Imagens Processadas*\"):\n                            print(\"Encontrou!\")\n                            lista_diretorios_mole.append(i[1])\n                    else:\n                        print(\"Não encontrou!\")\n\n                    global diretorio_final_reconstruir_mole\n\n                    try:\n                        print(\"Diretorio final:\", lista_diretorios_mole[0] )\n                        print(\"Comparou!\")\n\n                        diretorio_final_reconstruir_mole = lista_diretorios_mole[0]\n\n                    except:\n                        print(\"Diretorio final:\", lista_diretorios_mole ) # Não sei pq!!! Se coloco index dá erro!\n                        print(\"Comparou!\")\n\n                        diretorio_final_reconstruir_mole = lista_diretorios_mole\n\n            except:\n                print(\"Problema para encontrar diretório com tecido mole na tomo!\")\n\n\n\n            with open(tmpdirCSV+'/C-Scan_DATA.csv', mode='w') as centroid_file:\n                report_writer = csv.writer(centroid_file, delimiter=',', quotechar='\"', quoting=csv.QUOTE_MINIMAL)\n                report_writer.writerow(['DIRECTORY', 'NUMBER OF FILES', 'DESCRIPTION'])\n\n\n                if lista_compara == []:\n                    report_writer.writerow([\"No data\", \"No data\", \"No data\"])\n\n                if lista_compara != []:\n                    for linha in lista_compara:\n                        report_writer.writerow([linha[1],linha[0],linha[2]])\n                        print(\"Directory:\", linha[1], \"|| Number of files\", linha[0], \"|| Description:\", linha[2])\n\n\n            try:\n                if platform.system() == \"Linux\":\n                #    abrir_diretorio(tmpdir)\n                    subprocess.Popen(\"libreoffice \"+tmpdirCSV+\"/C-Scan_DATA.csv\", shell=True)\n\n                if platform.system() == \"Windows\":\n                #    abrir_diretorio(tmpdir)\n                    subprocess.Popen('cd \"C:/Program Files/LibreOffice/program/\" & dir & soffice.bin '+tmpdirCSV+\"/C-Scan_DATA.csv\", shell=True)\n\n                if platform.system() == \"Darwin\":\n                #    abrir_diretorio(tmpdir)\n                    subprocess.Popen('/Applications/LibreOffice.app/Contents/MacOS/soffice '+tmpdirCSV+\"/C-Scan_DATA.csv\", shell=True)\n            except:\n                print(\"Não há programa atribuído ao CSV!\")\n        except:\n            print(\"Algum problema aconteceu com a leitura dos dados do tomógrafo.\")\n\n\n            try:\n\n                with open(tmpdirCSV+'/C-Scan_DATA.csv', mode='w') as centroid_file:\n                    report_writer = csv.writer(centroid_file, delimiter=',', quotechar='\"', quoting=csv.QUOTE_MINIMAL)\n                    report_writer.writerow(['DIRECTORY', 'NUMBER OF FILES', 'DESCRIPTION'])\n\n                    if lista_compara == []:\n                        report_writer.writerow([\"No data\", \"No data\", \"No data\"])\n\n                    if lista_compara != []:\n                        for linha in lista_compara:\n                            report_writer.writerow([linha[1],linha[0],linha[2]])\n                            print(\"Directory:\", linha[1], \"|| Number of files\", linha[0], \"|| Description:\", linha[2])\n\n                try:\n                    if platform.system() == \"Linux\":\n                    #    abrir_diretorio(tmpdir)\n                        subprocess.Popen(\"libreoffice \"+tmpdirCSV+\"/C-Scan_DATA.csv\", shell=True)\n\n                    if platform.system() == \"Windows\":\n                    #    abrir_diretorio(tmpdir)\n                        subprocess.Popen('cd \"C:/Program Files/LibreOffice/program/\" & dir & soffice.bin '+tmpdirCSV+\"/C-Scan_DATA.csv\", shell=True)\n\n                    if platform.system() == \"Darwin\":\n                    #    abrir_diretorio(tmpdir)\n                        subprocess.Popen('/Applications/LibreOffice.app/Contents/MacOS/soffice '+tmpdirCSV+\"/C-Scan_DATA.csv\", shell=True)\n                except:\n                    print(\"Não há programa atribuído ao CSV!\")\n            except:\n                print(\"Problemas com o CSV!\")\n\n# Atualiza path\n\n#        abrir_diretorio(tmpdirTomo)\n\n        scn.my_tool.path = tmpdirTomo+\"/\"\n\n\n        try:\n            with open(tmpdirTomo+'/AUTOEXPDIR.txt', \"a\") as arq:\n                if diretorio_final_reconstruir_mole:\n                    arq.write(tmpdirTomo+\"/\"+diretorio_final_reconstruir_mole)\n                if not diretorio_final_reconstruir_mole:\n                    arq.write(tmpdirTomo+\"/\")\n                arq.close()\n\n        except:\n            print(\"Algum problema com a variável global do tecido mole!\")\n\n\nclass AjustaTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ajusta_tomo\"\n    bl_label = \"Ajusta Tomo\"\n\n\n    def execute(self, context):\n        AjustaTomoDef(self, context)\n        return {'FINISHED'}\n\n# ---------------------------------------\n\ndef abrir_diretorio(path):\n    if platform.system() == \"Windows\":\n        os.startfile(path)\n    elif platform.system() == \"Darwin\":\n        subprocess.Popen([\"open\", path])\n    else:\n        subprocess.Popen([\"xdg-open\", path])\n\ndef AbreTMPDef(self, context):\n\n    scn = context.scene\n\n    tmpdir = tempfile.gettempdir()\n    abrir_diretorio(tmpdir)\n\ndef CorrigeDicomDef(self, context):\n\n    scn = context.scene\n\n    homeall = expanduser(\"~\")\n\n    if scn.my_tool.path == \"\":\n        bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n        return {'FINISHED'}\n\n    else:\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        tmpdirFIXED = tempfile.mkdtemp()\n\n        # Cria arquivo com o nome do diretorio FIXED para ser acessado\n\n        DirTemporario = tempfile.gettempdir()\n\n        if os.path.isfile(DirTemporario+\"/tmpdirFIXED.txt\"):\n            print(\"Apagando tmpdirFIXED.txt!\")\n            os.remove(DirTemporario+\"/tmpdirFIXED.txt\")\n\n        if not os.path.isfile(DirTemporario+\"/tmpdirFIXED.txt\"):\n            with open(DirTemporario+\"/tmpdirFIXED.txt\", 'w') as arquivo:\n                arquivo.write(str(tmpdirFIXED))\n\n\n        print(\"DIRETÓRIO CORREÇÂO:\", tmpdirFIXED)\n\n        os.chdir(scn.my_tool.path)\n        dirDICOM = scn.my_tool.path\n        #os.makedirs(\"FIXED\")\n        if platform.system() == \"Linux\":\n            os.system(\"dicomtodicom -o \"+tmpdirFIXED+\" *\")\n    #        os.system(\"for i in *; do gdcmconv -X $i FIXED/$i; done\")\n    #        print(\"TOMO AJUSTADA PELO GDCM\")\n\n        if platform.system() == \"Darwin\":\n            os.system(homeall+\"/Programs/OrtogOnBlender/vtk-dicom/./dicomtodicom --verbose -o \"+tmpdirFIXED+\" *\")\n        print(\"DICOM FIXED\")\n\n\n        if platform.system() == \"Windows\":\n\n\n            os.chdir(scn.my_tool.path)\n            os.system(\"C:\\\\OrtogOnBlender\\\\dicomtools\\\\dicomtodicom --verbose -o \"+tmpdirFIXED+\" *\")\n\n            print(\"C:\\\\OrtogOnBlender\\\\dicomtools\\\\dicomtodicom --verbose -o \"+tmpdirFIXED+\" *\")\n\n            a = os.path.isfile(tmpdirFIXED+\"\\\\\"+\"IM-0001-0001.dcm\")\n            print(\"teste\", a)\n            print(\"Diretorio FIXED: \", tmpdirFIXED+\"\\\\\"+\"IM-0001-0001.dcm\")\n\n            #print(\"DICOM FIXED\")\n            if os.path.isfile(tmpdirFIXED+\"\\\\\"+\"IM-0001-0001.dcm\"):\n                print(\"EXISTE O ARQUIVO EM FIXED!\")\n                scn.my_tool.path = tmpdirFIXED\n\n                return tmpdirFIXED\n\n            if not os.path.isfile(tmpdirFIXED+\"\\\\\"+\"IM-0001-0001.dcm\"):\n                tmpdirFIXED2 = tempfile.mkdtemp()\n                print(\"TENTA WSL FIXED!!!\")\n                tmpdirFIXEDAtual = str(tmpdirFIXED2).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n                #dirDICOMAtual = str(dirDICOM).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n                os.chdir(dirDICOM)\n                #print(\"wsl \\\"dicomtodicom\\\" -o \\\"\"+tmpdirFIXEDAtual+\"\\\" \\\"\"+dirDICOMAtual+\"\\\"\")\n                #print(\"wsl \\\"dicomtodicom\\\" -o \\\"\"+tmpdirFIXEDAtual+\"\\\" *\")\n\n                #subprocess.call(\"wsl \\\"dicomtodicom\\\" -o \\\"\"+tmpdirFIXEDAtual+\"\\\" \\\"\"+dirDICOMAtual+\"\\\"\", shell=True)\n                subprocess.call(\"wsl \\\"dicomtodicom\\\" -o \\\"\"+tmpdirFIXEDAtual+\"\\\" *\", shell=True)\n\n                scn.my_tool.path = tmpdirFIXED2\n\n\nclass CorrigeDicom(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.corrige_dicom\"\n    bl_label = \"Corrige DICOM\"\n\n    def execute(self, context):\n        CorrigeDicomDef(self, context)\n        return {'FINISHED'}\n"
  },
  {
    "path": "AlinhaObjetos.py",
    "content": "import bpy\nimport math\n\nfrom .FerrMalhas import *\n\n# MENSAGENS\n\nclass MessageSelecioneObjAlinhar(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_selecione_alinhar\"\n    bl_label = \"Please, select the object to be aligned!\"\n\n    def execute(self, context):\n        message = (\"Please, select an object before!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageSelecioneObjAlinhar)\n\n\nclass MessageFaltaPontoObj(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_falta_ponto_obj\"\n    bl_label = \"Doesn't have one or more points or object!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have one or more points or object!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageFaltaPontoObj)\n\n\nclass MessageFaltaPonto(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_falta_ponto\"\n    bl_label = \"Doesn't have one or more point!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have one or more points!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageFaltaPonto)\n\n# Origin\n\ndef EMP1aDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES')\n    bpy.context.object.name = \"EMP1a\"\n    #bpy.context.object.empty_draw_size = 3\n    bpy.context.object.empty_display_size = 3\n\n\nclass EMP1a(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.emp1a\"\n    bl_label = \"EMP1a\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'EMP1a' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        context = bpy.context\n        obj = context.object\n\n        if bpy.context.selected_objects == []:\n            bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n            return {'FINISHED'}\n        else:\n            EMP1aDef(self, context)\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n        return {'FINISHED'}\n\ndef EMP2aDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES')\n    bpy.context.object.name = \"EMP2a\"\n    #bpy.context.object.empty_draw_size = 3\n    bpy.context.object.empty_display_size = 3\n\n\nclass EMP2a(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.emp2a\"\n    bl_label = \"EMP2a\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'EMP2a' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        context = bpy.context\n        obj = context.object\n\n        if bpy.context.selected_objects == []:\n            bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n            return {'FINISHED'}\n        else:\n            EMP2aDef(self, context)\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n        return {'FINISHED'}\n\ndef EMP3aDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES')\n    bpy.context.object.name = \"EMP3a\"\n    #bpy.context.object.empty_draw_size = 3\n    bpy.context.object.empty_display_size = 3\n\n\nclass EMP3a(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.emp3a\"\n    bl_label = \"EMP3a\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'EMP3a' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        context = bpy.context\n        obj = context.object\n\n        if bpy.context.selected_objects == []:\n            bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n            return {'FINISHED'}\n        else:\n            EMP3aDef(self, context)\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n        return {'FINISHED'}\n\n # Align\n\ndef EMP1bDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES')\n    bpy.context.object.name = \"EMP1b\"\n    #bpy.context.object.empty_draw_size = 3\n    bpy.context.object.empty_display_size = 3\n\n\nclass EMP1b(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.emp1b\"\n    bl_label = \"EMP1b\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'EMP1b' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        context = bpy.context\n        obj = context.object\n\n        if bpy.context.selected_objects == []:\n            bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n            return {'FINISHED'}\n        else:\n            EMP1bDef(self, context)\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n        return {'FINISHED'}\n\ndef EMP2bDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES')\n    bpy.context.object.name = \"EMP2b\"\n    #bpy.context.object.empty_draw_size = 3\n    bpy.context.object.empty_display_size = 3\n\n\nclass EMP2b(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.emp2b\"\n    bl_label = \"EMP2b\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'EMP2b' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        context = bpy.context\n        obj = context.object\n\n        if bpy.context.selected_objects == []:\n            bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n            return {'FINISHED'}\n        else:\n            EMP2bDef(self, context)\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n        return {'FINISHED'}\n\n\ndef EMP3bDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES')\n    bpy.context.object.name = \"EMP3b\"\n    #bpy.context.object.empty_draw_size = 3\n    bpy.context.object.empty_display_size = 3\n\n\nclass EMP3b(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.emp3b\"\n    bl_label = \"EMP3b\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'EMP3b' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        context = bpy.context\n        obj = context.object\n\n        if bpy.context.selected_objects == []:\n            bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n            return {'FINISHED'}\n        else:\n            EMP3bDef(self, context)\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n        return {'FINISHED'}\n\ndef AlinhaTresPontosDef(self, context):\n\n    context = bpy.context\n    objAlinhar = context.active_object\n\n#    if bpy.context.selected_objects == []:\n#        bpy.ops.object.dialog_operator_selecione_alinhar('INVOKE_DEFAULT')\n#        return {'FINISHED'}\n\n    if bpy.data.objects.get('EMP1a') and bpy.data.objects.get('EMP2a') and bpy.data.objects.get('EMP3a') and bpy.data.objects.get('EMP1b') and bpy.data.objects.get('EMP2b') and bpy.data.objects.get('EMP3b'):\n\n        # Adiciona plano Origem\n        bpy.ops.mesh.add_mesh_alinha_origi()\n        bpy.context.object.name = \"MeshAlignOrigi\" # Força nome para não dar erro\n\n        # Seleciona pontos\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n        obj = bpy.context.active_object\n        bpy.ops.object.mode_set(mode = 'EDIT')\n        bpy.ops.mesh.select_mode(type=\"VERT\")\n        bpy.ops.mesh.select_all(action = 'DESELECT')\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n        obj.data.vertices[0].select = True\n        obj.data.vertices[1].select = True\n        obj.data.vertices[2].select = True\n        bpy.ops.object.mode_set(mode = 'EDIT')\n\n        # Seleciona os pontos de rotação\n        bpy.ops.maplus.quickalignplanesgrabdest()\n\n        # Sai do modo de edição\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        # Adiciona plano a Alinhar\n        bpy.ops.mesh.add_mesh_alinha_alinha()\n        bpy.context.object.name = \"MeshAlignAlign\" # Força nome para não dar erro\n\n        objMalhaAlinha = context.active_object\n\n        # Seleciona os pontos\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n        obj = bpy.context.active_object\n        bpy.ops.object.mode_set(mode = 'EDIT')\n        bpy.ops.mesh.select_mode(type=\"VERT\")\n        bpy.ops.mesh.select_all(action = 'DESELECT')\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n        obj.data.vertices[0].select = True\n        obj.data.vertices[1].select = True\n        obj.data.vertices[2].select = True\n        bpy.ops.object.mode_set(mode = 'EDIT')\n\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        # Sai do modo de edição\n        bpy.ops.object.select_all(action='DESELECT')\n        objAlinhar.select_set(True)\n        objMalhaAlinha.select_set(True)\n        bpy.context.view_layer.objects.active = objMalhaAlinha\n\n        # Agrupa malha e objeto\n\n        bpy.ops.object.parent_set()\n\n        bpy.ops.object.select_all(action='DESELECT')\n        objMalhaAlinha.select_set(True)\n        bpy.context.view_layer.objects.active = objMalhaAlinha\n\n        # Alinha planos\n        bpy.ops.maplus.quickalignplanesobject()\n\n        # Desparenteia rotacionado\n        bpy.ops.object.select_all(action='DESELECT')\n        objAlinhar.select_set(True)\n        bpy.context.view_layer.objects.active = objAlinhar\n\n        bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n\n        # Apaga objetos\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.data.objects['EMP1a'].select_set(True)\n        bpy.data.objects['EMP2a'].select_set(True)\n        bpy.data.objects['EMP3a'].select_set(True)\n        bpy.data.objects['EMP1b'].select_set(True)\n        bpy.data.objects['EMP2b'].select_set(True)\n        bpy.data.objects['EMP3b'].select_set(True)\n        bpy.data.objects['MeshAlignOrigi'].select_set(True)\n        bpy.data.objects['MeshAlignAlign'].select_set(True)\n        bpy.context.view_layer.objects.active = objMalhaAlinha\n\n        bpy.ops.object.delete(use_global=False)\n\n        # Seleciona objeto alinhado\n        bpy.ops.object.select_all(action='DESELECT')\n        objAlinhar.select_set(True)\n        bpy.context.view_layer.objects.active = objAlinhar\n    else:\n        bpy.ops.object.dialog_operator_falta_ponto('INVOKE_DEFAULT')\n\n    '''\n\tcontext = bpy.context\n\tObjAlinha = context.object\n\n\tEMP1a = bpy.data.objects['EMP1a']\n\tEMP2a = bpy.data.objects['EMP2a']\n\tEMP3a = bpy.data.objects['EMP3a']\n\n\t# EMP4a\n\tbpy.ops.object.empty_add(type='SPHERE', location=((EMP2a.location[0]+EMP3a.location[0])/2, (EMP2a.location[1]+EMP3a.location[1])/2, (EMP2a.location[2]+EMP3a.location[2])/2))\n\n\tbpy.context.object.name = \"EMP4a\"\n\tEMP4a = bpy.data.objects['EMP4a']\n\n\tEMP1b = bpy.data.objects['EMP1b']\n\tEMP2b = bpy.data.objects['EMP2b']\n\tEMP3b = bpy.data.objects['EMP3b']\n\n\tbpy.ops.object.empty_add(type='SPHERE', location=((EMP2b.location[0]+EMP3b.location[0])/2, (EMP2b.location[1]+EMP3b.location[1])/2, (EMP2b.location[2]+EMP3b.location[2])/2))\n\n\tbpy.context.object.name = \"EMP4b\"\n\tEMP4b = bpy.data.objects['EMP4b']\n\n\t# Alinha no molde\n\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\n\tbpy.ops.object.parent_set()\n\n\t# Alinha com o EMP4b ao EMP4a\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\n\tbpy.context.object.location = EMP4a.location\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\tbpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n\t# Calcula grau\n\n\tA = math.sqrt((EMP2b.location[0] - EMP4a.location[0])**2 + (EMP2b.location[2] - EMP4a.location[2])**2)\n\n\tB = math.sqrt((EMP2b.location[0] - EMP2a.location[0])**2 + (EMP2b.location[2] - EMP2a.location[2])**2)\n\n\tC = math.sqrt((EMP2a.location[0] - EMP4a.location[0])**2 + (EMP2a.location[2] - EMP4a.location[2])**2)\n\n\tAngEMP4ab = (C**2 + A**2 - B**2) / (2 * C * A) # Parênteses importantes!!!\n\n\t# Radianos\n\tRotacaoY = math.acos(AngEMP4ab)\n\n\t# Ângulo\n\tmath.acos(AngEMP4ab)* 180/math.pi\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\tbpy.ops.object.parent_set()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\n\t# Rotação Y\n\n\tif EMP2a.location[2] < EMP2b.location[2]:\n\t    bpy.ops.transform.rotate(value=RotacaoY, orient_axis='Y', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\tif EMP2a.location[2] > EMP2b.location[2]:\n\t    bpy.ops.transform.rotate(value=-abs(RotacaoY), orient_axis='Y', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\t# Desagrupa para cálculo\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\tbpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n\tA = math.sqrt((EMP1b.location[1] - EMP4a.location[1])**2 + (EMP1b.location[2] - EMP4a.location[2])**2)\n\n\tB = math.sqrt((EMP1b.location[1] - EMP1a.location[1])**2 + (EMP1b.location[2] - EMP1a.location[2])**2)\n\n\tC = math.sqrt((EMP1a.location[1] - EMP4a.location[1])**2 + (EMP1a.location[2] - EMP4a.location[2])**2)\n\n\tAngEMP4ab = (C**2 + A**2 - B**2) / (2 * C * A)\n\n\t# Radianos\n\tRotacaoX = math.acos(AngEMP4ab)\n\n\t# Ângulo\n\tmath.acos(AngEMP4ab)* 180/math.pi\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\tbpy.ops.object.parent_set()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\n\tif EMP1a.location[2] < EMP1b.location[2]:\n\t    bpy.ops.transform.rotate(value=RotacaoX, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\tif EMP1a.location[2] > EMP1b.location[2]:\n\t    bpy.ops.transform.rotate(value=-abs(RotacaoX), orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\t# Desagrupa para cálculo\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\tbpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n\tA = math.sqrt((EMP1b.location[0] - EMP4a.location[0])**2 + (EMP1b.location[1] - EMP4a.location[1])**2)\n\n\tB = math.sqrt((EMP1b.location[0] - EMP1a.location[0])**2 + (EMP1b.location[1] - EMP1a.location[1])**2)\n\n\tC = math.sqrt((EMP1a.location[0] - EMP4a.location[0])**2 + (EMP1a.location[1] - EMP4a.location[1])**2)\n\n\tAngEMP4ab = (C**2 + A**2 - B**2) / (2 * C * A)\n\tprint(\"Angulo grosso\", AngEMP4ab)\n\n\t# Radianos\n\tRotacaoZ = math.acos(AngEMP4ab)\n\n\t# Ângulo\n\tAnguloZ = math.acos(AngEMP4ab)* 180/math.pi\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tObjAlinha.select_set(True)\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\tbpy.ops.object.parent_set()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP4b.select_set(True)\n\tcontext.view_layer.objects.active = EMP4b\n\n\tif EMP1a.location[0] > EMP1b.location[0]:\n\t    bpy.ops.transform.rotate(value=RotacaoZ, orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\tif EMP1a.location[0] < EMP1b.location[0]:\n\t    bpy.ops.transform.rotate(value=-abs(RotacaoZ), orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\t# Apaga referências\n\tbpy.ops.object.select_all(action='DESELECT')\n\tEMP1a.select_set(True)\n\tEMP2a.select_set(True)\n\tEMP3a.select_set(True)\n\tEMP4a.select_set(True)\n\tEMP1b.select_set(True)\n\tEMP2b.select_set(True)\n\tEMP3b.select_set(True)\n\tEMP4b.select_set(True)\n\tbpy.ops.object.delete()\n    '''\n\nclass AlinhaTresPontos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alinha_tres_pontos\"\n    bl_label = \"Align 3 Points\"\n\n    @classmethod\n    def poll(cls, context):\n\n        if len(bpy.context.selected_objects) == 1:\n            return True\n        else:\n            if len(bpy.context.selected_objects) != 1:\n                return False\n\n    def execute(self, context):\n        AlinhaTresPontosDef(self, context)\n        return {'FINISHED'}\n\n\ndef AlinhaCranioFrankfurtDef():\n\n    context = bpy.context\n\n    if bpy.data.objects.get('Bones') and bpy.data.objects.get('Orbital right') and bpy.data.objects.get('Orbital left') and bpy.data.objects.get('Po left') and bpy.data.objects.get('N point'):\n\n        def CriaLinhaALinha(Obj1, Obj2, Nome):\n            Ponto1 = bpy.data.objects[Obj1].location\n\n            Ponto2 = bpy.data.objects[Obj2].location\n\n            verts = [Ponto1,\n                     Ponto2,\n                    ]\n\n            edges = [[0,1]]\n\n            faces = []\n\n            mesh_data = bpy.data.meshes.new(\"Apaga\")\n            mesh_data.from_pydata(verts, edges, faces)\n            mesh_data.update()\n\n            obj = bpy.data.objects.new(Nome, mesh_data)\n\n            context = bpy.context\n            scene = bpy.context.scene\n            #scene.objects.link(obj)\n            bpy.context.collection.objects.link(obj)\n\n            bpy.ops.object.select_all(action='DESELECT')\n            obj.select_set(True)\n            context.view_layer.objects.active = obj\n\n\n        CriaLinhaALinha('Orbital right', 'Orbital left', 'LinhaOrbAlinha')\n        ObjDestino = context.view_layer.objects.active\n        print(ObjDestino.name)\n\n        bpy.ops.mesh.add_linhabase(location=(0, 0, 0), rotation=(0, -1.5708, 0))\n        ObjOrigem = context.view_layer.objects.active\n        print(ObjOrigem.name)\n\n        bpy.ops.object.mode_set(mode = 'EDIT')\n        bpy.ops.maplus.quickalignlinesgrabdest()\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n\n        # Parenteia objetos à Linha\n        bpy.ops.object.select_all(action='DESELECT')\n\n        ListaObjetos = ['Bones', 'Orbital right', 'Orbital left', 'Po left', 'N point']\n\n        for i in ListaObjetos:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            ObjDestino.select_set(True)\n            context.view_layer.objects.active = ObjDestino\n            bpy.ops.object.parent_set()\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjDestino.select_set(True)\n        context.view_layer.objects.active = ObjDestino\n        bpy.ops.object.mode_set(mode = 'EDIT')\n        bpy.ops.maplus.quickalignlinesobject()\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n\n        # Desagrupa\n\n        for i in ListaObjetos:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjDestino.select_set(True)\n        ObjOrigem.select_set(True)\n        bpy.ops.object.delete(use_global=False)\n\n        #LINHA LATERAL\n\n        bpy.ops.mesh.add_linhabase(location=(200, 0, 0), rotation=(1.5708, 0, 0))\n        ObjOrigem2 = context.view_layer.objects.active\n        print(\"Origem:\", ObjOrigem2.name)\n\n        bpy.ops.object.mode_set(mode = 'EDIT')\n        bpy.ops.maplus.quickalignlinesgrabdest()\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n\n\n        CriaLinhaALinha('Orbital left', 'Po left', 'LinhaOrbAlinha2')\n        ObjDestino2 = context.view_layer.objects.active\n        print(ObjDestino2.name)\n\n\n        bpy.ops.transform.resize(value=(0, 1, 1), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n        bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)\n\n\n        # Parenteia objetos à Linha\n        bpy.ops.object.select_all(action='DESELECT')\n\n        ListaObjetos = ['Bones', 'Orbital right', 'Orbital left', 'Po left', 'N point']\n\n        for i in ListaObjetos:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            ObjDestino2.select_set(True)\n            context.view_layer.objects.active = ObjDestino2\n            bpy.ops.object.parent_set()\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjDestino2.select_set(True)\n        context.view_layer.objects.active = ObjDestino2\n        bpy.ops.object.mode_set(mode = 'EDIT')\n        bpy.ops.maplus.quickalignlinesobject()\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n\n        # Desagrupa\n\n        for i in ListaObjetos:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjDestino2.select_set(True)\n        ObjOrigem2.select_set(True)\n        bpy.ops.object.delete(use_global=False)\n\n        # MOVE AO CENTRO\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        ListaObjetos2 = ['Bones', 'Orbital right', 'Orbital left', 'Po left']\n\n        PontoCentral = bpy.data.objects['N point']\n\n        for i in ListaObjetos2:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            PontoCentral .select_set(True)\n            context.view_layer.objects.active = PontoCentral\n            bpy.ops.object.parent_set()\n\n        PontoCentral = bpy.context.object.location = 0,0,0\n\n        # Desagrupa\n\n        for i in ListaObjetos2:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n    else:\n        bpy.ops.object.dialog_operator_falta_ponto_obj('INVOKE_DEFAULT')\n\nclass AlinhaCranioFrankfurt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alinha_cranio_frankfurt\"\n    bl_label = \"Align 3 Points\"\n\n    def execute(self, context):\n        AlinhaCranioFrankfurtDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(AlinhaCranioFrankfurt)\n\n\nclass OcultaMole(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.oculta_mole\"\n    bl_label = \"Hide Face\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        bpy.data.objects['SoftTissue'].hide_viewport=True\n        return {'FINISHED'}\n\nbpy.utils.register_class(OcultaMole)\n\ndef PreparaMandibulaCmDef():\n\n    SelecionaObjeto(\"cm\")\n\n    bpy.ops.object.duplicate()\n    bpy.context.object.name = \"cm_COPY\"\n\n    objeto = bpy.data.objects[\"cm_COPY\"]\n    objeto.animation_data_clear()\n\n    bpy.data.objects[\"cm\"].hide_viewport = True\n\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    for x in objeto.material_slots:\n        objeto.active_material_index = 0\n        bpy.ops.object.material_slot_remove()\n\n    if 'MatMandibulaAlinha' in ListaMateriais:\n        activeObject = objeto\n        mat = bpy.data.materials[\"MatMandibulaAlinha\"]\n        activeObject.data.materials.append(mat)\n        bpy.context.object.active_material.diffuse_color = (0.19, 0.5, 0.8, 1)\n    else:\n        activeObject = objeto\n        mat = bpy.data.materials.new(name=\"MatMandibulaAlinha\")\n        activeObject.data.materials.append(mat)\n        bpy.context.object.active_material.diffuse_color = (0.19, 0.5, 0.8, 1)\n\nclass PreparaMandibulaCm(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.prepara_mandibula_cm\"\n    bl_label = \"Prepare Mandible cm\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'cm_COPY' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        PreparaMandibulaCmDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(PreparaMandibulaCm)\n\n\ndef FinalizaMandibulaCmDef():\n\n    bpy.context.scene.frame_current = 100\n\n    bpy.data.objects[\"cm\"].hide_viewport = False\n\n    SelecionaObjeto(\"cm\")\n\n    cmCopyLoc = bpy.data.objects['cm_COPY'].location\n    cmCopyRoc = bpy.data.objects['cm_COPY'].rotation_euler\n\n    cm = bpy.data.objects['cm']\n    cm.location = cmCopyLoc\n    cm.rotation_euler = cmCopyRoc\n\n    bpy.ops.anim.ortog_loc_rot()\n\n    SelecionaObjeto(\"cm_COPY\")\n    bpy.ops.object.delete(use_global=False)\n\n\nclass FinalizaMandibulaCm(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.finaliza_mandibula_cm\"\n    bl_label = \"Finish Mandible cm\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        FinalizaMandibulaCmDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(FinalizaMandibulaCm)\n"
  },
  {
    "path": "AlinhaRedimensiona.py",
    "content": "import bpy\nimport math\nimport fnmatch\n\n# MENSAGENS\n\nclass MessageSelecioneObj(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_selecione\"\n    bl_label = \"Please, select an object before!\"\n\n    def execute(self, context):\n        message = (\"Please, select an object before!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageSelecioneObj)\n\nclass MessageColoqueValor(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_coloque_valor\"\n    bl_label = \"Please, inform a value on Real Size!\"\n\n    def execute(self, context):\n        message = (\"Please, inform a value on Real Size!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageColoqueValor)\n\n# COMANDOS\n\ndef CriaBaseOrigem():\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES', view_align=False, location=(-1, 0, 1))\n    bpy.context.object.name = \"EMP1a\"\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES', view_align=False, location=(1, 0, 1))\n    bpy.context.object.name = \"EMP2a\"\n\n    bpy.ops.object.empty_add(type='PLAIN_AXES', view_align=False, location=(0, 0, -1))\n    bpy.context.object.name = \"EMP3a\"\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n\ndef Redimensiona(self, context):\n\n    global EMP1EMP2, medidareal2\n\n    context = bpy.context\n    FACE = context.active_object\n\n    EMP1 = bpy.data.objects['EMP1b'] # Olho direito\n    EMP2 = bpy.data.objects['EMP2b'] # Olho esquerdo\n    EMP3 = bpy.data.objects['EMP3b'] # Ponto inferior\n    bpy.ops.object.empty_add(type='SPHERE', location=((EMP1.location[0]+EMP2.location[0])/2, (EMP1.location[1]+EMP2.location[1])/2, (EMP1.location[2]+EMP2.location[2])/2))\n    bpy.context.object.name = \"PT_Origem\"\n    EMP4 = bpy.data.objects['PT_Origem']\n\n    l = []\n    EMP1EMP2 = [EMP1, EMP2]\n\n    for item in EMP1EMP2:\n       l.append(item.location)\n\n    medidaAtual2 = math.sqrt( (l[0][0] - l[1][0])**2 + (l[0][1] - l[1][1])**2 + (l[0][2] - l[1][2])**2)\n    print(medidaAtual2)\n\n    medidaReal2 = float(bpy.context.scene.medida_real2)\n\n# Redimensiona\n\n    fatorEscala2 = medidaReal2 / medidaAtual2\n\n    bpy.ops.object.select_all(action='DESELECT')\n    EMP1.select_set(True)\n    EMP2.select_set(True)\n    EMP3.select_set(True)\n    EMP4.select_set(True)\n    FACE.select_set(True)\n    bpy.context.view_layer.objects.active = EMP4\n    bpy.ops.object.parent_set()\n\n    EMP4.scale = ( fatorEscala2, fatorEscala2, fatorEscala2 )\n\n\n#    bpy.ops.object.select_all(action='DESELECT')\n#    FACE.select = True\n#    bpy.context.scene.objects.active = FACE\n#    FACE.scale = ( fatorEscala2, fatorEscala2, fatorEscala2 )\n\n    print(\"Medida Atual:\", medidaAtual2)\n    print(\"Medida Real: \", medidaReal2)\n    print(\"Fator de Escala: \", fatorEscala2)\n\n    bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)\n\n    bpy.ops.object.select_all(action='DESELECT')\n#    EMP1.select_set(True)\n#    EMP2.select_set(True)\n#    EMP3.select_set(True)\n    EMP4.select_set(True)\n    bpy.context.view_layer.objects.active = EMP1\n    bpy.ops.object.delete(use_global=False)\n\n\n    FACE.select_set(True)\n    bpy.context.view_layer.objects.active = FACE\n\n    bpy.ops.object.transform_apply() # É necessário colocar os ()\n\n    bpy.ops.view3d.view_axis(type='FRONT')\n#    bpy.ops.view3d.viewnumpad(type='FRONT')\n    bpy.ops.view3d.view_selected()\n\n    #bpy.ops.view3d.view_all(center=True)\n\n    # Centraliza zoom\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            for region in area.regions:\n                if region.type == 'WINDOW':\n                    override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                    bpy.ops.view3d.view_all(override)\n\n\nclass AlinhaForcaBtn(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alinha_forca\"\n    bl_label = \"Cálculo de Alinhamento da Mandíbula\"\n\n    def execute(self, context):\n\n        context = bpy.context\n        obj = context.active_object\n        scn = context.scene\n\n        if bpy.context.scene.medida_real2 == \"None\":\n            bpy.ops.object.dialog_operator_coloque_valor('INVOKE_DEFAULT')\n        else:\n\n            CriaBaseOrigem()\n            print(\"OBJETOS CRIADOS!!!\")\n            obj.select_set(True)\n            bpy.context.view_layer.objects.active = obj\n            Redimensiona(self, context)\n            bpy.ops.object.alinha_tres_pontos()\n\n            bpy.context.object.location[0] = 0\n            bpy.context.object.location[1] = 0\n            bpy.context.object.location[2] = 0\n\n            bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)\n\n            # Centraliza zoom\n            for area in bpy.context.screen.areas:\n                if area.type == 'VIEW_3D':\n                    for region in area.regions:\n                        if region.type == 'WINDOW':\n                            override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                            bpy.ops.view3d.view_all(override)\n\n\n#            ApagaPontosAlinhaDef()\n#            ApagaPontosOrigemDef()\n\n#        bpy.ops.object.transform_apply\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(AlinhaForcaBtn)\n\n# Alinhamento por ICP\ndef ForceICPDef(self, context):\n\n    # TESTA SE TEM MAIS DO QUE 200 K???\n    context = bpy.context\n\n    if len(context.selected_objects) == 2:\n\n        ativo_antigo = context.view_layer.objects.active.name\n#        print(\"Objeto ativo:\", ativo_antigo)\n\n        for i in bpy.context.selected_objects:\n\n            if i.name != ativo_antigo:\n                context.view_layer.objects.active = i\n#                print(\"Deu certo?\", i.name)\n\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n        bpy.ops.object.align_icp()\n\nclass ForceICP(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.force_icp\"\n    bl_label = \"Force_ICP\"\n\n\n    @classmethod\n    def poll(cls, context):\n        condition_1 = len(context.selected_objects) == 2\n        conidion_2 = context.object.type == 'MESH'\n        return condition_1 and condition_1\n\n\n    def execute(self, context):\n        ForceICPDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForceICP)\n"
  },
  {
    "path": "AtualizaScript.py",
    "content": "import bpy\r\nimport subprocess\r\nimport platform\r\nfrom os.path import expanduser\r\n\r\ndef AtualizaScriptDef(self, context):\r\n\r\n\tif platform.system() == \"Windows\":\r\n#\t\tsubprocess.call('cd C:\\OrtogOnBlender\\Blender\\2.78\\scripts\\addons\\OrtogOnBlender-master && atualiza_ortog.bat', shell=True)\r\n\r\n\t\tarquivo = open('atualiza_ortog.bat', 'w+')\r\n\t\tarquivo.writelines(\"\"\"cd C:/OrtogOnBlender/Blender280/2.80/scripts/addons && ^\r\nrd /s /q OrtogOnBlender-master && ^\r\nC:/OrtogOnBlender/Python27/python.exe -c \"import urllib; urllib.urlretrieve ('http://www.ciceromoraes.com.br/downloads/OrtogOnBlender/addon/280/OrtogOnBlender-master.zip', 'OrtogOnBlender-master.zip')\" && ^\r\nC:/OrtogOnBlender/7-Zip/7z x  OrtogOnBlender-master.zip && ^\r\ndel OrtogOnBlender-master.zip\"\"\")\r\n\r\n\t\tarquivo.close()\r\n\r\n\t\tsubprocess.call('atualiza_ortog.bat', shell=True)\r\n\r\n\tif platform.system() == \"Linux\":\r\n\r\n\t\thome = expanduser(\"~\")\r\n\t\tarquivo = open(home+'/Programs/OrtogOnBlender/Blender280/atualiza_ortog.sh', 'w+')\r\n\t\tarquivo.writelines(\"\"\"cd $HOME/Downloads && rm -Rfv OrtogOnBlender-master* && \\\r\nif [ -f \"OrtogOnBlender-master.zip\" ]; then echo \"tem arquivo\" && rm OrtogOnBlender-master.zi*; fi && \\\r\nwget http://www.ciceromoraes.com.br/downloads/OrtogOnBlender/addon/280/OrtogOnBlender-master.zip && \\\r\nrm -Rfv $HOME/.config/blender/2.80/scripts/addons/OrtogOnBlender-master && \\\r\nunzip OrtogOnBlender-master.zip && \\\r\ncp -Rv OrtogOnBlender-master $HOME/.config/blender/2.80/scripts/addons/\"\"\")\r\n\r\n\t\tarquivo.close()\r\n\r\n\t\tsubprocess.call('chmod +x '+home+'/Programs/OrtogOnBlender/Blender280/atualiza_ortog.sh && '+home+'/Programs/OrtogOnBlender/Blender280/atualiza_ortog.sh', shell=True)\r\n        \r\n\r\n\tif platform.system() == \"Darwin\":\r\n\r\n\t\tarquivo = open('atualiza_ortog.sh', 'w+')\r\n\t\tarquivo.writelines(\"\"\"cd $HOME/Downloads && rm -Rfv OrtogOnBlender-master* && \\\r\nif [ -f \"OrtogOnBlender-master.zip\" ]; then echo \"tem arquivo\" && rm OrtogOnBlender-master.zi*; fi && \\\r\nwget http://www.ciceromoraes.com.br/downloads/OrtogOnBlender/addon/280/OrtogOnBlender-master.zip && \\\r\nrm -Rfv $HOME/Library/Application\\ Support/Blender/2.80/scripts/addons/OrtogOnBlender-master && \\\r\nunzip OrtogOnBlender-master.zip && \\\r\nmv OrtogOnBlender-master $HOME/Library/Application\\ Support/Blender/2.80/scripts/addons/\"\"\")\r\n\r\n\t\tarquivo.close()\r\n\r\n\t\tsubprocess.call('chmod +x atualiza_ortog.sh && ./atualiza_ortog.sh', shell=True)\r\n\r\nclass AtualizaScript(bpy.types.Operator):\r\n    \"\"\"Tooltip\"\"\"\r\n    bl_idname = \"object.atualiza_script\"\r\n    bl_label = \"Atualiza Script\"\r\n\r\n    def execute(self, context):\r\n        AtualizaScriptDef(self, context)\r\n        bpy.ops.wm.quit_blender()\r\n        return {'FINISHED'}\r\n"
  },
  {
    "path": "BooleanaOsteo.py",
    "content": "import bpy\nimport os\nimport tempfile\nimport subprocess\nimport platform\nfrom os.path import expanduser\n\nclass MessageErroCollection(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_erro_collection\"\n    bl_label = \"All objects have to be in Colletion, use M!\"\n\n    def execute(self, context):\n        message = (\"All objects have to be in Colletion, use M!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageErroCollection)\n\ndef BooleanaMandDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    #objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select ]\n\n    A = bpy.data.objects['Bones']\n    B = context.active_object #objetos_selecionados[0]\n\n# Infla o objeto\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.select_all(action = 'SELECT')\n\n    bpy.ops.transform.shrink_fatten(value=-1.61748, use_even_offset=False, mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 7\n\n    # Seleciona objeto A\n    A.hide_viewport=False\n    bpy.ops.object.select_all(action='DESELECT')\n    A.select_set(True)\n    bpy.context.view_layer.objects.active = A\n\n    bpy.ops.object.modifier_add(type='TRIANGULATE')\n    bpy.ops.export_mesh.off(filepath=tmpdir+\"/A.off\")\n    bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n    obj2 = bpy.context.view_layer.objects.active\n\n# ENVIA COLLECTION\n\n    ListaColl = []\n\n    for i in bpy.data.collections:\n        ListaColl.append(i.name)\n\n    if \"Copied_Objects\" not in ListaColl:\n\n        myCol = bpy.data.collections.new(\"Copied_Objects\")\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection='Copied_Objects')\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    else:\n        bpy.ops.object.collection_link(collection='Copied_Objects')\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n# ----------------------\n\n    # Cria objeto B\n    bpy.ops.object.select_all(action='DESELECT')\n    B.select_set(True)\n    bpy.context.view_layer.objects.active = B\n\n    bpy.ops.object.modifier_add(type='TRIANGULATE')\n    bpy.ops.export_mesh.off(filepath=tmpdir+\"/B.off\")\n    bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n    obj2 = bpy.context.view_layer.objects.active\n\n# ENVIA COLLETION\n\n    ListaColl = []\n\n    for i in bpy.data.collections:\n        ListaColl.append(i.name)\n\n    if \"Copied_Objects\" not in ListaColl:\n\n        myCol = bpy.data.collections.new(\"Copied_Objects\")\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection='Copied_Objects')\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    else:\n        bpy.ops.object.collection_link(collection='Copied_Objects')\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n\n#    bpy.ops.object.move_to_layer(layers=(False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False))\n\n# -------------------\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    # Booleana\n    if platform.system() == \"Linux\":\n        subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Skull.off', shell=True)\n        bpy.ops.import_mesh.off(filepath=tmpdir+\"/Skull.off\")\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -isct '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Mandible.off', shell=True)\n        bpy.ops.import_mesh.off(filepath=tmpdir+\"/Mandible.off\")\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n    if platform.system() == \"Windows\":\n        subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Skull.off', shell=True)\n        bpy.ops.import_mesh.off(filepath=tmpdir+\"/Skull.off\")\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -isct '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Mandible.off', shell=True)\n        bpy.ops.import_mesh.off(filepath=tmpdir+\"/Mandible.off\")\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n    if platform.system() == \"Darwin\":\n \n        homeall = expanduser(\"~\")\n \n        subprocess.call(homeall+'/Programs/OrtogOnBlender/Cork/./cork -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Skull.off', shell=True)\n        bpy.ops.import_mesh.off(filepath=tmpdir+\"/Skull.off\")\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        subprocess.call(homeall+'/Programs/OrtogOnBlender/Cork/./cork -isct '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Mandible.off', shell=True)\n        bpy.ops.import_mesh.off(filepath=tmpdir+\"/Mandible.off\")\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n    Mandible = bpy.data.objects['Mandible']\n    bpy.ops.object.select_all(action='DESELECT')\n    Mandible.select_set(True)\n    bpy.context.view_layer.objects.active = Mandible\n    bpy.ops.object.move_to_collection(collection_index=1)\n\nclass BooleanaMand(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_mandib\"\n    bl_label = \"Booleanas da mandíbula\"\n\n    def execute(self, context):\n       BooleanaMandDef(self, context)\n       return {'FINISHED'}\n\ndef BooleanaOsteoDef(self, context):\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n    lista_colecoes = []\n\n    for i in objetos_selecionados:\n        lista_colecoes.append(i.users_collection[0].name)\n\n\n    lista_final = []\n\n    for i in lista_colecoes:\n        if i != 'Collection':\n            lista_final.append(\"FORA\")\n\n    if \"FORA\" in lista_final:\n        bpy.ops.object.dialog_operator_erro_collection('INVOKE_DEFAULT')\n\n    else:\n        tmpdir = tempfile.mkdtemp()\n\n    #    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n\n    #    A = objetos_selecionados[1]\n    #    B = objetos_selecionados[0]\n\n        B = bpy.data.objects['Corte']\n        A = context.active_object #objetos_selecionados[0]\n\n        # Cria objeto A\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n\n\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/A.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n        obj2 = bpy.context.view_layer.objects.active\n\n\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n    #        mainCol = bpy.data.collections['Collection']\n    #        bpy.context.scene.collection.children.unlink(mainCol)\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        else:\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n    #        mainCol = bpy.data.collections['Collection']\n    #        bpy.context.scene.collection.children.unlink(mainCol)\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        # Cria objeto B\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/B.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n        obj2 = bpy.context.view_layer.objects.active\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n    #        mainCol = bpy.data.collections['Collection']\n    #        bpy.context.scene.collection.children.unlink(mainCol)\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        else:\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n    #        mainCol = bpy.data.collections['Collection']\n    #        bpy.context.scene.collection.children.unlink(mainCol)\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n\n        # Booleana\n        if platform.system() == \"Linux\":\n            subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Darwin\":\n\n            homeall = expanduser(\"~\")\n\n            subprocess.call(homeall+'/Programs/OrtogOnBlender/Cork/./cork -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n\n    #    Result = context.active_object\n    #    Result = bpy.context.view_layer.objects.active\n\n        objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n\n        try:\n            bpy.data.collections['Collection'].objects.link(objetos_selecionados[0])\n        except:\n            print(\"O objeto já está na Collecion!\")\n\n    #    obj = context.active_object\n\n\n        bpy.ops.mesh.separate(type='LOOSE')\n\n        objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n\n        for i in objetos_selecionados:\n            bpy.ops.object.select_all(action='DESELECT')\n            i.select_set(True)\n            bpy.context.view_layer.objects.active = i\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n            bpy.ops.object.move_to_collection(collection_index=1)\n\n\n\nclass BooleanaOsteoClass(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_osteo\"\n    bl_label = \"Importa fatias de tomografia DICOM\"\n\n    def execute(self, context):\n        BooleanaOsteoDef(self, context)\n#        bpy.ops.object.collection_link(collection='Collection')\n        return {'FINISHED'}\n\n\ndef BooleanaOsteoGeralDef(self, context):\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n    lista_colecoes = []\n\n    for i in objetos_selecionados:\n        lista_colecoes.append(i.users_collection[0].name)\n\n\n    lista_final = []\n\n    for i in lista_colecoes:\n        if i != 'Collection':\n            lista_final.append(\"FORA\")\n\n    if \"FORA\" in lista_final:\n        bpy.ops.object.dialog_operator_erro_collection('INVOKE_DEFAULT')\n\n    else:\n\n        tmpdir = tempfile.mkdtemp()\n\n\n        B = bpy.context.view_layer.objects.active\n        print(\"Objeto B:\", B)\n\n        for i in bpy.context.selected_objects:\n            if i.name != B.name:\n                A = i\n                print(\"Objeto A:\", A.name)\n    #    B = bpy.context.selected_objects[1]\n\n    #    B = bpy.data.objects['Corte']\n    #    A = context.active_object #objetos_selecionados[0]\n\n        # Remover vértices duplos\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n\n        if A.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n        if B.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n\n\n        # Cria objeto A\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n\n\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/A.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n        obj2 = bpy.context.view_layer.objects.active\n\n\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        # Cria objeto B\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/B.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n        obj2 = bpy.context.view_layer.objects.active\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        # OCulta objetos originais\n        A.hide_viewport=True\n        B.hide_viewport=True\n\n        # Booleana\n        if platform.system() == \"Linux\":\n            subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Darwin\":\n\n            homeall = expanduser(\"~\")\n\n            subprocess.call(homeall+'/Programs/OrtogOnBlender/Cork/./cork -diff '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n    #    Result = context.active_object\n    #    Result = bpy.context.view_layer.objects.active\n\n    #    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n    #    bpy.data.collections['Collection'].objects.link(objetos_selecionados[0])\n\n    #    bpy.data.collections['Collection'].objects.link(bpy.context.selected_objects[0])\n\n        bpy.ops.mesh.separate(type='LOOSE')\n\n        objetos_selecionados = [ o for o in bpy.context.selected_objects ]\n\n        for i in objetos_selecionados:\n            bpy.ops.object.select_all(action='DESELECT')\n            i.select_set(True)\n            bpy.context.view_layer.objects.active = i\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n            bpy.ops.object.collection_link(collection='Collection')\n            bpy.ops.object.move_to_collection(collection_index=1)\n\n\n\nclass BooleanaOsteoGeral(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_osteo_geral\"\n    bl_label = \"Importa fatias de tomografia DICOM\"\n\n    def execute(self, context):\n        BooleanaOsteoGeralDef(self, context)\n#        bpy.ops.object.collection_link(collection='Collection')\n        return {'FINISHED'}\n\n# Booleana Union\n\ndef BooleanaOsteoUnionDef(self, context):\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n    lista_colecoes = []\n\n    for i in objetos_selecionados:\n        lista_colecoes.append(i.users_collection[0].name)\n\n\n    lista_final = []\n\n    for i in lista_colecoes:\n        if i != 'Collection':\n            lista_final.append(\"FORA\")\n\n    if \"FORA\" in lista_final:\n        bpy.ops.object.dialog_operator_erro_collection('INVOKE_DEFAULT')\n\n    else:\n\n        tmpdir = tempfile.mkdtemp()\n\n\n        B = bpy.context.view_layer.objects.active\n        print(\"Objeto B:\", B)\n\n        for i in bpy.context.selected_objects:\n            if i.name != B.name:\n                A = i\n                print(\"Objeto A:\", A.name)\n    #    B = bpy.context.selected_objects[1]\n\n    #    B = bpy.data.objects['Corte']\n    #    A = context.active_object #objetos_selecionados[0]\n\n        # Remover vértices duplos\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n        if A.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n        if B.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n\n        # Cria objeto A\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n\n\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/A.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n    #    obj2 = bpy.context.view_layer.objects.active\n\n\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n\n        # Cria objeto B\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/B.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n        obj2 = bpy.context.view_layer.objects.active\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n\n        else:\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n\n        # OCulta objetos originais\n    #    A.hide_viewport=True\n    #    B.hide_viewport=True\n\n        # Booleana\n        if platform.system() == \"Linux\":\n            subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -union '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -union '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Darwin\":\n\n            homeall = expanduser(\"~\")\n\n            subprocess.call(homeall+'/Programs/OrtogOnBlender/Cork/./cork -union '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n\n    #    Result = context.active_object\n    #    Result = bpy.context.view_layer.objects.active\n\n    #    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n    #    bpy.data.collections['Collection'].objects.link(objetos_selecionados[0])\n\n    #    bpy.data.collections['Collection'].objects.link(bpy.context.selected_objects[0])\n\n        bpy.ops.mesh.separate(type='LOOSE')\n\n\n        objetos_selecionados = [ o for o in bpy.context.selected_objects ]\n\n        for i in objetos_selecionados:\n            if i.visible_get() == True:\n                bpy.ops.object.select_all(action='DESELECT')\n                i.select_set(True)\n                bpy.context.view_layer.objects.active = i\n                bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n                bpy.ops.object.collection_link(collection='Collection')\n                bpy.ops.object.move_to_collection(collection_index=1)\n\n\n\nclass BooleanaOsteoUnion(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_osteo_union\"\n    bl_label = \"Importa fatias de tomografia DICOM\"\n\n    def execute(self, context):\n        BooleanaOsteoUnionDef(self, context)\n#g        bpy.ops.object.collection_link(collection='Collection')\n        return {'FINISHED'}\n\nbpy.utils.register_class(BooleanaOsteoUnion)\n\n# Booleana Intersect\n\ndef BooleanaOsteoInterDef(self, context):\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n    lista_colecoes = []\n\n    for i in objetos_selecionados:\n        lista_colecoes.append(i.users_collection[0].name)\n\n\n    lista_final = []\n\n    for i in lista_colecoes:\n        if i != 'Collection':\n            lista_final.append(\"FORA\")\n\n    if \"FORA\" in lista_final:\n        bpy.ops.object.dialog_operator_erro_collection('INVOKE_DEFAULT')\n\n    else:\n\n        tmpdir = tempfile.mkdtemp()\n\n\n        B = bpy.context.view_layer.objects.active\n        print(\"Objeto B:\", B)\n\n        for i in bpy.context.selected_objects:\n            if i.name != B.name:\n                A = i\n                print(\"Objeto A:\", A.name)\n    #    B = bpy.context.selected_objects[1]\n\n    #    B = bpy.data.objects['Corte']\n    #    A = context.active_object #objetos_selecionados[0]\n\n        # Remover vértices duplos\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n        if A.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n        if B.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n\n        # Cria objeto A\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n\n\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/A.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n        obj2 = bpy.context.view_layer.objects.active\n\n\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        # Cria objeto B\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/B.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n        obj2 = bpy.context.view_layer.objects.active\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n\n        else:\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            try:\n                bpy.data.collections['Collection'].objects.unlink(obj2)\n            except:\n                print(\"Não está no Collection!\")\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        # OCulta objetos originais\n        A.hide_viewport=True\n        B.hide_viewport=True\n\n        # Booleana\n        if platform.system() == \"Linux\":\n            subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -isct '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -isct '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Darwin\":\n\n            homeall = expanduser(\"~\")\n\n            subprocess.call(homeall+'/Programs//OrtogOnBlender/Cork/./cork -isct '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n\n    #    Result = context.active_object\n    #    Result = bpy.context.view_layer.objects.active\n\n    #    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n    #    bpy.data.collections['Collection'].objects.link(objetos_selecionados[0])\n\n    #    bpy.data.collections['Collection'].objects.link(bpy.context.selected_objects[0])\n\n        bpy.ops.mesh.separate(type='LOOSE')\n\n        objetos_selecionados = [ o for o in bpy.context.selected_objects ]\n\n        '''\n        for i in objetos_selecionados:\n            bpy.ops.object.collection_link(collection='Collection')\n            bpy.ops.object.select_all(action='DESELECT')\n            i.select_set(True)\n            bpy.context.view_layer.objects.active = i\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n        '''\n\n        for i in objetos_selecionados:\n            if i.visible_get() == True:\n                bpy.ops.object.select_all(action='DESELECT')\n                i.select_set(True)\n                bpy.context.view_layer.objects.active = i\n                bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n                bpy.ops.object.collection_link(collection='Collection')\n                bpy.ops.object.move_to_collection(collection_index=1)\n\n\n\nclass BooleanaOsteoInter(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_osteo_inter\"\n    bl_label = \"Importa fatias de tomografia DICOM\"\n\n    def execute(self, context):\n        BooleanaOsteoInterDef(self, context)\n#        bpy.ops.object.collection_link(collection='Collection')\n        return {'FINISHED'}\n\nbpy.utils.register_class(BooleanaOsteoInter)\n\n\ndef BooleanaUnionSimplesDef(self, context):\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n    lista_colecoes = []\n\n    for i in objetos_selecionados:\n        lista_colecoes.append(i.users_collection[0].name)\n\n\n    lista_final = []\n\n    for i in lista_colecoes:\n        if i != 'Collection':\n            lista_final.append(\"FORA\")\n\n    if \"FORA\" in lista_final:\n        bpy.ops.object.dialog_operator_erro_collection('INVOKE_DEFAULT')\n\n    else:\n\n        tmpdir = tempfile.mkdtemp()\n\n\n        B = bpy.context.view_layer.objects.active\n        print(\"Objeto B:\", B)\n\n        for i in bpy.context.selected_objects:\n            if i.name != B.name:\n                A = i\n                print(\"Objeto A:\", A.name)\n    #    B = bpy.context.selected_objects[1]\n\n    #    B = bpy.data.objects['Corte']\n    #    A = context.active_object #objetos_selecionados[0]\n\n        # Remover vértices duplos\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n        if A.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n        if B.type == 'MESH':\n            bpy.ops.object.mode_set(mode='EDIT')\n            bpy.ops.mesh.select_all(action='SELECT')\n            bpy.ops.mesh.remove_doubles()\n            bpy.ops.object.mode_set(mode='OBJECT')\n        else:\n            print(\"Não é malha!\")\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n\n        # Cria objeto A\n        bpy.ops.object.select_all(action='DESELECT')\n        A.select_set(True)\n        bpy.context.view_layer.objects.active = A\n\n\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/A.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n\n        obj2 = bpy.context.view_layer.objects.active\n\n\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        # Cria objeto B\n        bpy.ops.object.select_all(action='DESELECT')\n        B.select_set(True)\n        bpy.context.view_layer.objects.active = B\n\n        bpy.ops.object.modifier_add(type='TRIANGULATE')\n        bpy.ops.export_mesh.off(filepath=tmpdir+\"/B.off\")\n        bpy.ops.object.modifier_remove(modifier=\"Triangulate\")\n\n        obj2 = bpy.context.view_layer.objects.active\n\n    # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Copied_Objects\" not in ListaColl:\n\n            myCol = bpy.data.collections.new(\"Copied_Objects\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n\n        else:\n            bpy.ops.object.collection_link(collection='Copied_Objects')\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        # OCulta objetos originais\n        A.hide_viewport=True\n        B.hide_viewport=True\n\n        # Booleana\n        if platform.system() == \"Linux\":\n            subprocess.call('~/Programs/OrtogOnBlender/Cork/./cork -union '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\OrtogOnBlender\\Cork\\wincork.exe -union '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        if platform.system() == \"Darwin\":\n\n            homeall = expanduser(\"~\")\n\n            subprocess.call(homeall+'/Programs/OrtogOnBlender/Cork/./cork -union '+tmpdir+'/A.off '+tmpdir+'/B.off '+tmpdir+'/Result.off', shell=True)\n            bpy.ops.import_mesh.off(filepath=tmpdir+\"/Result.off\")\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n    #    Result = context.active_object\n    #    Result = bpy.context.view_layer.objects.active\n\n    #    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n    #    bpy.data.collections['Collection'].objects.link(objetos_selecionados[0])\n\n    #    bpy.data.collections['Collection'].objects.link(bpy.context.selected_objects[0])\n\n    #    bpy.ops.mesh.separate(type='LOOSE')\n\n        objetos_selecionados = [ o for o in bpy.context.selected_objects ]\n\n        for i in objetos_selecionados:\n            if i.visible_get() == True:\n                bpy.ops.object.select_all(action='DESELECT')\n                i.select_set(True)\n                bpy.context.view_layer.objects.active = i\n                bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n                bpy.ops.object.collection_link(collection='Collection')\n                bpy.ops.object.move_to_collection(collection_index=1)\n\nclass BooleanaUnionSimples(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_union_simples\"\n    bl_label = \"Importa fatias de tomografia DICOM\"\n\n    def execute(self, context):\n        BooleanaUnionSimplesDef(self, context)\n#        bpy.ops.object.collection_link(collection='Collection')\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(BooleanaUnionSimples)\n# -------------------\n\ndef UnionMultiplaDef(self, context):\n\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n    lista_colecoes = []\n\n    for i in objetos_selecionados:\n        lista_colecoes.append(i.users_collection[0].name)\n\n\n    lista_final = []\n\n    for i in lista_colecoes:\n        if i != 'Collection':\n            lista_final.append(\"FORA\")\n\n    if \"FORA\" in lista_final:\n        bpy.ops.object.dialog_operator_erro_collection('INVOKE_DEFAULT')\n\n    else:\n\n        Objetos = [ o for o in bpy.context.selected_objects if o.select_get() == True ]\n        #Results = []\n\n        Contador = int(len(Objetos))\n\n        while Contador > 1:\n            bpy.ops.object.select_all(action='DESELECT')\n            Objetos[0].select_set(True)\n            Objetos[-1].select_set(True)\n            bpy.context.view_layer.objects.active = Objetos[0]\n            bpy.ops.object.booleana_union_simples()\n            Objetos.remove(Objetos[0])\n            Objetos.remove(Objetos[-1])\n            Objetos.append(bpy.context.active_object)\n            bpy.ops.object.collection_link(collection='Collection')\n            Contador = int(len(Objetos))\n            print(\"Contador\", Contador)\n\nclass UnionMultipla(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.booleana_union_multipla\"\n    bl_label = \"Ortog multiple union boolean\"\n\n    def execute(self, context):\n        UnionMultiplaDef(self, context)\n#        bpy.ops.object.collection_link(collection='Collection')\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(UnionMultipla)\n"
  },
  {
    "path": "CalculaPontos.py",
    "content": "import bpy\n\ndef capturaINI(ObjSelecionado):\n    bpy.ops.object.select_all(action='DESELECT')\n    Objeto = bpy.data.objects[ObjSelecionado]\n    Objeto.select_set(True)\n    bpy.context.view_layer.objects.active = Objeto\n    print(\"Está no frame: \",bpy.context.scene.frame_current)\n    bpy.ops.object.duplicate()\n    bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n    bpy.context.object.name = ObjSelecionado+\".INI\"\n    \ndef capturaFIN(ObjSelecionado):\n    bpy.ops.object.select_all(action='DESELECT')\n    Objeto = bpy.data.objects[ObjSelecionado]\n    Objeto.select_set(True)\n    bpy.context.view_layer.objects.active = Objeto\n    print(\"Está no frame: \",bpy.context.scene.frame_current)\n    bpy.ops.object.duplicate()\n    bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n    bpy.context.object.name = ObjSelecionado+\".FIN\" \n    \ndef apagaObjeto(ObjSelecionado):   \n    bpy.ops.object.select_all(action='DESELECT')\n    Objeto = bpy.data.objects[ObjSelecionado]\n    Objeto.select_set(True)\n    bpy.ops.object.delete(use_global=False)\n\n  \n    \ndef capturaINItodosDef():\n\n    # ATUALIZADO?\n    ListaPontos = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left', 'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30']\n\n    ObjetosCena = bpy.data.objects\n\n    for ob in ListaPontos:\n        if ob in ObjetosCena:\n            capturaINI(ob)\n\ndef capturaFINtodosDef():\n\n    # ATUALIZADO?\n    ListaPontos = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left', 'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30']\n\n    ObjetosCena = bpy.data.objects\n\n    for ob in ListaPontos:\n        if ob in ObjetosCena:\n            capturaFIN(ob)\n\n\n\ndef calculaDeslocamento(obj, obj1, obj2):\n    objini = bpy.data.objects[obj1]\n    objfin = bpy.data.objects[obj2]\n    \n    SRED = '\\033[91m'\n    SGREEN = '\\033[92m'\n    SBLUE = '\\033[94m'\n\n    BHEAD = '\\033[95m'\n\n    BEND = '\\033[0m'\n\n\n#    if bpy.data.objects.get(obj) is not None:\n    Xdes = SRED + \"X: \" + str(round(objfin.location[0] - objini.location[0], 2)) + BEND\n    Ydes = SGREEN + \"Y: \" + str(round(objfin.location[1] - objini.location[1], 2)) + BEND\n    Zdes = SBLUE + \"Z: \" + str(round(objfin.location[2] - objini.location[2], 2)) + BEND\n\n    a = '{} {} {} {} '.format(obj, Xdes, Ydes, Zdes)\n    print(a)\n    \n\ndef obj_pre(frame):\n    bpy.context.scene.frame_set(frame)\n    print(\"frame:\", frame)\n    capturaINItodosDef()\n        \ndef obj_pos(frame):\n    bpy.context.scene.frame_set(frame)\n    print(\"frame:\", frame)\n    capturaFINtodosDef()\n\ndef geraDeslocamentoTODOSDef(self, context):\n    \n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n# Mostra resultados\n\n    frame1 = bpy.data.scenes[\"Scene\"].frame_start\n\n    obj_pre(frame1)\n\n\n    frame2 = bpy.data.scenes[\"Scene\"].frame_end\n\n    obj_pos(frame2)\n\n    SYEL = '\\33[45m'\n    BOLD = '\\033[1m'\n    BEND = '\\033[0m'\n\n    print(\" \")\n    print(\" \")\n    print(BOLD + SYEL + \"MAXILLA\" + BEND)\n\n    # ATUALIZADO?\n    ListaPontos = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left', 'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30']\n\n    ObjetosCena = bpy.data.objects\n\n    try:\n        Collection_Head = bpy.data.collections['Anatomical Points - Head'].all_objects\n\n        print(BOLD + SYEL + \"HEAD\" + BEND)\n\n        for ob in ListaPontos:\n            if ob in Collection_Head:\n                calculaDeslocamento( ob+' : ', ob+'.INI', ob+'.FIN')\n    except:\n        print(\"Sem pontos da Cabeça.\")\n\n\n    try:\n        Collection_Maxilla = bpy.data.collections['Anatomical Points - Maxilla'].all_objects\n\n        print(\" \")\n        print(BOLD + SYEL + \"MAXILLA\" + BEND)\n\n        for ob in ListaPontos:\n            if ob in Collection_Maxilla:\n                calculaDeslocamento( ob+' : ', ob+'.INI', ob+'.FIN')\n    except:\n        print(\"Sem pontos da Maxila.\")\n\n\n    try:\n        Collection_Teeth = bpy.data.collections['Anatomical Points - Teeth'].all_objects\n\n        print(\" \")\n        print(BOLD + SYEL + \"TEETH\" + BEND)\n\n        for ob in ListaPontos:\n            if ob in Collection_Teeth:\n                calculaDeslocamento( ob+' : ', ob+'.INI', ob+'.FIN')\n    except:\n        print(\"Sem pontos dos Dentes.\")\n\n\n    try:\n        Collection_Mandible = bpy.data.collections['Anatomical Points - Mandible'].all_objects\n\n        print(\" \")\n        print(BOLD + SYEL + \"MANDIBLE\" + BEND)\n\n        for ob in ListaPontos:\n            if ob in Collection_Mandible:\n                calculaDeslocamento( ob+' : ', ob+'.INI', ob+'.FIN')\n    except:\n        print(\"Sem pontos da Mandíbula.\")\n\n    try:\n        Collection_SoftTissue = bpy.data.collections['Anatomical Points - Soft Tissue'].all_objects\n\n        print(\" \")\n        print(BOLD + SYEL + \"SOFT TISSUE\" + BEND)\n\n        for ob in ListaPontos:\n            if ob in Collection_SoftTissue:\n                calculaDeslocamento( ob+' : ', ob+'.INI', ob+'.FIN')\n    except:\n        print(\"Sem pontos do Tecido Mole.\")\n\n    '''\n    for ob in ListaPontos:\n        if ob in ObjetosCena:\n            calculaDeslocamento( ob+' : ', ob+'.INI', ob+'.FIN')\n    '''\n\n    # Apaga\n    try:\n        for ob in ListaPontos:\n            if ob in ObjetosCena:\n                apagaObjeto(ob+'.INI')\n                apagaObjeto(ob+'.FIN')\n    except:\n        print(\"Sem objetos INI e FIN na cena.\")\n    \n\n# Calcula Pontos\n'''\nclass capturaINItodos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.captura_ini_todos\"\n    bl_label = \"Captura todos objetos inicio\"\n\n    def execute(self, context):\n        capturaINItodosDef(self, context)\n        return {'FINISHED'}\n\n\nclass capturaFINtodos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.captura_fin_todos\"\n    bl_label = \"Captura todos objetos final\"\n\n    def execute(self, context):\n        capturaFINtodosDef(self, context)\n        return {'FINISHED'}\n'''\nclass geraDeslocamentoTODOS(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_deslocamento_todos\"\n    bl_label = \"Gera deslocamento de todos\"\n\n    def execute(self, context):\n        geraDeslocamentoTODOSDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(geraDeslocamentoTODOS)\n"
  },
  {
    "path": "Cefalometria.py",
    "content": "import bpy\nimport math\nfrom .FerrMedidas import *\n\ndef CursorToSelectedObj(objeto):\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    bpy.data.objects[objeto].select_set(True)\n    context.view_layer.objects.active = bpy.data.objects[objeto]\n\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            ctx = bpy.context.copy()\n            ctx['area'] = area\n            ctx['region'] = area.regions[-1]\n    #        bpy.ops.view3d.view_selected(ctx)\n            bpy.ops.view3d.snap_cursor_to_selected(ctx)\n            break\n\ndef CursorToSelectedObjs(objeto1, objeto2):\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    bpy.data.objects[objeto1].select_set(True)\n    bpy.data.objects[objeto2].select_set(True)\n    context.view_layer.objects.active = bpy.data.objects[objeto1]\n\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            ctx = bpy.context.copy()\n            ctx['area'] = area\n            ctx['region'] = area.regions[-1]\n    #        bpy.ops.view3d.view_selected(ctx)\n            bpy.ops.view3d.snap_cursor_to_selected(ctx)\n            break\n\ndef ApagarObjeto(objeto):\n    context = bpy.context\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects[objeto].select_set(True)\n    context.view_layer.objects.active = bpy.data.objects[objeto]\n    bpy.ops.object.delete(use_global=False)\n\n\n\nclass CalculaTudoUSP(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.calcula_tudo_usp\"\n    bl_label = \"USP Calc All\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        bpy.ops.object.calcula_plano_oclusal_classico()\n        CalculaSNADef()\n        CalculaSNBDef()\n        CalculaANBDef()\n        CalculaPlanoMandibularDef()\n        CalculaSNGoGnDef()\n        CalculaSNGnDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CalculaTudoUSP)\n\ndef CalculaSNGnDef():\n\n    FoundA = 'S point' in bpy.data.objects\n    FoundN = 'N point' in bpy.data.objects\n    FoundB = 'Gn point' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n    if FoundA == True and FoundN == True and FoundB == True:\n        print(\"SNGn - Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObj(\"S point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoS\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"N point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoN\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"Gn point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoGn\"\n        bpy.context.object.location[0] = 0\n\n        bpy.data.objects[\"PontoS\"].location[0] = 0\n        bpy.data.objects[\"PontoN\"].location[0] = 0\n        bpy.data.objects[\"PontoGn\"].location[0] = 0\n\n        AnguloSNGn = CalculaAngulo(\"PontoN\", \"PontoS\", \"PontoGn\")\n        print(\"Ângulo SNGn:\", AnguloSNGn)\n\n        bpy.types.Scene.angulo_sngn = bpy.props.StringProperty \\\n            (\n                name = \"SNGn Angle\",\n                description = \"SNGn Angle\",\n                default = str(AnguloSNGn)\n            )\n\n        ApagarObjeto(\"PontoS\")\n        ApagarObjeto(\"PontoN\")\n        ApagarObjeto(\"PontoGn\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(AnguloSNGn)\n\n    else:\n        bpy.types.Scene.angulo_sngn = bpy.props.StringProperty \\\n            (\n                name = \"SNGn Angle\",\n                description = \"SNGn Angle\",\n                default = \"NONE\"\n            )\n        print(\"Falta algum ponto anatômico (SNGn)!\")\n\ndef CalculaSNGoGnDef():\n\n    FoundS = 'S point' in bpy.data.objects\n    FoundN = 'N point' in bpy.data.objects\n    FoundGoright = 'Go right' in bpy.data.objects\n    FoundGoleft = 'Go left' in bpy.data.objects\n    FoundGnpoint = 'Gn point' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n\n    if FoundS == True and FoundN == True and FoundGoright == True and FoundGoleft == True and FoundGnpoint == True:\n        print(\"Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObj(\"S point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoS\"\n        bpy.context.object.location[0] = 0\n\n        CursorToSelectedObj(\"N point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoN\"\n        bpy.context.object.location[0] = 0\n\n        CursorToSelectedObjs(\"Go left\", \"Go left\")\n        Cursor_Gonios = bpy.context.scene.cursor.location\n        print(Cursor_Gonios)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"Gonios\"\n        bpy.context.object.location[0] = 0\n\n        CursorToSelectedObj(\"Gn point\")\n        Cursor_Gn = bpy.context.scene.cursor.location\n\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoGn\"\n        bpy.context.object.location[0] = 0\n\n\n        def line_intersection(line1, line2):\n            xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])\n            ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1])\n\n            def det(a, b):\n                return a[0] * b[1] - a[1] * b[0]\n\n            div = det(xdiff, ydiff)\n            if div == 0:\n               raise Exception('As linhas tê intersecção!')\n\n            d = (det(*line1), det(*line2))\n            x = det(d, xdiff) / div\n            y = det(d, ydiff) / div\n            return x, y\n\n        PontoS = bpy.data.objects['PontoS']\n        PontoN = bpy.data.objects['PontoN']\n        Gonios = bpy.data.objects['Gonios']\n        PontoGn = bpy.data.objects['PontoGn']\n\n        Linha1 = [(PontoS.location[1], PontoS.location[2]), (PontoN.location[1], PontoN.location[2])]\n        Linha2 = [(Gonios.location[1], Gonios.location[2]), (PontoGn.location[1],PontoGn.location[2])]\n\n        EncontroYZ = line_intersection(Linha1, Linha2)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"ProjSNGoGn\"\n        bpy.context.object.location[0] = 0\n        bpy.context.object.location[1] = EncontroYZ[0]\n        bpy.context.object.location[2] = EncontroYZ[1]\n\n\n        AnguloSNGoGn = CalculaAngulo(\"PontoN\", \"ProjSNGoGn\", \"PontoGn\")\n\n        bpy.types.Scene.angulo_sngogn = bpy.props.StringProperty \\\n            (\n                name = \"SNGoGn Angle\",\n                description = \"SNGoGn Angle\",\n                default = str(AnguloSNGoGn)\n            )\n\n        ApagarObjeto(\"PontoS\")\n        ApagarObjeto(\"PontoN\")\n        ApagarObjeto(\"Gonios\")\n        ApagarObjeto(\"PontoGn\")\n        ApagarObjeto(\"ProjSNGoGn\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(AnguloSNGoGn)\n\n    else:\n        bpy.types.Scene.angulo_sngogn = bpy.props.StringProperty \\\n            (\n                name = \"SNGoGn Angle\",\n                description = \"SNGoGn Angle\",\n                default = \"NONE\"\n            )\n        print(\"Falta algum ponto anatômico (SNGoGn)!\")\n\ndef CalculaPlanoMaxilaClassicoDef():\n\n    FoundT3 = 'Tooth 3' in bpy.data.objects\n    FoundT14 = 'Tooth 14' in bpy.data.objects\n    FoundT8 = 'Tooth 8' in bpy.data.objects\n    FoundT9 = 'Tooth 9' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n\n    if FoundT3 == True and FoundT14 == True and FoundT8 == True and FoundT9 == True:\n        print(\"Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObjs(\"Tooth 14\", \"Tooth 3\")\n        Cursor_1626 = bpy.context.scene.cursor.location\n        print(Cursor_1626)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"1626\"\n\n        CursorToSelectedObjs(\"Tooth 9\", \"Tooth 8\")\n        Cursor_1121 = bpy.context.scene.cursor.location\n        print(Cursor_1121)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"1121\"\n\n        #PosicaoX = bpy.data.objects[\"1121\"].location[0]\n        #PosicaoY = bpy.data.objects[\"1626\"].location[1]\n        #PosicaoZ = bpy.data.objects[\"1121\"].location[2]\n\n        PosicaoX = bpy.data.objects[\"1121\"].location[0]\n        PosicaoY = bpy.data.objects[\"1121\"].location[1]\n        PosicaoZ = bpy.data.objects[\"1626\"].location[2]\n\n        print(PosicaoX)\n        print(PosicaoY)\n        print(PosicaoZ)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(PosicaoX, PosicaoY, PosicaoZ))\n        bpy.context.object.name = \"Inter_1626_1121\"\n\n        bpy.data.objects[\"1121\"].location[0] = 0\n        bpy.data.objects[\"1626\"].location[0] = 0\n        bpy.data.objects[\"Inter_1626_1121\"].location[0] = 0\n\n        AnguloOcluMaxClass = CalculaAngulo(\"1121\", \"1626\", \"Inter_1626_1121\")\n\n        bpy.types.Scene.plano_oclusal_maxila_classico = bpy.props.StringProperty \\\n            (\n                name = \"Maxillary Occlusal Angle\",\n                description = \"Classic Max. Occl. Plane\",\n                default = str(AnguloOcluMaxClass)\n            )\n\n        ApagarObjeto(\"1121\")\n        ApagarObjeto(\"1626\")\n        ApagarObjeto(\"Inter_1626_1121\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(AnguloOcluMaxClass)\n\n    else:\n        print(\"Falta algum ponto anatômico dos dentes!\")\n\n\ndef CalculaPlanoMandibularDef():\n\n    FoundGoleft = 'Go left' in bpy.data.objects\n    FoundGoright = 'Go right' in bpy.data.objects\n    FoundMepoint = 'Me point' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n\n    if FoundGoleft == True and FoundGoright == True and FoundMepoint == True:\n        print(\"Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObjs(\"Go left\", \"Go left\")\n        Cursor_Gonios = bpy.context.scene.cursor.location\n        print(Cursor_Gonios)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"Gonios\"\n\n        CursorToSelectedObj(\"Me point\")\n        Cursor_Mepoint = bpy.context.scene.cursor.location\n        print(Cursor_Mepoint)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"Mepoint\"\n\n\n        PosicaoX = bpy.data.objects[\"Gonios\"].location[0]\n        PosicaoY = bpy.data.objects[\"Mepoint\"].location[1]\n        PosicaoZ = bpy.data.objects[\"Gonios\"].location[2]\n\n        print(PosicaoX)\n        print(PosicaoY)\n        print(PosicaoZ)\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(PosicaoX, PosicaoY, PosicaoZ))\n        bpy.context.object.name = \"Inter_Gonios_Me\"\n\n        bpy.data.objects[\"Gonios\"].location[0] = 0\n        bpy.data.objects[\"Mepoint\"].location[0] = 0\n        bpy.data.objects[\"Inter_Gonios_Me\"].location[0] = 0\n\n        AnguloOcluMandUsp = CalculaAngulo(\"Inter_Gonios_Me\", \"Gonios\", \"Mepoint\")\n\n        bpy.types.Scene.plano_mandibula_usp = bpy.props.StringProperty \\\n            (\n                name = \"Mandibular Plane\",\n                description = \"Mandibular Plane\",\n                default = str(AnguloOcluMandUsp)\n            )\n\n        ApagarObjeto(\"Gonios\")\n        ApagarObjeto(\"Mepoint\")\n        ApagarObjeto(\"Inter_Gonios_Me\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(AnguloOcluMandUsp)\n\n    else:\n        print(\"Falta algum ponto anatômico na mandíbula!\")\n\ndef CalculaANBDef():\n\n    FoundA = 'A point' in bpy.data.objects\n    FoundN = 'N point' in bpy.data.objects\n    FoundB = 'B point' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n    if FoundA == True and FoundN == True and FoundB == True:\n        print(\"SNA - Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObj(\"A point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoA\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"N point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoN\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"B point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoB\"\n        bpy.context.object.location[0] = 0\n\n        bpy.data.objects[\"PontoA\"].location[0] = 0\n        bpy.data.objects[\"PontoN\"].location[0] = 0\n        bpy.data.objects[\"PontoB\"].location[0] = 0\n\n        AnguloANB = CalculaAngulo(\"PontoA\", \"PontoN\", \"PontoB\")\n        print(\"Ângulo ANB:\", AnguloANB)\n\n        bpy.types.Scene.angulo_anb = bpy.props.StringProperty \\\n            (\n                name = \"ANB Angle\",\n                description = \"ANB Angle\",\n                default = str(AnguloANB)\n            )\n\n        ApagarObjeto(\"PontoA\")\n        ApagarObjeto(\"PontoN\")\n        ApagarObjeto(\"PontoB\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(AnguloANB)\n\n    else:\n        bpy.types.Scene.angulo_anb = bpy.props.StringProperty \\\n            (\n                name = \"ANB Angle\",\n                description = \"ANB Angle\",\n                default = \"NONE\"\n            )\n        print(\"Falta algum ponto anatômico (ANB)!\")\n\ndef CalculaSNADef():\n\n    FoundS = 'S point' in bpy.data.objects\n    FoundN = 'N point' in bpy.data.objects\n    FoundA = 'A point' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n\n    if FoundS == True and FoundN == True and FoundA == True:\n        print(\"SNA - Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObj(\"S point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoS\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"N point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoN\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"A point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoA\"\n        bpy.context.object.location[0] = 0\n\n        bpy.data.objects[\"PontoS\"].location[0] = 0\n        bpy.data.objects[\"PontoN\"].location[0] = 0\n        bpy.data.objects[\"PontoA\"].location[0] = 0\n\n        AnguloSNA = CalculaAngulo(\"PontoS\", \"PontoN\", \"PontoA\")\n        print(\"Ângulo SNA:\", AnguloSNA)\n\n        bpy.types.Scene.angulo_sna = bpy.props.StringProperty \\\n            (\n                name = \"SNA Angle\",\n                description = \"SNA Angle\",\n                default = str(AnguloSNA)\n            )\n\n        ApagarObjeto(\"PontoS\")\n        ApagarObjeto(\"PontoN\")\n        ApagarObjeto(\"PontoA\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n\n        return str(AnguloSNA)\n\n    else:\n        bpy.types.Scene.angulo_sna = bpy.props.StringProperty \\\n            (\n                name = \"SNA Angle\",\n                description = \"SNA Angle\",\n                default = \"NONE\"\n            )\n        print(\"Falta algum ponto anatômico (SNA)!\")\n\n\ndef CalculaSNBDef():\n\n    FoundS = 'S point' in bpy.data.objects\n    FoundN = 'N point' in bpy.data.objects\n    FoundB = 'B point' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n\n    if FoundS == True and FoundN == True and FoundB == True:\n        print(\"SNB - Todos os pontos anatômicos presentes!\")\n\n        CursorToSelectedObj(\"S point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoS\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"N point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoN\"\n        bpy.context.object.location[0] = 0\n\n\n        CursorToSelectedObj(\"B point\")\n        Cursor_S = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n        bpy.context.object.name = \"PontoB\"\n        bpy.context.object.location[0] = 0\n\n        bpy.data.objects[\"PontoS\"].location[0] = 0\n        bpy.data.objects[\"PontoN\"].location[0] = 0\n        bpy.data.objects[\"PontoB\"].location[0] = 0\n\n        AnguloSNB = CalculaAngulo(\"PontoS\", \"PontoN\", \"PontoB\")\n        print(\"Ângulo SNB:\", AnguloSNB)\n\n        bpy.types.Scene.angulo_snb = bpy.props.StringProperty \\\n            (\n                name = \"SNB Angle\",\n                description = \"SNB Angle\",\n                default = str(AnguloSNB)\n            )\n\n        ApagarObjeto(\"PontoS\")\n        ApagarObjeto(\"PontoN\")\n        ApagarObjeto(\"PontoB\")\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(AnguloSNB)\n\n    else:\n        bpy.types.Scene.angulo_snb = bpy.props.StringProperty \\\n            (\n                name = \"SNB Angle\",\n                description = \"SNB Angle\",\n                default = \"NONE\"\n            )\n        print(\"Falta algum ponto anatômico (SNB)!\")\n\n\nclass CalculaPlanoMaxilaClassico(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.calcula_plano_oclusal_classico\"\n    bl_label = \"Calc. Max. Occl. Plane Classic\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        CalculaPlanoMaxilaClassicoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CalculaPlanoMaxilaClassico)\n\n\ndef CalculaAnguloOclusao():\n    found_U6_Oc = 'U6 Occlusal' in bpy.data.objects\n    found_U1_Tp = 'U1 Tip' in bpy.data.objects\n\n    context = bpy.context\n    objInicial = context.object\n\n    CursorInicial = []\n\n    for i in bpy.context.scene.cursor.location:\n        CursorInicial.append(i)\n\n\n    if found_U6_Oc == True and found_U1_Tp == True:\n        print(\"U6 Occlusal e U1 Tip presentes!\")\n\n        PT_U6_Oc = bpy.data.objects['U6 Occlusal']\n\n        PT_U1_Tp = bpy.data.objects['U1 Tip']\n\n        Distancia1 = math.sqrt( (PT_U6_Oc.location[1] - PT_U1_Tp.location[1])**2 + (PT_U6_Oc.location[2] - PT_U1_Tp.location[2])**2 )\n\n        print(\"Distancia1:\", Distancia1)\n\n        Distancia2= ( math.sqrt( (PT_U1_Tp.location[1] - PT_U6_Oc.location[1])**2 + ((PT_U1_Tp.location[2]-Distancia1) - PT_U6_Oc.location[2])**2 ) )/2\n\n        print(\"Distancia2:\", Distancia2)\n\n        CosLinOc = (Distancia2 / Distancia1)\n\n        Grau1 = float(round(math.degrees(math.acos(CosLinOc)),2))\n\n        GrauOclusao = 180 - (Grau1*2)\n\n        print(GrauOclusao)\n\n        bpy.types.Scene.plano_oclusal_maxila = bpy.props.StringProperty \\\n        (\n            name = \"Maxillary Occlusal Plane\",\n            description = \"Maxillary Occlusal Plane\",\n            default = str(GrauOclusao)+\"º\"\n        )\n\n        context.scene.cursor.location = CursorInicial\n\n        if objInicial != None:\n            bpy.ops.object.select_all(action='DESELECT')\n            objInicial.select_set(True)\n            context.view_layer.objects.active = objInicial\n\n        return str(GrauOclusao)+\"º\"\n\n    else:\n        print(\"Veja se os pontos U6 Occlusal e U1 Tip foram adicionados corretamente.\")\n\n\n\n\ndef CalculaAnguloNasolabial():\n    found_Columella = 'Columella' in bpy.data.objects\n    found_Subnasale = 'Subnasale' in bpy.data.objects\n    found_UpperLip = 'Upper Lip' in bpy.data.objects\n\n\n    if found_Columella == True and found_Subnasale == True and found_UpperLip == True:\n        print(\"Columella, Subnasale e Upper Lip presentes!\")\n\n        # Copia os 3\n\n        Objetos = [bpy.data.objects['Columella'], bpy.data.objects['Subnasale'], bpy.data.objects['Upper Lip']]\n\n        for item in Objetos:\n\n            bpy.ops.object.select_all(action='DESELECT')\n            item.select_set(True)\n            bpy.context.view_layer.objects.active = item\n            bpy.ops.object.duplicate_move()\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n\n\n\n        # Calcula\n\n        Columella = bpy.data.objects['Columella.001']\n        Subnasale = bpy.data.objects['Subnasale.001']\n        UpperLip = bpy.data.objects['Upper Lip.001']\n\n        SC = math.sqrt( (Columella.location[1] - Subnasale.location[1])**2 + (Columella.location[2] - Subnasale.location[2])**2 )\n        print(\"SC\", SC)\n\n        SU = math.sqrt( (UpperLip.location[1] - Subnasale.location[1])**2 + (UpperLip.location[2] - Subnasale.location[2])**2 )\n        print(\"SU\", SU)\n\n        UC = math.sqrt( (UpperLip.location[1] - Columella.location[1])**2 + (UpperLip.location[2] - Columella.location[2])**2 )\n        print(\"UC\", UC)\n\n        GrauNasolabial = (SC**2 + SU**2 - UC**2) / (2 * SC * SU)\n\n        AnguloNasolabial = float(round(math.degrees(math.acos(GrauNasolabial)),2))\n\n        print(\"Ângulo Nasolabial:\", AnguloNasolabial)\n\n        bpy.types.Scene.angulo_nasolabial = bpy.props.StringProperty \\\n        (\n            name = \"Nasolabial Angle\",\n            description = \"Nasolabial Angle\",\n            default = str(AnguloNasolabial)+\"º\"\n        )\n\n        # Apaga objetos\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        ObjetosCopias = [bpy.data.objects['Columella.001'], bpy.data.objects['Subnasale.001'], bpy.data.objects['Upper Lip.001']]\n\n        for item in ObjetosCopias:\n\n            bpy.ops.object.select_all(action='DESELECT')\n            item.select_set(True)\n            bpy.ops.object.delete(use_global=False)\n\n\n        return str(AnguloNasolabial)+\"º\"\n\ndef CalculaAnguloGbSnPog():\n    found_ST_Glabella = 'ST Glabella' in bpy.data.objects\n    found_Subnasale = 'Subnasale' in bpy.data.objects\n    found_ST_Pogonion = 'ST Pogonion' in bpy.data.objects\n\n\n    if found_ST_Glabella == True and found_Subnasale == True and found_ST_Pogonion == True:\n        print(\"ST Glabella, Subnasale e ST Pogonion presentes!\")\n\n        AnguloBase = GeraAnguloViewX('Subnasale', 'ST Glabella', 'ST Pogonion')\n\n        Gn = bpy.data.objects['ST Glabella']\n        Pog = bpy.data.objects['ST Pogonion']\n        Sn = bpy.data.objects['Subnasale']\n\n        # Acha posição do Y no meio entre Gn e Pog'\n        PosicaoMeioY = (Gn.location[1] + Pog.location[1])/2\n        print(\"PosicaoMeioY\", PosicaoMeioY)\n\n        if PosicaoMeioY > Sn.location[1]:\n            print(\"Maior! Valor:\", AnguloBase)\n\n            bpy.types.Scene.angulo_GbSnPog = bpy.props.StringProperty \\\n            (\n                name = \"Gb', Sn, Pog' Angle\",\n                description = \"Gb', Sn, Pog' Angle\",\n                default = str(AnguloBase)+\"º\"\n            )\n\n        if PosicaoMeioY < Sn.location[1]:\n            print(\"Menor\", 360 - AnguloBase)\n\n            bpy.types.Scene.angulo_GbSnPog = bpy.props.StringProperty \\\n            (\n                name = \"Gb', Sn, Pog' Angle\",\n                description = \"Gb', Sn, Pog' Angle\",\n                default = str(360 - AnguloBase)+\"º\"\n            )\n\n        if PosicaoMeioY == Sn.location[1]:\n            print(\"Igual\", 180)\n\n            bpy.types.Scene.angulo_GbSnPog = bpy.props.StringProperty \\\n            (\n                name = \"Gb', Sn, Pog' Angle\",\n                description = \"Gb', Sn, Pog' Angle\",\n                default = '180º'\n            )\n\ndef GeraAnguloViewX(Obj1, Obj2, Obj3):\n\n    A = bpy.data.objects[Obj1]\n    B = bpy.data.objects[Obj2]\n    C = bpy.data.objects[Obj3]\n\n    AB = math.sqrt( (B.location[1] - A.location[1])**2 + (B.location[2] - A.location[2])**2 )\n    print(\"AB\", AB)\n\n    AC = math.sqrt( (C.location[1] - A.location[1])**2 + (C.location[2] - A.location[2])**2 )\n    print(\"AC\", AC)\n\n    BC = math.sqrt( (C.location[1] - B.location[1])**2 + (C.location[2] - B.location[2])**2 )\n    print(\"BC\", BC)\n\n    AnguloCos = (AB**2 + AC**2 - BC**2) / (2 * AB * AC)\n\n    AnguloGraus = float(round(math.degrees(math.acos(AnguloCos)),2))\n    print(\"Ângulo em graus:\", AnguloGraus)\n\n    return AnguloGraus\n\n#GeraAnguloViewX(\"U1 Tip\", \"U1 Root\", \"U6 Occlusal\")\n\n#GeraAnguloViewX(\"L1 Tip\", \"L1 Root\", \"L6 Occlusal\")\n\n#GeraAnguloViewX(\"Subnasale\", \"ST Glabella\", \"ST Pogonion\")\n\n# G' SN POG'\n\ndef DistanciaDupla(ObjDir, ObjEsq, ObjBase, Eixo):\n\n    found_ObjDir = str(ObjDir) in bpy.data.objects\n    found_ObjEsq = str(ObjEsq) in bpy.data.objects\n    found_ObjBase = str(ObjBase) in bpy.data.objects\n\n    if found_ObjDir == True and found_ObjEsq == True and found_ObjBase == True:\n\n\n\n        def ApagaTudo():\n\n            bpy.ops.object.select_all(action='DESELECT')\n            ObjetosCopias = [Direita , Esquerda, Base]\n\n            for item in ObjetosCopias:\n                bpy.ops.object.select_all(action='DESELECT')\n                item.select_set(True)\n                bpy.context.view_layer.objects.active = item\n                bpy.ops.object.delete(use_global=False)\n\n\n        # Copia os 3\n\n        Objetos = [bpy.data.objects[ObjDir], bpy.data.objects[ObjEsq], bpy.data.objects[ObjBase]]\n\n\n        for item in Objetos:\n\n            bpy.ops.object.select_all(action='DESELECT')\n            item.select_set(True)\n            bpy.ops.object.duplicate_move()\n            bpy.context.view_layer.objects.active = item # Se não tiver dá erro!\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n\n        Direita = bpy.data.objects[ObjDir+'.001']\n        Esquerda = bpy.data.objects[ObjEsq+'.001']\n        Base = bpy.data.objects[ObjBase+'.001']\n\n\n\n        PontoCentral = ( Direita.location[Eixo] + Esquerda.location[Eixo] ) / 2\n\n        Distancia = abs( PontoCentral - Base.location[Eixo] )\n\n\n        # Calcula Posicao\n        if PontoCentral > Base.location[Eixo]:\n            DistanciaFinal = Distancia * -1\n            print(\"DistanciaFinal\", DistanciaFinal)\n            print(\"\")\n            ApagaTudo()\n\n            return DistanciaFinal\n\n        if PontoCentral < Base.location[Eixo]:\n            DistanciaFinal = Distancia\n            print(\"DistanciaFinal\", DistanciaFinal)\n            print(\"\")\n            ApagaTudo()\n\n            return DistanciaFinal\n\n        if PontoCentral == Base.location[Eixo]:\n            DistanciaFinal = Distancia\n            print(\"DistanciaFinal\", DistanciaFinal)\n            print(\"\")\n            ApagaTudo()\n\n            return DistanciaFinal\n\n\n    else:\n        print( \"Não calculou. Algum objeto faltante:\", ObjDir,\",\", ObjEsq, \",\", ObjBase)\n\n\ndef DistanciaUnica(ObjDist, ObjBase, Eixo):\n\n    found_ObjDist = str(ObjDist) in bpy.data.objects\n    found_ObjBase = str(ObjBase) in bpy.data.objects\n\n    if found_ObjDist == True and found_ObjBase == True:\n\n\n        def ApagaTudo():\n\n            bpy.ops.object.select_all(action='DESELECT')\n\n            for item in ObjetosCopias:\n                bpy.ops.object.select_all(action='DESELECT')\n                item.select_set(True)\n                bpy.context.view_layer.objects.active = item\n                bpy.ops.object.delete(use_global=False)\n\n\n        # Copia os 2\n\n        Objetos = [bpy.data.objects[ObjDist], bpy.data.objects[ObjBase]]\n\n        MedidasEixo = []\n        ObjetosCopias = []\n\n        for item in Objetos:\n            print(\"OBJETO\", item)\n            bpy.ops.object.select_all(action='DESELECT')\n            item.select_set(True)\n            bpy.context.view_layer.objects.active = item\n            bpy.ops.object.duplicate_move()\n\n            print(\"CAMADONA\")\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n            ObjetoAtual = bpy.context.selected_objects[0]\n            MedidaAtual = ObjetoAtual.location[Eixo]\n\n            MedidasEixo.append(MedidaAtual)\n            ObjetosCopias.append(ObjetoAtual)\n\n        Distancia = abs( MedidasEixo[0] - MedidasEixo[1] )\n\n\n        # Calcula Posicao\n        if MedidasEixo[1] < MedidasEixo[0]:\n            DistanciaFinal = Distancia * -1\n            print(\"DistanciaFinal\", DistanciaFinal)\n            print(\"\")\n            ApagaTudo()\n\n            return DistanciaFinal\n\n        if MedidasEixo[1] > MedidasEixo[0]:\n            DistanciaFinal = Distancia\n            print(\"DistanciaFinal\", DistanciaFinal)\n            print(\"\")\n            ApagaTudo()\n\n            return DistanciaFinal\n\n        if MedidasEixo[1] == MedidasEixo[0]:\n            DistanciaFinal = Distancia\n            print(\"DistanciaFinal\", DistanciaFinal)\n            print(\"\")\n            ApagaTudo()\n\n            return DistanciaFinal\n\n\n    else:\n        print( \"Não calculou. Algum objeto faltante:\", ObjDist,\",\", ObjBase)\n\n\n\ndef CalculaTudoCefalometriaDef(self, context):\n\n    CalculaAnguloOclusao()\n    CalculaAnguloNasolabial()\n    CalculaAnguloGbSnPog()\n\n\n    try:\n        glabella_tvl = str(float(round(DistanciaUnica(\"ST Glabella\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_glabella_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Glabella - TVL\",\n                description = \"Glabella - TVL\",\n                default = glabella_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n\n    try:\n        rima_or_tvl = str(float(round(DistanciaDupla(\"OR right\", \"OR left\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_rima_or_tvl = bpy.props.StringProperty \\\n            (\n                name = \"OR' - TVL\",\n                description = \"OR' - TVL\",\n                default = rima_or_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        rima_or_tvl = str(float(round(DistanciaDupla(\"Cheekbone right\", \"Cheekbone left\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_cheekbone_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Cheekbone - TVL\",\n                description = \"Cheekbone - TVL\",\n                default = rima_or_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        subpupilar_tvl = str(float(round(DistanciaDupla(\"Subpupil right\", \"Subpupil left\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_subpupil_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Subpupil - TVL\",\n                description = \"Subpupil - TVL\",\n                default = subpupilar_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n    '''\n    try:\n        proj_nasal_tvl = str(float(round(DistanciaDupla(\"Tip of Nose\", \"Tip of Nose\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_proj_nasal_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Tip of Nose - TVL\",\n                description = \"Tip of Nose - TVL\",\n                default = proj_nasal_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    '''\n    try:\n        base_nasal_tvl = str(float(round(DistanciaDupla(\"AB right\", \"AB left\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_base_nasal_tvl = bpy.props.StringProperty \\\n            (\n                name = \"AB - TVL\",\n                description = \"AB - TVL\",\n                default = base_nasal_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n    '''\n    try:\n        a_mole_tvl = str(float(round(DistanciaDupla(\"ST A point\", \"ST A point\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_a_mole_tvl = bpy.props.StringProperty \\\n            (\n                name = \"A' - TVL\",\n                description = \"A' - TVL\",\n                default = a_mole_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        labio_superior_tvl = str(float(round(DistanciaDupla(\"Upper Lip\", \"Upper Lip\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_labio_superior_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Upper Lip - TVL\",\n                description = \"Upper Lip - TVL\",\n                default = labio_superior_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        l1_tvl = str(float(round(DistanciaDupla(\"L1 Tip\", \"L1 Tip\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_l1_tvl = bpy.props.StringProperty \\\n            (\n                name = \"L1 Tip - TVL\",\n                description = \"L1 Tip - TVL\",\n                default = l1_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        u1_tvl = str(float(round(DistanciaDupla(\"U1 Tip\", \"U1 Tip\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_u1_tvl = bpy.props.StringProperty \\\n            (\n                name = \"U1 Tip - TVL\",\n                description = \"U1 Tip - TVL\",\n                default = u1_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        labio_inferior_tvl = str(float(round(DistanciaDupla(\"Lower Lip\", \"Lower Lip\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_labio_inferior_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Lower Lip - TVL\",\n                description = \"Lower Lip - TVL\",\n                default = labio_inferior_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n    try:\n        b_mole_tvl = str(float(round(DistanciaDupla(\"ST B point\", \"ST B point\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_b_mole_tvl = bpy.props.StringProperty \\\n            (\n                name = \"ST B point - TVL\",\n                description = \"ST B point - TVL\",\n                default = b_mole_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        pog_mole_tvl = str(float(round(DistanciaDupla(\"ST Pogonion\", \"ST Pogonion\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_pog_mole_tvl = bpy.props.StringProperty \\\n            (\n                name = \"ST Pogonion - TVL\",\n                description = \"ST Pogonion - TVL\",\n                default = pog_mole_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n\n    try:\n        pescoco_garganta_tvl = str(float(round(DistanciaDupla(\"Throat point\", \"Throat point\", \"Subnasale\", 1),2)))+\" mm\"\n\n        bpy.types.Scene.dist_pescoco_garganta_tvl = bpy.props.StringProperty \\\n            (\n                name = \"Throat point - TVL\",\n                description = \"Throat point - TVL\",\n                default = pescoco_garganta_tvl\n            )\n    except:\n        print(\"Algum ponto faltante!\")\n\n    '''\n\nclass CalculaTudoCefalometria(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.calcula_tudo_cefalo\"\n    bl_label = \"Cephalometry cal all\"\n\n    def execute(self, context):\n        CalculaTudoCefalometriaDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(CalculaTudoCefalometria)\n\n\ndef CalculaDistanciaObjetos(ObjA, ObjB):\n\n    A = bpy.data.objects[ObjA]\n    B = bpy.data.objects[ObjB]\n\n    Distancia = math.sqrt(( (B.location[0] - A.location[0])**2 ) + ( (B.location[1] - A.location[1])**2 ) + ( (B.location[2] - A.location[2])**2 ))\n\n    print(\"A distância entre '\"+ObjA+\"' e '\"+ObjB+\"' é de\", round(Distancia, 2))\n\n    return round(Distancia, 2)\n"
  },
  {
    "path": "CompareOnBlender.py",
    "content": "import bpy\n#import platform\n\nfrom .CompareTools import *\n\nclass FORENSIC_PT_PontosFace17(bpy.types.Panel):\n    bl_label = \"Compare 17 Points\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Compare\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Digital Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pronasale_digi_pt\", text=\"1 - Pronasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.exocanthus_alar_base_right_digi_pt\", text=\"2 - Exocanthus-Alar Base right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheek_right_digi_pt\", text=\"3 - Cheek right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_base_right_digi_pt\", text=\"4 - Alar Base right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.subnasale_digi_pt\", text=\"5 - Subnasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_base_left_digi_pt\", text=\"6 - Alar Base left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheek_left_digi_pt\", text=\"7 - Cheek left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.exocanthus_alar_base_left_digi_pt\", text=\"8 - Exocanthus-Alar Base left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_alar_base_right_digi_pt\", text=\"9 - Cheilion-Alar Base right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cupids_bow_right_digi_pt\", text=\"10 - Cupid's Bow right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cupids_bow_left_digi_pt\", text=\"11 - Cupid's Bow left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_alar_base_left_digi_pt\", text=\"12 - Cheilion-Alar Base left\")\n\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_right_digi_pt\", text=\"13 - Cheilion right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_left_digi_pt\", text=\"14 - Cheilion left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.lower_lip_digi_pt\", text=\"15 - Lower Lip\")\n\n        row = layout.row()\n        linha=row.operator(\"object.b_point_soft_digi_pt\", text=\"16 - B point soft\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pogonion_soft_digi_pt\", text=\"17 - Pogonion soft\")\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Real Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pronasale_real_pt\", text=\"1 - Pronasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.exocanthus_alar_base_right_real_pt\", text=\"2 - Exocanthus-Alar Base right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheek_right_real_pt\", text=\"3 - Cheek right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_base_right_real_pt\", text=\"4 - Alar Base right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.subnasale_real_pt\", text=\"5 - Subnasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_base_left_real_pt\", text=\"6 - Alar Base left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheek_left_real_pt\", text=\"7 - Cheek left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.exocanthus_alar_base_left_real_pt\", text=\"8 - Exocanthus-Alar Base left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_alar_base_right_real_pt\", text=\"9 - Cheilion-Alar Base right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cupids_bow_right_real_pt\", text=\"10 - Cupid's Bow right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cupids_bow_left_real_pt\", text=\"11 - Cupid's Bow left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_alar_base_left_real_pt\", text=\"12 - Cheilion-Alar Base left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_right_real_pt\", text=\"13 - Cheilion right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.cheilion_left_real_pt\", text=\"14 - Cheilion left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.lower_lip_real_pt\", text=\"15 - Lower Lip\")\n\n        row = layout.row()\n        linha=row.operator(\"object.b_point_soft_real_pt\", text=\"16 - B point soft\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pogonion_soft_real_pt\", text=\"17 - Pogonion soft\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Distances Report:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.calcula_distancias_compare\", text=\"Calc All Distances!\", icon=\"PREFERENCES\")\n\nbpy.utils.register_class(FORENSIC_PT_PontosFace17)\n"
  },
  {
    "path": "CompareTools.py",
    "content": "import bpy\nfrom .Cefalometria import *\nfrom .GeraRelatorio import *\nfrom .PontosAnatomicos import *\nfrom .FerrMedidas import *\nfrom .FerrImgTomo import * # Importa tratamento de materiais\nfrom math import sqrt\nimport csv\nimport bmesh\nfrom mathutils import Matrix, Vector\nfrom time import gmtime, strftime\n\n# PONTOS ANATOMICOS\n\nclass  Pronasale_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pronasale_digi_pt\"\n    bl_label = \" Pronasale digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Pronasale digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Pronasale digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Pronasale_digi_pt)\n\nclass  Exocanthus_Alar_Base_right_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.exocanthus_alar_base_right_digi_pt\"\n    bl_label = \"Exocanthus-Alar Base right digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Exocanthus-Alar Base right digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Exocanthus-Alar Base right digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Exocanthus_Alar_Base_right_digi_pt)\n\nclass  Exocanthus_Alar_Base_left_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.exocanthus_alar_base_left_digi_pt\"\n    bl_label = \"Exocanthus-Alar Base left digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Exocanthus-Alar Base left digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Exocanthus-Alar Base left digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Exocanthus_Alar_Base_left_digi_pt)\n\nclass  Cheek_right_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheek_right_digi_pt\"\n    bl_label = \"Cheek right digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheek right digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cheek right digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheek_right_digi_pt)\n\nclass  Cheek_left_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheek_left_digi_pt\"\n    bl_label = \"Cheek left digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheek left digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cheek left digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheek_left_digi_pt)\n\nclass  Alar_Base_right_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_base_right_digi_pt\"\n    bl_label = \"Alar Base right digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Base right digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Alar Base right digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Base_right_digi_pt)\n\nclass  Alar_Base_left_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_base_left_digi_pt\"\n    bl_label = \"Alar Base left digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Base left digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Alar Base left digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Base_left_digi_pt)\n\nclass  Subnasale_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.subnasale_digi_pt\"\n    bl_label = \"Subnasale digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Subnasale digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Subnasale digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class( Subnasale_digi_pt)\n\nclass  Cheilion_Alar_Base_right_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheilion_alar_base_right_digi_pt\"\n    bl_label = \"Cheilion-Alar Base right digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheilion-Alar Base right digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cheilion-Alar Base right digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_Alar_Base_right_digi_pt)\n\nclass  Cheilion_Alar_Base_left_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheilion_alar_base_left_digi_pt\"\n    bl_label = \"Cheilion-Alar Base left digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheilion-Alar Base left digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cheilion-Alar Base left digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_Alar_Base_left_digi_pt)\n\nclass  Cupids_Bow_right_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cupids_bow_right_digi_pt\"\n    bl_label = \"Cupid's Bow right digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cupid\\'s Bow right digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cupid\\'s Bow right digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cupids_Bow_right_digi_pt)\n\nclass  Cupids_Bow_left_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cupids_bow_left_digi_pt\"\n    bl_label = \"Cupid's Bow left digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cupid\\'s Bow left digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cupid\\'s Bow left digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cupids_Bow_left_digi_pt)\n\nclass  Cheilion_right_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheilion_right_digi_pt\"\n    bl_label = \"Cheilion right digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheilion right digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cheilion right digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_right_digi_pt)\n\nclass  Cheilion_left_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheilion_left_digi_pt\"\n    bl_label = \"Cheilion left digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheilion left digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Cheilion left digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_left_digi_pt)\n\nclass Lower_Lip_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.lower_lip_digi_pt\"\n    bl_label = \"Lower Lip digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Lower Lip digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Lower Lip digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Lower_Lip_digi_pt)\n\nclass B_point_soft_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.b_point_soft_digi_pt\"\n    bl_label = \"B point soft digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'B point soft digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('B point soft digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(B_point_soft_digi_pt)\n\nclass Pogonion_soft_digi_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pogonion_soft_digi_pt\"\n    bl_label = \"Pogonion soft digi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Pogonion soft digi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Pogonion soft digi', 'Anatomical Points - Digital')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Pogonion_soft_digi_pt)\n\n# Real\n\nclass  Pronasale_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.pronasale_real_pt\"\n   bl_label = \" Pronasale real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Pronasale real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Pronasale real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Pronasale_real_pt)\n\nclass  Exocanthus_Alar_Base_right_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.exocanthus_alar_base_right_real_pt\"\n   bl_label = \"Exocanthus-Alar Base right real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Exocanthus-Alar Base right real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Exocanthus-Alar Base right real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Exocanthus_Alar_Base_right_real_pt)\n\nclass  Exocanthus_Alar_Base_left_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.exocanthus_alar_base_left_real_pt\"\n   bl_label = \"Exocanthus-Alar Base left real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Exocanthus-Alar Base left real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Exocanthus-Alar Base left real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Exocanthus_Alar_Base_left_real_pt)\n\nclass  Cheek_right_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cheek_right_real_pt\"\n   bl_label = \"Cheek right real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cheek right real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cheek right real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cheek_right_real_pt)\n\nclass  Cheek_left_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cheek_left_real_pt\"\n   bl_label = \"Cheek left real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cheek left real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cheek left real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cheek_left_real_pt)\n\nclass  Alar_Base_right_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.alar_base_right_real_pt\"\n   bl_label = \"Alar Base right real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Alar Base right real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Alar Base right real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Base_right_real_pt)\n\nclass  Alar_Base_left_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.alar_base_left_real_pt\"\n   bl_label = \"Alar Base left real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Alar Base left real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Alar Base left real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Base_left_real_pt)\n\nclass  Subnasale_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.subnasale_real_pt\"\n   bl_label = \"Subnasale real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Subnasale real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Subnasale real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class( Subnasale_real_pt)\n\nclass  Cheilion_Alar_Base_right_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cheilion_alar_base_right_real_pt\"\n   bl_label = \"Cheilion-Alar Base right real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cheilion-Alar Base right real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cheilion-Alar Base right real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_Alar_Base_right_real_pt)\n\nclass  Cheilion_Alar_Base_left_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cheilion_alar_base_left_real_pt\"\n   bl_label = \"Cheilion-Alar Base left real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cheilion-Alar Base left real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cheilion-Alar Base left real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_Alar_Base_left_real_pt)\n\nclass  Cupids_Bow_right_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cupids_bow_right_real_pt\"\n   bl_label = \"Cupid's Bow right real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cupid\\'s Bow right real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cupid\\'s Bow right real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cupids_Bow_right_real_pt)\n\nclass  Cupids_Bow_left_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cupids_bow_left_real_pt\"\n   bl_label = \"Cupid's Bow left real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cupid\\'s Bow left real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cupid\\'s Bow left real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cupids_Bow_left_real_pt)\n\nclass  Cheilion_right_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cheilion_right_real_pt\"\n   bl_label = \"Cheilion right real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cheilion right real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cheilion right real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_right_real_pt)\n\nclass  Cheilion_left_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.cheilion_left_real_pt\"\n   bl_label = \"Cheilion left real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Cheilion left real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Cheilion left real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Cheilion_left_real_pt)\n\nclass Lower_Lip_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.lower_lip_real_pt\"\n   bl_label = \"Lower Lip real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Lower Lip real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Lower Lip real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Lower_Lip_real_pt)\n\nclass B_point_soft_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.b_point_soft_real_pt\"\n   bl_label = \"B point soft real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'B point soft real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('B point soft real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(B_point_soft_real_pt)\n\nclass Pogonion_soft_real_pt(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.pogonion_soft_real_pt\"\n   bl_label = \"Pogonion soft real\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   @classmethod\n   def poll(cls, context):\n\n       found = 'Pogonion soft real' in bpy.data.objects\n\n       if found == False:\n           return True\n       else:\n           if found == True:\n               return False\n\n   def execute(self, context):\n       CriaPontoDef('Pogonion soft real', 'Anatomical Points - Real')\n       TestaPontoCollDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(Pogonion_soft_real_pt)\n\ndef GeraPlanilha():\n\n    tmpdir = tempfile.mkdtemp()\n\n    ListaApagar = []\n\n    with open(tmpdir+'/Report_CompareOnBlender.csv', mode='w') as centroid_file:\n        report_writer = csv.writer(centroid_file, delimiter=',', quotechar='\"', quoting=csv.QUOTE_MINIMAL)\n\n        report_writer.writerow(['CompareOnBlender'])\n        report_writer.writerow([''])\n        report_writer.writerow(['Point Number', 'Point Name', 'Distance'])\n        report_writer.writerow([''])\n        report_writer.writerow(['1', 'Pronasale (Pn)', CalculaDistanciaObjetos(\"Pronasale digi\", \"Pronasale real\")])\n        report_writer.writerow(['2', 'Rigth Exocanthus-Alar Base (Rt.Exo-Al)', CalculaDistanciaObjetos(\"Exocanthus-Alar Base right digi\", \"Exocanthus-Alar Base right real\")])\n        report_writer.writerow(['3', 'Rigth Cheek (Rt.Ck)', CalculaDistanciaObjetos(\"Cheek right digi\", \"Cheek right real\")])\n        report_writer.writerow(['4', 'Rigth Alar Base (Rt.Al)', CalculaDistanciaObjetos(\"Alar Base right digi\", \"Alar Base right real\")])\n        report_writer.writerow(['5', 'Subnasale (Sn)', CalculaDistanciaObjetos(\"Subnasale digi\", \"Subnasale real\")])\n        report_writer.writerow(['6', 'Left Alar Base (Lt.Al)', CalculaDistanciaObjetos(\"Alar Base left digi\", \"Alar Base left real\")])\n        report_writer.writerow(['7', 'Left Cheek (Ir.Ck)', CalculaDistanciaObjetos(\"Cheek left digi\", \"Cheek left real\")])\n        report_writer.writerow(['8', 'Left Exocanthus-Alar Base (Lt.Exo-Al)', CalculaDistanciaObjetos(\"Exocanthus-Alar Base left digi\", \"Exocanthus-Alar Base left real\")])\n        report_writer.writerow(['9', 'Rigth Cheilion-Alar Base (Rt.Ch-Al)', CalculaDistanciaObjetos(\"Cheilion-Alar Base right digi\", \"Cheilion-Alar Base right real\")])\n        report_writer.writerow(['10', 'Rigth Cupid\\'s Bow (Rt.Cu)', CalculaDistanciaObjetos(\"Cupid's Bow right digi\", \"Cupid's Bow right real\")])\n        report_writer.writerow(['11', 'Left Cupid\\'s Bow (Lt.Cu)', CalculaDistanciaObjetos(\"Cupid's Bow left digi\", \"Cupid's Bow left real\")])\n        report_writer.writerow(['12', 'Left Cheilion-Alar Base (Lt.Ch-Al)', CalculaDistanciaObjetos(\"Cheilion-Alar Base left digi\", \"Cheilion-Alar Base left real\")])\n        report_writer.writerow(['13', 'Rigth Cheilion (Rt.Ch)', CalculaDistanciaObjetos(\"Cheilion right digi\", \"Cheilion right real\")])\n        report_writer.writerow(['14', 'Left Cheilion (Lt.Ch)', CalculaDistanciaObjetos(\"Cheilion left digi\", \"Cheilion left real\")])\n        report_writer.writerow(['15', 'Lower Lip (LL)', CalculaDistanciaObjetos(\"Lower Lip digi\", \"Lower Lip real\")])\n        report_writer.writerow(['16', 'Soft  Tissue B Point (B\\')', CalculaDistanciaObjetos(\"B point soft digi\", \"B point soft real\")])\n        report_writer.writerow(['17', 'Soft Tissue Pogonion (Pog\\')', CalculaDistanciaObjetos(\"Pogonion soft digi\", \"Pogonion soft real\")])\n\n        Media = (CalculaDistanciaObjetos(\"Pronasale digi\", \"Pronasale real\") + CalculaDistanciaObjetos(\"Exocanthus-Alar Base right digi\", \"Exocanthus-Alar Base right real\") + CalculaDistanciaObjetos(\"Cheek right digi\", \"Cheek right real\") + CalculaDistanciaObjetos(\"Alar Base right digi\", \"Alar Base right real\") + CalculaDistanciaObjetos(\"Subnasale digi\", \"Subnasale real\") + CalculaDistanciaObjetos(\"Alar Base left digi\", \"Alar Base left real\") + CalculaDistanciaObjetos(\"Cheek left digi\", \"Cheek left real\") + CalculaDistanciaObjetos(\"Exocanthus-Alar Base left digi\", \"Exocanthus-Alar Base left real\") + CalculaDistanciaObjetos(\"Cheilion-Alar Base right digi\", \"Cheilion-Alar Base right real\") + CalculaDistanciaObjetos(\"Cupid's Bow right digi\", \"Cupid's Bow right real\") + CalculaDistanciaObjetos(\"Cupid's Bow left digi\", \"Cupid's Bow left real\") + CalculaDistanciaObjetos(\"Cheilion-Alar Base left digi\", \"Cheilion-Alar Base left real\") + CalculaDistanciaObjetos(\"Cheilion right digi\", \"Cheilion right real\") + CalculaDistanciaObjetos(\"Cheilion left digi\", \"Cheilion left real\") + CalculaDistanciaObjetos(\"Lower Lip digi\", \"Lower Lip real\") + CalculaDistanciaObjetos(\"B point soft digi\", \"B point soft real\") + CalculaDistanciaObjetos(\"Pogonion soft digi\", \"Pogonion soft real\"))/17\n\n        report_writer.writerow([''])\n\n        report_writer.writerow(['', 'AVERAGE', round(Media, 2)])\n\n        if platform.system() == \"Linux\":\n            abrir_diretorio(tmpdir)\n            subprocess.Popen(\"libreoffice \"+tmpdir+\"/Report_CompareOnBlender.csv\", shell=True)\n\n        if platform.system() == \"Windows\":\n            abrir_diretorio(tmpdir)\n            subprocess.Popen('cd \"C:/Program Files/LibreOffice/program/\" & dir & soffice.bin '+tmpdir+\"/Report_CompareOnBlender.csv\", shell=True)\n\n        if platform.system() == \"Darwin\":\n            abrir_diretorio(tmpdir)\n            subprocess.Popen('/Applications/LibreOffice.app/Contents/MacOS/soffice '+tmpdir+\"/Report_CompareOnBlender.csv\", shell=True)\n\nclass CalculaDistanciasCompare(bpy.types.Operator):\n   \"\"\"Tooltip\"\"\"\n   bl_idname = \"object.calcula_distancias_compare\"\n   bl_label = \"Calc Distances on Compare\"\n   bl_options = {'REGISTER', 'UNDO'}\n\n   def execute(self, context):\n       GeraPlanilha()\n       #CalculaDistanciaObjetos(\"Cheek left real\",\"Cheek left digi\")\n       return {'FINISHED'}\n\nbpy.utils.register_class(CalculaDistanciasCompare)\n"
  },
  {
    "path": "ConfOsteotomiaAuto.py",
    "content": "import bpy\nimport platform\nimport bmesh\nfrom random import randint\n\nfrom .FerrImgTomo import *\n\n# MENSAGENS\n\ndef CriaMaterialOsteotomia(NomeMaterial, R, G, B):\n\n    activeObject = bpy.context.active_object\n    m = Material()\n    m.make_material(NomeMaterial)\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    diffuseBSDF.inputs[\"Base Color\"].default_value = [R, G, B, 1]\n    materialOutput = m.nodes['Material Output']\n\n    mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n    m.dump_node(mixShader)\n    mixShader.inputs['Fac'].default_value = 0.3\n\n    mixShader2 = m.makeNode('ShaderNodeMixShader', 'Mix Shader 2')\n    mixShader2.inputs['Fac'].default_value = 0.05\n\n    sssShader = m.makeNode('ShaderNodeSubsurfaceScattering', 'Subsurface Scattering')\n    sssShader.inputs[1].default_value = 60\n    sssShader.inputs[\"Color\"].default_value = [R, G, B, 1]\n\n    glossyShader = m.makeNode('ShaderNodeBsdfGlossy', 'Glossy BSDF')\n    glossyShader.inputs[1].default_value = .30\n\n    m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n    m.link(sssShader, 'BSSRDF', mixShader, 1)\n    m.link(glossyShader, 'BSDF', mixShader2, 2)\n    m.link(mixShader, 'Shader', mixShader2, 1)\n    m.link(mixShader2, 'Shader', materialOutput, 'Surface')\n\n    bpy.ops.object.material_slot_remove()\n    bpy.ops.object.material_slot_add()\n\n    activeObject.active_material = bpy.data.materials[NomeMaterial]\n    bpy.context.object.active_material.diffuse_color = (R, G, B, 1)\n\n\nclass MessageObjSelecionados(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_obj_selecionados\"\n    bl_label = \"You have to select 6 objects!\"\n\n    def execute(self, context):\n        message = (\"You have to select 6 objects!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageObjSelecionados)\n\n\n# IMPORTA ARMATURE\n\ndef ImportaArmatureDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = \"Armature_Head\"\n\n    if platform.system() == \"Windows\":\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = \"Armature_Head\"\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\n #   bpy.ops.wm.append(filename=filename, directory=directory)\n\n    # APAGA OBJETOS EXCEDENTES\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['Mandibula']\n    b = bpy.data.objects['SETA_Corpo_M']\n    c = bpy.data.objects['SETA_Maxila']\n    d = bpy.data.objects['SETA_Mento']\n\n\n    a.select_set(True)\n    b.select_set(True)\n    c.select_set(True)\n    d.select_set(True)\n\n\n    bpy.ops.object.delete(use_global=False)\n\nclass ImportaArmature(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_armature\"\n    bl_label = \"Importa estrutura de bones\"\n\n    def execute(self, context):\n        ImportaArmatureDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA CABEÇA\n\ndef ConfiguraCabecaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n #   scn = context.scene\n\n\n\n    ob=bpy.data.objects[\"Armature_Head\"]\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select_set(True)\n\n    vg = obj.vertex_groups.new(name=\"ca\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    # Material\n    CriaMaterialOsteotomia(\"MaterialCabeca\", 0.8, 0.75, 0.2)\n\n    bpy.context.object.name = \"ca\"\n\n    armatureHead = bpy.data.objects['Armature_Head']\n    bpy.ops.object.select_all(action='DESELECT')\n    armatureHead.hide_viewport=False\n    armatureHead.select_set(True)\n    bpy.context.view_layer.objects.active = armatureHead\n    bpy.ops.object.posemode_toggle()\n#    bpy.data.objects['ca'].select = True\n#    bpy.data.objects['Armature_Head'].select = True\n#    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    bpy.ops.pose.select_all(action='DESELECT')\n    o=bpy.context.object\n    b=o.data.bones['ca']\n    b.select=True\n    o.data.bones.active=b\n\n    bpy.ops.pose.constraint_add(type='CHILD_OF')\n    bpy.context.object.pose.bones[\"ca\"].constraints[\"Child Of\"].target = bpy.data.objects[\"ca\"]\n\n    pbone = bpy.context.active_object.pose.bones[\"ca\"] # Bone\n    context_copy = bpy.context.copy()\n    context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n    bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n    bpy.ops.object.posemode_toggle()\n    armatureHead.hide_viewport=True\n\n\nclass ConfiguraCabeca(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_cabeca\"\n    bl_label = \"Configura Cabeça\"\n\n    def execute(self, context):\n        ConfiguraCabecaDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA MAXILA\ndef ConfiguraMaxilaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n #   scn = context.scene\n\n\n    ob=bpy.data.objects[\"Armature_Head\"]\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select = True\n\n    vg = obj.vertex_groups.new(name=\"Maxila.GUIA\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    CriaMaterialOsteotomia(\"MaterialMaxila\", 0.8, 0.3, 0.2)\n\n    bpy.context.object.name = \"ma\"\n\n    armatureHead = bpy.data.objects['Armature_Head']\n    bpy.ops.object.select_all(action='DESELECT')\n    armatureHead.hide_viewport=False\n    armatureHead.select_set(True)\n    bpy.context.view_layer.objects.active = armatureHead\n    bpy.ops.object.posemode_toggle()\n#    bpy.data.objects['ma'].select = True\n#    bpy.data.objects['Armature_Head'].select = True\n#    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    bpy.ops.pose.select_all(action='DESELECT')\n    o=bpy.context.object\n    b=o.data.bones['Maxila.GUIA']\n    b.select=True\n    o.data.bones.active=b\n\n    bpy.ops.pose.constraint_add(type='CHILD_OF')\n    bpy.context.object.pose.bones[\"Maxila.GUIA\"].constraints[\"Child Of\"].target = bpy.data.objects[\"ma\"]\n\n    pbone = bpy.context.active_object.pose.bones[\"Maxila.GUIA\"] # Bone\n    context_copy = bpy.context.copy()\n    context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n    bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n    bpy.ops.object.posemode_toggle()\n    armatureHead.hide_viewport=True\n\nclass ConfiguraMaxila(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_maxila\"\n    bl_label = \"Configura Maxila\"\n\n    def execute(self, context):\n        ConfiguraMaxilaDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA RAMO DIREITO\ndef ConfiguraRamoDirDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n #   scn = context.scene\n\n\n    ob=bpy.data.objects[\"Armature_Head\"]\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select = True\n\n    vg = obj.vertex_groups.new(name=\"rd\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    CriaMaterialOsteotomia(\"MaterialRamoDir\", 0.4, 0.3, 0.8)\n\n    bpy.context.object.name = \"rd\"\n\n    armatureHead = bpy.data.objects['Armature_Head']\n    bpy.ops.object.select_all(action='DESELECT')\n    armatureHead.hide_viewport=False\n    armatureHead.select_set(True)\n    bpy.context.view_layer.objects.active = armatureHead\n    bpy.ops.object.posemode_toggle()\n#    bpy.data.objects['rd'].select = True\n#    bpy.data.objects['Armature_Head'].select = True\n#    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    bpy.ops.pose.select_all(action='DESELECT')\n    o=bpy.context.object\n    b=o.data.bones['rd']\n    b.select=True\n    o.data.bones.active=b\n\n    bpy.ops.pose.constraint_add(type='CHILD_OF')\n    bpy.context.object.pose.bones[\"rd\"].constraints[\"Child Of\"].target = bpy.data.objects[\"rd\"]\n\n    pbone = bpy.context.active_object.pose.bones[\"rd\"] # Bone\n    context_copy = bpy.context.copy()\n    context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n    bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n    bpy.ops.object.posemode_toggle()\n    armatureHead.hide_viewport=True\n\nclass ConfiguraRamoDir(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_ramo_dir\"\n    bl_label = \"Configura Ramo Direito\"\n\n    def execute(self, context):\n        ConfiguraRamoDirDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA RAMO ESQUERDO\ndef ConfiguraRamoEsqDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n #   scn = context.scene\n\n\n    ob=bpy.data.objects[\"Armature_Head\"]\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select = True\n\n    vg = obj.vertex_groups.new(name=\"re\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    CriaMaterialOsteotomia(\"MaterialRamoEsq\", 0.4, 0.3, 0.8)\n\n    bpy.context.object.name = \"re\"\n\n    armatureHead = bpy.data.objects['Armature_Head']\n    bpy.ops.object.select_all(action='DESELECT')\n    armatureHead.hide_viewport=False\n    armatureHead.select_set(True)\n    bpy.context.view_layer.objects.active = armatureHead\n    bpy.ops.object.posemode_toggle()\n#    bpy.data.objects['re'].select = True\n#    bpy.data.objects['Armature_Head'].select = True\n#    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    bpy.ops.pose.select_all(action='DESELECT')\n    o=bpy.context.object\n    b=o.data.bones['re']\n    b.select=True\n    o.data.bones.active=b\n\n    bpy.ops.pose.constraint_add(type='CHILD_OF')\n    bpy.context.object.pose.bones[\"re\"].constraints[\"Child Of\"].target = bpy.data.objects[\"re\"]\n\n    pbone = bpy.context.active_object.pose.bones[\"re\"] # Bone\n    context_copy = bpy.context.copy()\n    context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n    bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n    bpy.ops.object.posemode_toggle()\n    armatureHead.hide_viewport=True\n\nclass ConfiguraRamoEsq(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_ramo_esq\"\n    bl_label = \"Configura Ramo Esquerdo\"\n\n    def execute(self, context):\n        ConfiguraRamoEsqDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA RAMO DA MANDÍBULA\ndef ConfiguraCorpoMandDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n #   scn = context.scene\n\n\n    ob=bpy.data.objects[\"Armature_Head\"]\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select = True\n\n    vg = obj.vertex_groups.new(name=\"Corpo_Mandibular.GUIA\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    CriaMaterialOsteotomia(\"MaterialCorpoMand\", 0.35, 0.8, 0.4)\n\n    bpy.context.object.name = \"cm\"\n\n    armatureHead = bpy.data.objects['Armature_Head']\n    bpy.ops.object.select_all(action='DESELECT')\n    armatureHead.hide_viewport=False\n    armatureHead.select_set(True)\n    bpy.context.view_layer.objects.active = armatureHead\n    bpy.ops.object.posemode_toggle()\n\n#    bpy.data.objects['cm'].select = True\n#    bpy.data.objects['Armature_Head'].select = True\n#    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    bpy.ops.pose.select_all(action='DESELECT')\n    o=bpy.context.object\n    b=o.data.bones['Corpo_Mandibular.GUIA']\n    b.select=True\n    o.data.bones.active=b\n\n    bpy.ops.pose.constraint_add(type='CHILD_OF')\n    bpy.context.object.pose.bones[\"Corpo_Mandibular.GUIA\"].constraints[\"Child Of\"].target = bpy.data.objects[\"cm\"]\n\n    pbone = bpy.context.active_object.pose.bones[\"Corpo_Mandibular.GUIA\"] # Bone\n    context_copy = bpy.context.copy()\n    context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n    bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n\n    bpy.ops.object.posemode_toggle()\n    armatureHead.hide_viewport=True\n\nclass ConfiguraCorpoMand(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_corpo_mand\"\n    bl_label = \"Configura Mento\"\n\n    def execute(self, context):\n        ConfiguraCorpoMandDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA MENTO\ndef ConfiguraMentoDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n #   scn = context.scene\n\n    ob=bpy.data.objects[\"Armature_Head\"]\n\n\n    ob=bpy.data.objects[\"cm\"]\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n\n\n    for v in mesh.verts:\n        v.select = True\n\n    vg = obj.vertex_groups.new(name=\"me\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    CriaMaterialOsteotomia(\"MaterialMento\", 0.4, 0.3, 0.8)\n\n    bpy.context.object.name = \"me\"\n\n    armatureHead = bpy.data.objects['Armature_Head']\n    bpy.ops.object.select_all(action='DESELECT')\n    armatureHead.hide_viewport=False\n    armatureHead.select_set(True)\n    bpy.context.view_layer.objects.active = armatureHead\n    bpy.ops.object.posemode_toggle()\n\n #   bpy.data.objects['me'].select = True\n #   bpy.data.objects['Armature_Head'].select = True\n #   bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    bpy.ops.pose.select_all(action='DESELECT')\n    o=bpy.context.object\n    b=o.data.bones['me']\n    b.select=True\n    o.data.bones.active=b\n\n    bpy.ops.pose.constraint_add(type='CHILD_OF')\n    bpy.context.object.pose.bones[\"me\"].constraints[\"Child Of\"].target = bpy.data.objects[\"me\"]\n\n    pbone = bpy.context.active_object.pose.bones[\"me\"] # Bone\n    context_copy = bpy.context.copy()\n    context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n    bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n    bpy.ops.object.posemode_toggle()\n    armatureHead.hide_viewport=True\n\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['me']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n\nclass ConfiguraMento(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_mento\"\n    bl_label = \"Configura Mento\"\n\n    def execute(self, context):\n        ConfiguraMentoDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA OSTEO\n\ndef ConfOsteotomiaAutoDef(self, context):\n    objetos_selecionados = [ o for o in bpy.context.selected_objects ]\n#    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select ]\n\n    objetos_visiveis = []\n\n    for i in objetos_selecionados:\n        if i.visible_get() == True:\n            objetos_visiveis.append(i.name)\n\n    if len(objetos_visiveis) == 6:\n\n        Obj_Hor = []\n        for i in objetos_selecionados:\n            Obj_Hor.append(i.location[0])\n\n        # Ramos da mandíbula\n        MaxHor = max(Obj_Hor)\n        IndexMax = [i for i, j in enumerate(Obj_Hor) if j == MaxHor]\n        re = objetos_selecionados[int(IndexMax[0])]\n        print(re)\n\n        MinHor = min(Obj_Hor)\n        IndexMin = [i for i, j in enumerate(Obj_Hor) if j == MinHor]\n        rd = objetos_selecionados[int(IndexMin[0])]\n        print(rd)\n\n        print(\"Len antes: \",len(objetos_selecionados))\n        objetos_selecionados.remove(re)\n        objetos_selecionados.remove(rd)\n        print(\"Len depois: \",len(objetos_selecionados))\n\n        # Cabeça e mento\n        Obj_Ver = []\n        for i in objetos_selecionados:\n            Obj_Ver.append(i.location[2])\n\n        MaxVer = max(Obj_Ver)\n        IndexMax = [i for i, j in enumerate(Obj_Ver) if j == MaxVer]\n        ca = objetos_selecionados[int(IndexMax[0])]\n        print(ca)\n\n        MinVer = min(Obj_Ver)\n        IndexMin = [i for i, j in enumerate(Obj_Ver) if j == MinVer]\n        me = objetos_selecionados[int(IndexMin[0])]\n        print(me)\n\n        print(\"Len antes: \",len(objetos_selecionados))\n        objetos_selecionados.remove(ca)\n        objetos_selecionados.remove(me)\n        print(\"Len depois: \",len(objetos_selecionados))\n\n\n        # Maxila e corpo da mandíbula\n        Obj_Ver = []\n        for i in objetos_selecionados:\n            Obj_Ver.append(i.location[2])\n\n        MaxVer = max(Obj_Ver)\n        IndexMax = [i for i, j in enumerate(Obj_Ver) if j == MaxVer]\n        ma = objetos_selecionados[int(IndexMax[0])]\n        print(ma)\n\n        MinVer = min(Obj_Ver)\n        IndexMin = [i for i, j in enumerate(Obj_Ver) if j == MinVer]\n        cm = objetos_selecionados[int(IndexMin[0])]\n        print(cm)\n\n        # Configura osteotomias\n        bpy.ops.object.importa_armature()\n\n        ca.select_set(True)\n        bpy.context.view_layer.objects.active = ca\n        bpy.ops.object.configura_cabeca()\n        bpy.ops.object.select_all(action='DESELECT')\n\n        ma.select_set(True)\n        bpy.context.view_layer.objects.active = ma\n        bpy.ops.object.configura_maxila()\n        bpy.ops.object.select_all(action='DESELECT')\n\n        rd.select_set(True)\n        bpy.context.view_layer.objects.active = rd\n        bpy.ops.object.configura_ramo_dir()\n        bpy.ops.object.select_all(action='DESELECT')\n\n        re.select_set(True)\n        bpy.context.view_layer.objects.active = re\n        bpy.ops.object.configura_ramo_esq()\n        bpy.ops.object.select_all(action='DESELECT')\n\n        cm.select_set(True)\n        bpy.context.view_layer.objects.active = cm\n        bpy.ops.object.configura_corpo_mand()\n        bpy.ops.object.select_all(action='DESELECT')\n\n        me.select_set(True)\n        bpy.context.view_layer.objects.active = me\n        bpy.ops.object.configura_mento()\n        bpy.ops.object.select_all(action='DESELECT')\n\n        # Zera Deltas\n\n        lista_osteo = ['ca','ma', 'cm', 'rd', 're', 'me']\n\n        for i in lista_osteo:\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.data.objects[i].select_set(True)\n            bpy.context.view_layer.objects.active = bpy.data.objects[i]\n            # bpy.ops.object.transforms_to_deltas(mode='ALL') # Se zerar dá problema no collision futuro.\n            bpy.ops.anim.ortog_loc_rot()\n            bpy.ops.object.select_all(action='DESELECT')\n\n        bpy.context.scene.frame_end = 100\n        bpy.context.scene.frame_current = 100\n\n\n    if len(objetos_visiveis) != 6:\n        print(\"Selecione os 6 objetos!\")\n        bpy.ops.object.dialog_operator_obj_selecionados('INVOKE_DEFAULT')\n\nclass ConfOsteotomiaAuto(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.conf_osteo_auto\"\n    bl_label = \"Configura osteotomias automaticamente\"\n\n    def execute(self, context):\n       ConfOsteotomiaAutoDef(self, context)\n       return {'FINISHED'}\n\n# OSTEOTOMIA GERALAUTOMÁTICA\n\ndef OsteoMoleAutomaticaDef():\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    #CRIA OS OSSOS\n    # Lista tdos os objetos em um\n    objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_set ]\n\n    # Coloca o cursor na pocição do primeiro objeto\n\n    #Adiciona e apaga em modo de edição\n    bpy.ops.object.armature_add(radius=1, view_align=False, enter_editmode=False)\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.armature.select_all(action='TOGGLE')\n    bpy.ops.armature.select_all(action='TOGGLE')\n    bpy.ops.armature.delete()\n\n    for i in objetos_selecionados:\n        if i.visible_get() == True:\n            bpy.context.scene.cursor.location = (i.location)\n            bpy.ops.armature.bone_primitive_add(name=i.name)\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n    # Lista Objetos\n\n    ob = bpy.context.object\n\n    LisObjetos = []\n\n    if ob.type == 'ARMATURE':\n        armature = ob.data\n\n        for bone in armature.bones:\n\t        print(bone.name)\n\t        LisObjetos.append(bone.name)\n\n    print(\"FIM\")\n    print(LisObjetos)\n\n    # Cria Material\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for i in LisObjetos:\n        activeObject = bpy.data.objects[i] #Set active object to variable\n        mat = bpy.data.materials.new(name=i) #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n    #    bpy.context.object.active_material.diffuse_color = (0.8, 0.35, 0.2) #change color\n        activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\n    #    bpy.context.object.name = \"me\"\n\n    # Cria áreas de interesse\n\n    Face = bpy.data.objects['FaceMesh']\n\n    Face.hide_set(False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    Face.select_set(True)\n    context.view_layer.objects.active = Face\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    # Vertex Groups\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select = True\n\n    for i in LisObjetos:\n        Face.vertex_groups.new(name=i)\n        scn.tool_settings.vertex_group_weight=0\n        #bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.object.vertex_group_assign()\n\n    # Vertex Proximtiy\n    for i in LisObjetos:\n        bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = i\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[i]\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 60 #25\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 12 #8\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'SHARP'\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].name = i\n        bpy.context.object.modifiers[i].show_expanded = False\n\n    # Converte em objeto\n    bpy.ops.object.mode_set(mode='OBJECT')\n    bpy.ops.object.convert(target='MESH')\n\n    # Parenteia Armature\n\n    ArmatureOssos = bpy.data.objects['Armature']\n\n    ArmatureOssos.hide_set(False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = ArmatureOssos\n    bpy.data.objects['FaceMesh'].select_set(True)\n    ArmatureOssos.select_set(True)\n    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    #ArmatureOssos.hide=True\n\n    #bpy.ops.object.select_all(action='DESELECT')\n    #bpy.data.objects['FaceMesh'].select = True\n    #bpy.context.scene.objects.active = bpy.data.objects['FaceMesh']\n\n    # Atrela malhas as armaduras\n\n    bpy.ops.object.select_all(action='DESELECT')\n    ArmatureOssos.select_set(True)\n    bpy.context.view_layer.objects.active = ArmatureOssos\n\n    #bpy.ops.object.posemode_toggle()\n\n    for i in LisObjetos:\n        bpy.ops.object.mode_set(mode='POSE')\n        bpy.ops.pose.select_all(action='DESELECT')\n        o=bpy.context.object\n        b=o.data.bones[i]\n        b.select=True\n        o.data.bones.active=b\n\n        bpy.ops.pose.constraint_add(type='CHILD_OF')\n        bpy.context.object.pose.bones[i].constraints[\"Child Of\"].target = bpy.data.objects[i]\n\n        pbone = bpy.context.active_object.pose.bones[i] # Bone\n        context_copy = bpy.context.copy()\n        context_copy[\"constraint\"] = pbone.constraints[\"Child Of\"]\n        bpy.ops.constraint.childof_set_inverse(context_copy, constraint=\"Child Of\", owner='BONE')\n\n        bpy.ops.object.posemode_toggle()\n\n    bpy.ops.transform.translate(value=(0,0,0))\n\nclass OsteoMoleAutomatica(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.conf_osteo_mole_auto\"\n    bl_label = \"Configura osteotomias automaticamente\"\n\n    def execute(self, context):\n       OsteoMoleAutomaticaDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(OsteoMoleAutomatica)\n\ndef RenomearObjeto(nome):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.context.object.name = nome\n\nclass NomeFace(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.nome_face_malha\"\n    bl_label = \"Set Face Mesh\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        RenomearObjeto(\"FaceMesh\")\n        bpy.context.object.hide_set(True)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomeFace)\n"
  },
  {
    "path": "CortaOssoFibula.py",
    "content": "import fnmatch\n\nfrom .PontosAnatomicos import *\n\n# Pontos\n\nclass Cut_Point_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cut_point_pt\"\n    bl_label = \"Condyle Rotation Point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    '''\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Condyle Rotation Point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n    '''\n\n    def execute(self, context):\n        CriaPontoDef('CutPoint', 'Cut Points')\n        #TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cut_Point_pt)\n\n# Gera medidas\n\ndef CriaCotaCut(Objeto1, Objeto2):\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects[Objeto1].select_set(True)\n    bpy.data.objects[Objeto2].select_set(True)\n    context.view_layer.objects.active = bpy.data.objects[Objeto1]\n    bpy.ops.measureit.addlink()\n    bpy.ops.object.select_all(action='DESELECT')\n\n\ndef AtribuiCotasCut():\n\n    ListaCutPoints = []\n\n    for i in bpy.data.objects:\n        if fnmatch.fnmatchcase(i.name, \"CutPoint.0*\"):\n            ListaCutPoints.append(i.name)\n\n    ListaCutPoints.append(\"CutPoint\")\n\n    #print(\"Lista:\", ListaCutPoints)\n\n    TamanhoLista = len(ListaCutPoints)\n    print(TamanhoLista)\n\n    ItemLista = 0\n    #ListaPares = []\n\n    for i in range(TamanhoLista):\n        try:\n            print(\"valor\",i)\n            print(ListaCutPoints[ItemLista], ListaCutPoints[ItemLista+1])\n            CriaCotaCut(ListaCutPoints[ItemLista], ListaCutPoints[ItemLista+1])\n            #ListaPares.append([ListaCutPoints[ItemLista], ListaCutPoints[ItemLista+1]])\n            ItemLista += 1\n        except:\n            print(\"Finalizado!\")\n            #print(\"ListaPares:\", ListaPares)\n\n\nclass CriaCotasBotao(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_cotas_botao\"\n    bl_label = \"Create Measure on Cut Poins\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n\n    def execute(self, context):\n        AtribuiCotasCut()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaCotasBotao)\n\n# Cria bones\n\ndef CriaBonesDef():\n\n    ListaCutPoints = []\n\n    for i in bpy.data.objects:\n        if fnmatch.fnmatchcase(i.name, \"CutPoint.0*\"):\n            ListaCutPoints.append(i.name)\n\n    ListaCutPoints.append(\"CutPoint\")\n\n\n    TamanhoLista = len(ListaCutPoints)\n    print(TamanhoLista)\n\n    ItemLista = 0\n\n    bpy.context.scene.cursor.location = 0,0,0\n    bpy.ops.object.armature_add(radius=1, view_align=False, enter_editmode=True)\n\n    for i in range(TamanhoLista):\n        try:\n            print(\"AQUIIIII\")\n            print(\"ITEM LISTA LOCARION:\", bpy.data.objects[ListaCutPoints[ItemLista]].location)\n            print(\"ITEM LISTA LOCARION:\", bpy.data.objects[ListaCutPoints[ItemLista+1]].location)\n\n            bpy.context.scene.cursor.location = bpy.data.objects[ListaCutPoints[ItemLista]].location\n            bpy.ops.armature.bone_primitive_add()\n            bpy.context.object.data.edit_bones[\"Bone\"].name = ListaCutPoints[ItemLista]\n            print(\"INTEMLISTA: \", ListaCutPoints[ItemLista])\n            bpy.context.object.data.edit_bones[ListaCutPoints[ItemLista]].head = bpy.data.objects[ListaCutPoints[ItemLista+1]].location\n            print(bpy.data.objects[ListaCutPoints[ItemLista+1]].location)\n            bpy.context.object.data.edit_bones[ListaCutPoints[ItemLista]].tail = bpy.data.objects[ListaCutPoints[ItemLista]].location\n            print(bpy.data.objects[ListaCutPoints[ItemLista]].location)\n\n            ItemLista += 1\n        except:\n            print(\"Finalizado!\")\n            #print(\"ListaPares:\", ListaPares)\n\n    bpy.ops.object.mode_set(mode='OBJECT') # Volta ao modo de objeto\n\n\nclass CriaBones(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_bones_fibula\"\n    bl_label = \"Create Fibula Bones\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n\n    def execute(self, context):\n        CriaBonesDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaBones)\n"
  },
  {
    "path": "CriaSplint.py",
    "content": "import bpy\nimport platform\nimport time\nfrom random import randint\n\n# IMPORTA SPLINT COM ARMATURE\n\ndef ImportaSplintDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    if platform.system() == \"Linux\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n#        section   = \"\\\\Collection\\\\\"\n#        object    = \"SPLINT\"\n        section   = \"\\\\Object\\\\\"\n        object    = \"SPLINT\"\n\n    if platform.system() == \"Darwin\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = \"SPLINT\"\n\n    if platform.system() == \"Windows\":\n\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = \"SPLINT\"\n\n\n#    if platform.system() == \"Darwin\":\n\n#        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n#        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n#        section   = \"\\\\Group\\\\\"\n#        object    = \"SPLINT\"\n\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\nclass ImportaSplint(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_splint\"\n    bl_label = \"Importa Splint\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ImportaSplintDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(ImportaSplint)\n\n# CRIA EMPTIES INTERMEDIÁRIOS\n\ndef CriaSplintDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    a = bpy.data.objects['Tooth 8']\n    b = bpy.data.objects['Tooth 25']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.view3d.snap_cursor_to_selected()\n\n    bpy.ops.object.empty_add(type='SPHERE')\n    bpy.context.object.name = \"EMP1141\"\n    bpy.context.object.empty_display_size = .5\n\n    '''\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['EMP1141']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    '''\n\n    # ----------------------------\n\n    a = bpy.data.objects['Tooth 9']\n    b = bpy.data.objects['Tooth 24']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.view3d.snap_cursor_to_selected()\n\n    bpy.ops.object.empty_add(type='SPHERE')\n    bpy.context.object.name = \"EMP2131\"\n    bpy.context.object.empty_display_size = .5\n\n    '''\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['EMP2131']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    '''\n    # ----------------------------\n\n    a = bpy.data.objects['Tooth 11']\n    b = bpy.data.objects['Tooth 22']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.view3d.snap_cursor_to_selected()\n\n    bpy.ops.object.empty_add(type='SPHERE')\n    bpy.context.object.name = \"EMP2333\"\n    bpy.context.object.empty_display_size = .5\n\n    '''\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['EMP2333']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    '''\n    # ----------------------------\n\n    a = bpy.data.objects['Tooth 6']\n    b = bpy.data.objects['Tooth 27']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.view3d.snap_cursor_to_selected()\n\n    bpy.ops.object.empty_add(type='SPHERE')\n    bpy.context.object.name = \"EMP1343\"\n    bpy.context.object.empty_display_size = .5\n\n    '''\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['EMP1343']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    '''\n    # ----------------------------\n\n    a = bpy.data.objects['Tooth 14']\n    b = bpy.data.objects['Tooth 19']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.view3d.snap_cursor_to_selected()\n\n    bpy.ops.object.empty_add(type='SPHERE')\n    bpy.context.object.name = \"EMP2636\"\n    bpy.context.object.empty_display_size = .5\n\n    '''\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['EMP2636']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    '''\n    # ----------------------------\n\n    a = bpy.data.objects['Tooth 3']\n    b = bpy.data.objects['Tooth 30']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.view3d.snap_cursor_to_selected()\n\n    bpy.ops.object.empty_add(type='SPHERE')\n    bpy.context.object.name = \"EMP1646\"\n    bpy.context.object.empty_display_size = .5\n\n    '''\n    a = bpy.data.objects['cm']\n    b = bpy.data.objects['EMP1646']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = a\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    '''\n    # ---------------\n\n    bpy.ops.object.importa_splint()\n\n    # --------------\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMP1646']\n    a.select_set(True)\n    bpy.ops.view3d.snap_cursor_to_selected()\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMPbone1646']\n    a.select_set(True)\n    bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMP1343']\n    a.select_set(True)\n    bpy.ops.view3d.snap_cursor_to_selected()\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMPbone1343']\n    a.select_set(True)\n    bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMP1141']\n    a.select_set(True)\n    bpy.ops.view3d.snap_cursor_to_selected()\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMPbone1141']\n    a.select_set(True)\n    bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMP2131']\n    a.select_set(True)\n    bpy.ops.view3d.snap_cursor_to_selected()\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMPbone2131']\n    a.select_set(True)\n    bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMP2333']\n    a.select_set(True)\n    bpy.ops.view3d.snap_cursor_to_selected()\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMPbone2333']\n    a.select_set(True)\n    bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMP2636']\n    a.select_set(True)\n    bpy.ops.view3d.snap_cursor_to_selected()\n    bpy.ops.object.select_all(action='DESELECT')\n    a = bpy.data.objects['EMPbone2636']\n    a.select_set(True)\n    bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)\n\n\nclass CriaSplint(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_splint\"\n    bl_label = \"Cria Splint\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'SPLINT_pronto' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaSplintDef(self, context)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        splint = bpy.data.objects['SPLINT']\n        splint.select_set(True)\n        context.view_layer.objects.active = splint\n\n        bpy.ops.object.convert(target='MESH')\n        bpy.context.object.name = \"SPLINT_pronto\"\n        bpy.ops.object.select_all(action='DESELECT')\n\n        objetos = [\"Armature\", \"EMPbone1646\", \"EMPbone1343\", \"EMPbone1141\", \"EMPbone2131\", \"EMPbone2333\", \"EMPbone2636\", \"EMP1646\", \"EMP1343\", \"EMP1141\", \"EMP2131\", \"EMP2333\", \"EMP2636\"]\n\n        for item in objetos:\n            bpy.ops.object.select_all(action='DESELECT')\n            ObjAtual = bpy.data.objects[item]\n            ObjAtual.select_set(True)\n            context.view_layer.objects.active = ObjAtual\n            bpy.ops.object.delete(use_global=False)\n\n        SplintFinal = bpy.data.objects['SPLINT_pronto']\n        SplintFinal.select_set(True)\n        context.view_layer.objects.active = SplintFinal\n        bpy.ops.object.collection_link(collection='Collection')\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaSplint)\n\n\ndef DuplicaMaxMandDef():\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    if bpy.data.objects.get(\"MaxillaMand\") is not None:\n        bpy.data.objects['MaxillaMand'].name = \"Deletar\"\n\n\n    bpy.data.objects['ma'].select_set(True)\n    bpy.data.objects['cm'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['ma']\n\n    bpy.ops.object.duplicate()\n    bpy.ops.object.join()\n    NomeMaterial = \"MaxillaMand\"+time.strftime(\"%Y%m%d%H%M%S\")\n\n    bpy.context.object.name = \"MaxillaMand\"\n\n    # Deleta todos os objetos\n    for x in bpy.context.object.material_slots:\n        bpy.context.object.active_material_index = 0\n        bpy.ops.object.material_slot_remove()\n\n    activeObject = bpy.data.objects[\"MaxillaMand\"] #Set active object to variable\n    mat = bpy.data.materials.new(name=NomeMaterial) #set new material to variable\n    activeObject.data.materials.append(mat) #add the material to the object\n    activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\n    bpy.data.objects['ma'].hide_set(True)\n    bpy.data.objects['cm'].hide_set(True)\n\n\nclass DuplicaMaxMand(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.duplica_max_mand\"\n    bl_label = \"Maxilla Mandible Duplication\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'MaxillaMand' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        DuplicaMaxMandDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(DuplicaMaxMand)\n\n\ndef VisualizaMaxMandDef():\n\n    if bpy.data.objects.get(\"Splint_result\") is not None:\n        bpy.data.objects['Splint_result'].name = \"SPLINT_ready\"\n\n    if bpy.data.objects.get(\"SPLINT_pronto\") is not None:\n        bpy.data.objects['SPLINT_pronto'].name = \"SPLINT_del\"\n\n    if bpy.data.objects.get(\"MaxillaMand\") is not None:\n        bpy.data.objects['MaxillaMand'].name = \"Deletar\"\n\n    bpy.data.objects['ma'].hide_set(False)\n    bpy.data.objects['cm'].hide_set(False)\n\n\nclass VisualizaMaxMand(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.visualiza_max_mand\"\n    bl_label = \"Maxilla Mandible View\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        VisualizaMaxMandDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(VisualizaMaxMand)\n\nclass MessageNaoConstaSplintPronto(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_falta_splint_pronto\"\n    bl_label = \"Doesn't have SPLINT_pronto, rename it!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have SPLINT_pronto, rename it!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageNaoConstaSplintPronto)\n\ndef BooleanSplintDef():\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['SPLINT_pronto'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['SPLINT_pronto']\n    bpy.context.object.name = \"Splint_usado\"\n    bpy.context.object.name = \"Splint_usado\"\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['MaxillaMand'].select_set(True)\n    bpy.data.objects['Splint_usado'].select_set(True)\n\n    bpy.context.view_layer.objects.active = bpy.data.objects['MaxillaMand']\n    bpy.ops.object.booleana_osteo_geral()\n    bpy.context.object.name = \"Splint_result\"\n\n\n\nclass BooleanSplint(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.boolean_splint\"\n    bl_label = \"Boolean Splint\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Splint_result' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n\n        found = 'SPLINT_pronto' in bpy.data.objects\n\n        if found == True:\n            bpy.ops.object.duplica_max_mand()\n            BooleanSplintDef()\n\n        if found == False:\n            bpy.ops.object.dialog_operator_falta_splint_pronto('INVOKE_DEFAULT')\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(BooleanSplint)\n\ndef SplintMantemKeyStart(objeto, quadro):\n\n    scn = bpy.context.scene\n    obj = bpy.data.objects[objeto]\n\n    animData = obj.animation_data\n    action = animData.action\n    fcurves = action.fcurves\n    current_frame = scn.frame_current\n\n    for i in fcurves:\n        i.keyframe_points.insert(quadro, i.keyframe_points[0].co.y) # Primeiro keyframe\n        i.keyframe_points[0].co.y += 0 # Atualiza a animação!\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\ndef SplintMantemKeyEnd(objeto, quadro):\n\n    scn = bpy.context.scene\n    obj = bpy.data.objects[objeto]\n\n    animData = obj.animation_data\n    action = animData.action\n    fcurves = action.fcurves\n    current_frame = scn.frame_current\n\n    for i in fcurves:\n        i.keyframe_points.insert(quadro, i.keyframe_points[1].co.y) # Primeiro keyframe\n        i.keyframe_points[1].co.y += 0 # Atualiza a animação!\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\ndef SplintMaxilaOrigiMandFinalDef():\n\n        context = bpy.context\n        scn = context.scene\n\n        SplintMantemKeyStart('ma', 110)\n        SplintMantemKeyEnd('cm', 110)\n\n        SplintMantemKeyEnd('ma', 120)\n        SplintMantemKeyEnd('cm', 120)\n\n        bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.data.objects['Condyle Rotation Point'].select_set(True)\n        context.view_layer.objects.active = bpy.data.objects['Condyle Rotation Point']\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                ctx = bpy.context.copy()\n                ctx['area'] = area\n                ctx['region'] = area.regions[-1]\n        #        bpy.ops.view3d.view_selected(ctx)\n                bpy.ops.view3d.snap_cursor_to_selected(ctx)\n                break\n                bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.data.objects['cm'].select_set(True)\n        context.view_layer.objects.active = bpy.data.objects['cm']\n\n\nclass SplintMaxilaOrigiMandFinal(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.splint_maxila_origi_mand_final\"\n    bl_label = \"Splint Maxilla Origin Mandible Final\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Condyle Rotation Point' in bpy.data.objects\n\n        if found == False:\n            return False\n        else:\n            if found == True:\n                return True\n\n    def execute(self, context):\n        SplintMaxilaOrigiMandFinalDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SplintMaxilaOrigiMandFinal)\n\n\ndef SplintMandOrigiMaxilaFinalDef():\n\n        context = bpy.context\n        scn = context.scene\n\n        SplintMantemKeyStart('cm', 110)\n        SplintMantemKeyEnd('ma', 110)\n\n        SplintMantemKeyEnd('ma', 120)\n        SplintMantemKeyEnd('cm', 120)\n\n        bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.data.objects['Condyle Rotation Point'].select_set(True)\n        context.view_layer.objects.active = bpy.data.objects['Condyle Rotation Point']\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                ctx = bpy.context.copy()\n                ctx['area'] = area\n                ctx['region'] = area.regions[-1]\n        #        bpy.ops.view3d.view_selected(ctx)\n                bpy.ops.view3d.snap_cursor_to_selected(ctx)\n                break\n                bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.data.objects['cm'].select_set(True)\n        context.view_layer.objects.active = bpy.data.objects['cm']\n\n\nclass SplintMandOrigiMaxilaFinal(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.splint_mand_origi_maxila_final\"\n    bl_label = \"Splint Mandible Origin Maxilla Final\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Condyle Rotation Point' in bpy.data.objects\n\n        if found == False:\n            return False\n        else:\n            if found == True:\n                return True\n\n    def execute(self, context):\n        SplintMandOrigiMaxilaFinalDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SplintMandOrigiMaxilaFinal)\n"
  },
  {
    "path": "DesenhaGuia.py",
    "content": "import bpy\nimport fnmatch\nimport bmesh\nimport time\n\ndef DesenhaGuiaDef(self, context):\n    \n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n#    bpy.ops.gpencil.convert(type='PATH')\n#    bpy.ops.gpencil.layer_remove()\n\n    bpy.ops.gpencil.convert_old_files()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.convert(type='POLY', use_timing_data=True)\n\n    # Seleciona linha e converte em mesh\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['Note']\n    linha.select_set(True)\n#    linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n#    bpy.ops.object.convert(target='MESH')\n    bpy.ops.object.convert(target='CURVE')\n\n    # Adiciona MBall\n    bpy.ops.object.metaball_add(type='BALL', radius=1)\n\n    Linha = bpy.data.objects['Note']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select_set(True)\n    bpy.context.view_layer.objects.active = Linha\n\n#    bpy.context.space_data.context = 'DATA'\n    bpy.context.object.data.fill_mode = 'FULL'\n    bpy.context.object.data.bevel_depth = 10\n\n    bpy.ops.object.convert(target='MESH')\n    \n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].use_remove_disconnected = False\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 6\n\n    bpy.ops.object.convert(target='MESH')\n\n#    bpy.context.space_data.context = 'PARTICLES'\n    bpy.ops.object.particle_system_add()\n    bpy.data.particles[\"ParticleSettings\"].type = 'HAIR'\n    bpy.data.particles[\"ParticleSettings\"].render_type = 'OBJECT'\n    bpy.data.particles[\"ParticleSettings\"].count = 2000\n#    bpy.data.particles[\"ParticleSettings\"].dupli_object = bpy.data.objects[\"Mball\"]\n    bpy.data.particles[\"ParticleSettings\"].instance_object = bpy.data.objects[\"Mball\"]\n\n    bpy.data.particles[\"ParticleSettings\"].particle_size = 0.6\n    bpy.data.particles[\"ParticleSettings\"].name = \"DELETE\" # Senão não funciona, pois usa o nome anterior\n\n    \n    Guia = bpy.data.objects['Mball']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Guia.select_set(True)\n    bpy.context.view_layer.objects.active = Guia\n    bpy.context.object.name = \"CirGuide\"\n    \n    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 6 # antes 8 = muito pesado\n\n   \n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 20 # Antes 50 = muito arredondado para o 6\n\n    \n#    bpy.ops.object.modifier_add(type='DECIMATE')\n#    bpy.context.object.modifiers[\"Decimate\"].ratio = 0.1\n\n    GuiaCopia = bpy.data.objects['CirGuide.001']\n    bpy.ops.object.select_all(action='DESELECT')\n    GuiaCopia.select_set(True)\n    bpy.context.view_layer.objects.active = GuiaCopia\n    \n    \n    bpy.ops.object.convert(target='MESH')\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select_set(True)\n    bpy.context.view_layer.objects.active = Linha\n    bpy.ops.object.delete(use_global=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    GuiaCopia.select_set(True)\n    bpy.context.view_layer.objects.active = GuiaCopia\n\n\n\nclass DesenhaGuia(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desenha_guia\"\n    bl_label = \"Desenha_Guia\"\n    \n    def execute(self, context):\n        DesenhaGuiaDef(self, context)\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(DesenhaGuia)\n"
  },
  {
    "path": "DesenhaObjetos.py",
    "content": "import bpy\nimport fnmatch\nimport bmesh\nimport time\n\nfrom bpy.types import (Panel,\n                       Operator,\n                       AddonPreferences,\n                       PropertyGroup,\n                       )\n\nfrom mathutils import Matrix, Vector\nfrom bpy_extras.object_utils import AddObjectHelper, object_data_add\n\nfrom .ConfOsteotomiaAuto import *\n\n\ndef DesenhaGuiaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.gpencil.convert(type='PATH')\n\n    bpy.ops.gpencil.layer_remove()\n\n    # Adiciona MBall\n    bpy.ops.object.metaball_add(type='BALL', radius=1)\n\n    Linha = bpy.data.objects['GP_Layer']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select = True\n    bpy.context.scene.objects.active = Linha\n\n#    bpy.context.space_data.context = 'DATA'\n    bpy.context.object.data.fill_mode = 'FULL'\n    bpy.context.object.data.bevel_depth = 10\n\n    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].use_remove_disconnected = False\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 6\n\n    bpy.ops.object.convert(target='MESH')\n\n#    bpy.context.space_data.context = 'PARTICLES'\n    bpy.ops.object.particle_system_add()\n    bpy.data.particles[\"ParticleSettings\"].type = 'HAIR'\n    bpy.data.particles[\"ParticleSettings\"].render_type = 'OBJECT'\n    bpy.data.particles[\"ParticleSettings\"].count = 2000\n    bpy.data.particles[\"ParticleSettings\"].dupli_object = bpy.data.objects[\"Mball\"]\n    bpy.data.particles[\"ParticleSettings\"].particle_size = 0.6\n    bpy.data.particles[\"ParticleSettings\"].name = \"DELETE\" # Senão não funciona, pois usa o nome anterior\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select = True\n    bpy.context.scene.objects.active = Linha\n    bpy.ops.object.delete(use_global=False)\n\n    Guia = bpy.data.objects['Mball']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Guia.select = True\n    bpy.context.scene.objects.active = Guia\n    bpy.context.object.name = \"CirGuide\"\n\n    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 120\n\n    bpy.ops.object.modifier_add(type='DECIMATE')\n    bpy.context.object.modifiers[\"Decimate\"].ratio = 0.1\n\n\n    bpy.ops.object.convert(target='MESH')\n\n\ndef AcabamentoDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    GuiaParte = bpy.context.active_object\n\n    bpy.ops.gpencil.convert(type='PATH')\n    bpy.ops.gpencil.layer_remove()\n\n    Linha = bpy.data.objects['GP_Layer']\n#    Linha.select = True\n#    bpy.context.scene.objects.active = Linha\n#    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.select_all(action='DESELECT')\n    GuiaParte.select = True\n    Linha.select = True\n    bpy.context.scene.objects.active = GuiaParte\n\n    bpy.ops.object.corta_ossos()\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select = True\n    bpy.context.scene.objects.active = Linha\n    bpy.ops.object.delete(use_global=False)\n\n    ObjAcabamento = bpy.data.objects['OssoPronto']\n    bpy.ops.object.select_all(action='DESELECT')\n    ObjAcabamento.select = True\n    bpy.context.scene.objects.active = ObjAcabamento\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.ops.mesh.select_mode(type=\"EDGE\")\n\n    bpy.ops.mesh.select_non_manifold()\n    bpy.ops.mesh.select_non_manifold(use_non_contiguous=False)\n\n\n#    bpy.ops.object.triangle_fill(res_mode='MAX')\n\n\ndef FechaBuracoDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.triangle_fill(res_mode = 'MAX')\n\ndef DesenhaLinhaCorteDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    Osso = bpy.context.active_object\n    bpy.ops.object.collection_link(collection='Collection')\n\n    # Seleciona linha e converte em mesh\n\n    bpy.ops.gpencil.convert_old_files()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.convert(type='POLY', use_timing_data=True)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['Note']\n    linha.select_set(True)\n    # linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n\n\n\n    bpy.ops.object.convert(target='MESH')\n\n# Subdivide pois nessa versão a linha está simplificada\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.subdivide(quadcorner='INNERVERT')\n    bpy.ops.mesh.subdivide()\n    bpy.ops.mesh.remove_doubles() # Para juntar as partes separadas\n    bpy.ops.mesh.remove_doubles(threshold=2)\n    bpy.ops.mesh.subdivide()\n    bpy.ops.object.editmode_toggle()\n\n# Modificadores para ficar sobre a superfície\n    bpy.ops.object.modifier_add(type='SHRINKWRAP')\n#    bpy.context.object.modifiers[\"Shrinkwrap\"].use_keep_above_surface = True\n    bpy.context.object.modifiers[\"Shrinkwrap\"].wrap_mode = 'ABOVE_SURFACE'\n    bpy.context.object.modifiers[\"Shrinkwrap\"].target = Osso\n    bpy.context.object.modifiers[\"Shrinkwrap\"].offset = 1.5\n\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 1\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 1\n\n\n    bpy.ops.object.convert(target='MESH')\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='TOGGLE')\n    bpy.ops.mesh.remove_doubles()\n    bpy.ops.mesh.remove_doubles(threshold=2)\n\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.edge_face_add()\n#    bpy.ops.mesh.fill()\n\n    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={\"mirror\":False}, TRANSFORM_OT_shrink_fatten={\"value\":.5, \"use_even_offset\":False, \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.ops.mesh.select_non_manifold()\n\n    bpy.ops.mesh.edge_face_add()\n\n    bpy.ops.object.editmode_toggle()\n\n\n    bpy.context.object.name = \"Corte\"\n    Linha = bpy.data.objects['Corte']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select_set(True)\n    Osso.select_set(True)\n    bpy.context.view_layer.objects.active = Osso\n\n# Se não duplicar não funciona!\n#    bpy.ops.object.duplicate()\n\n\n    bpy.ops.object.booleana_osteo()\n\n    #Joga osso para copier\n    Osso.select_set(True)\n    bpy.context.view_layer.objects.active = Osso\n    bpy.ops.object.hide_view_set(unselected=False)\n#    bpy.ops.object.collection_link(collection='Copied_Objects')\n#    bpy.data.collections['Collection'].objects.unlink(Osso)\n\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n# Apaga os objetos anteriores\n#    bpy.ops.object.select_all(action='DESELECT')\n#    Linha.select_set(True)\n#    Osso.select_set(True)\n#    bpy.ops.object.delete(use_global=False)\n\n\n\nclass DesenhaLinhaCorte(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desenha_linha_corte\"\n    bl_label = \"Desenha Linha Corte\"\n\n    # ------------------------------\n    # Poll\n    # ------------------------------\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        DesenhaLinhaCorteDef(self, context)\n        return {'FINISHED'}\n\ndef DesenhaLinhaVertexDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    Osso = bpy.context.active_object\n# Renomeia para não dar erro\n    OssoNome = Osso.name\n    Osso.name = OssoNome+time.strftime(\"%Y%m%d%H%M%S\")\n    bpy.ops.object.collection_link(collection='Collection')\n    print(\"NOMEDADO\")\n\n\n    # Seleciona linha e converte em mesh\n\n    bpy.ops.gpencil.convert_old_files()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.convert(type='POLY', use_timing_data=True)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['Note']\n    linha.select_set(True)\n    # linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n\n\n\n    bpy.ops.object.convert(target='MESH')\n\n# Subdivide pois nessa versão a linha está simplificada\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.subdivide(quadcorner='INNERVERT')\n    bpy.ops.mesh.subdivide()\n    bpy.ops.mesh.remove_doubles() # Para juntar as partes separadas\n    bpy.ops.mesh.remove_doubles(threshold=2)\n    bpy.ops.mesh.subdivide()\n    bpy.ops.object.editmode_toggle()\n\n# Modificadores para ficar sobre a superfície\n    bpy.ops.object.modifier_add(type='SHRINKWRAP')\n#    bpy.context.object.modifiers[\"Shrinkwrap\"].use_keep_above_surface = True\n    bpy.context.object.modifiers[\"Shrinkwrap\"].wrap_mode = 'ABOVE_SURFACE'\n    bpy.context.object.modifiers[\"Shrinkwrap\"].target = Osso\n    bpy.context.object.modifiers[\"Shrinkwrap\"].offset = 1.5\n\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 1\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 1\n\n\n    bpy.ops.object.convert(target='MESH')\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='TOGGLE')\n    bpy.ops.mesh.remove_doubles()\n    bpy.ops.mesh.remove_doubles(threshold=2)\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n    bpy.context.object.name = \"Linha_\"+Osso.name\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\nclass DesenhaLinhaVertex(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desenha_linha_vertex\"\n    bl_label = \"Desenha Linha Corte\"\n\n    # ------------------------------\n    # Poll\n    # ------------------------------\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        DesenhaLinhaVertexDef(self, context)\n        return {'FINISHED'}\n\ndef DesenhaLinhaVertexFinDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    Linha = context.active_object\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n# É NECESSÁRIO SELECIONAR OS EDGES!!! NÃO OS VÉRTICES!\n#    mesh = bmesh.from_edit_mesh(Linha.data)\n#    for e in mesh.edges:\n#        e.select = True\n    # trigger viewport update\n#    bpy.context.scene.objects.active = bpy.context.scene.objects.active\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.edge_face_add()\n#    bpy.ops.mesh.fill()\n\n    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={\"mirror\":False}, TRANSFORM_OT_shrink_fatten={\"value\":.5, \"use_even_offset\":False, \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.ops.mesh.select_non_manifold()\n\n    bpy.ops.mesh.edge_face_add()\n\n    '''\n    bpy.ops.mesh.extrude_region()\n\n    bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={\"use_normal_flip\":False, \"mirror\":False}, TRANSFORM_OT_translate={\"value\":(1.81608e-08, .6, .6), \"orient_type\":'NORMAL', \"orient_matrix\":((0.238327, 0.958761, 0.154848), (0.00483444, -0.160612, 0.987006), (0.971173, -0.234481, -0.0429132)), \"orient_matrix_type\":'NORMAL', \"constraint_axis\":(False, False, True), \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"gpencil_strokes\":False, \"cursor_transform\":False, \"texture_space\":False, \"remove_on_cancel\":False, \"release_confirm\":False, \"use_accurate\":False})\n    '''\n    bpy.ops.object.editmode_toggle()\n\n\n    Osso = bpy.data.objects[str(Linha.name.strip(\"Linha_\"))]\n    print(\"OSSSOOO\", Osso)\n\n\n    bpy.context.object.name = \"Corte\"\n\n#    OssoNome = Osso.name\n#    Osso.name = OssoNome+time.strftime(\"%Y%m%d%H%M%S\")\n#    print(\"NOMEDADO\")\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select_set(True)\n    Osso.select_set(True)\n    bpy.context.view_layer.objects.active = Osso\n\n# Se não duplicar não funciona!\n#    bpy.ops.object.duplicate()\n\n\n    bpy.ops.object.booleana_osteo()\n\n# Apaga os objetos anteriores\n    bpy.ops.object.select_all(action='DESELECT')\n    Linha.select_set(True)\n    Osso.select_set(True)\n    bpy.ops.object.delete(use_global=False)\n\n\nclass DesenhaLinhaVertexFin(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desenha_linha_vertex_fin\"\n    bl_label = \"Desenha Linha Corte\"\n\n    def execute(self, context):\n        DesenhaLinhaVertexFinDef(self, context)\n        return {'FINISHED'}\n\ndef LinhaCorteDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n#   bpy.context.scene.tool_settings.gpencil_stroke_placement_view3d = 'SURFACE'\n#    bpy.ops.gpencil.convert(type='POLY', timing_mode='LINEAR', use_timing_data=False)\n#    bpy.ops.gpencil.draw('INVOKE_DEFAULT', mode=\"DRAW_POLY\")\n    #bpy.ops.gpencil.annotate(mode=\"DRAW_POLY\")\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.annotate_polygon\") # Capturar direto dos botões da interface\n    bpy.context.scene.tool_settings.annotation_stroke_placement_view3d = 'SURFACE'\n\n\n\nclass LinhaCorte(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.linha_corte\"\n    bl_label = \"Desenha Linha Corte\"\n\n    # ------------------------------\n    # Poll\n    # ------------------------------\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        LinhaCorteDef(self, context)\n        return {'FINISHED'}\n\ndef LinhaCorteForaaForaDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n#   bpy.context.scene.tool_settings.gpencil_stroke_placement_view3d = 'SURFACE'\n#    bpy.ops.gpencil.convert(type='POLY', timing_mode='LINEAR', use_timing_data=False)\n#    bpy.ops.gpencil.draw('INVOKE_DEFAULT', mode=\"DRAW_POLY\")\n    #bpy.ops.gpencil.annotate(mode=\"DRAW_POLY\")\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.annotate_polygon\") # Capturar direto dos botões da interface\n    bpy.context.scene.tool_settings.annotation_stroke_placement_view3d = 'CURSOR'\n\n\n\nclass LinhaCorteForaaFora(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.linha_corte_fora_a_fora\"\n    bl_label = \"Desenha Linha Corte\"\n\n    # ------------------------------\n    # Poll\n    # ------------------------------\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        LinhaCorteForaaForaDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(LinhaCorteForaaFora)\n\n# Modal\n\nclass ModalTimerOperator(bpy.types.Operator):\n    \"\"\"Operator which runs its self from a timer\"\"\"\n    bl_idname = \"wm.modal_cria_pontos\"\n    bl_label = \"Create points line\"\n\n    _timer = None\n\n    def modal(self, context, event):\n\n        context = bpy.context\n        obj = context.active_object\n\n        context.view_layer.active_layer_collection = context.view_layer.layer_collection.children[0]\n\n        bpy.ops.wm.tool_set_by_id(name=\"builtin.cursor\")\n\n\n        if event.type in {'RIGHTMOUSE', 'ESC'}:\n            self.cancel(context)\n            return {'CANCELLED'}\n\n#        bpy.ops.object.select_pattern(pattern=\"Cub*\") # Seleciona objetos com esse padrão\n\n\n        if event.type == 'LEFTMOUSE' and event.value == 'RELEASE':\n\n\n            if context.area.type == 'VIEW_3D':\n                region = context.region\n                r3d = context.space_data.region_3d\n\n#                bpy.ops.object.empty_add(type='PLAIN_AXES', radius=1, location=(0,0,0))\n\n                bpy.ops.mesh.primitive_uv_sphere_add(radius=0.7, location=(0,0,0)) #Atrasa também\n                bpy.ops.transform.translate(value=(bpy.context.scene.cursor.location))\n                bpy.context.object.name = \"PT_Linha\"\n\n                ListaMateriais = []\n                MateriaisCena = bpy.data.materials\n\n                for i in MateriaisCena:\n                    ListaMateriais.append(i.name)\n\n                if 'MatModalPoints' in ListaMateriais:\n                    activeObject = bpy.context.active_object #Set active object to variable\n                    mat = bpy.data.materials[\"MatModalPoints\"] #set new material to variable\n                    activeObject.data.materials.append(mat) #add the material to the object\n                    bpy.context.object.active_material.diffuse_color = (0.2, 0.9, 0.2, 1)\n                else:\n                    activeObject = bpy.context.active_object #Set active object to variable\n                    mat = bpy.data.materials.new(name=\"MatModalPoints\") #set new material to variable\n                    activeObject.data.materials.append(mat) #add the material to the object\n                    bpy.context.object.active_material.diffuse_color = (0.2, 0.9, 0.2, 1)\n\n                bpy.ops.object.select_all(action='DESELECT')\n\n\n                obj.select_set(True)\n                bpy.context.view_layer.objects.active = obj\n\n\n        return {'PASS_THROUGH'}\n\n    def execute(self, context):\n\n        try:\n            PontosDel = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n            for i in PontosDel:\n                i.name = 'del'\n\n        except:\n            print(\"Não conta nenhum ponto PT_Linha!\")\n\n        # Torna Collection active\n        context.view_layer.active_layer_collection = context.view_layer.layer_collection.children[0]\n\n        if context.area.type != 'VIEW_3D':\n            print(\"Must use in a 3d region\")\n            return {'CANCELLED'}\n\n        wm = context.window_manager\n        wm.modal_handler_add(self)\n        return {'RUNNING_MODAL'}\n\n    def cancel(self, context):\n        wm = context.window_manager\n\n    def end_ui(self, context):\n        context.area.header_text_set()\n        context.window.cursor_modal_restore()\n\n    def cleanup(self, context, cleantype=''):\n        '''\n        remove temporary object\n        '''\n        if cleantype == 'commit':\n            pass\n\n        elif cleantype == 'cancel':\n            pass\n\nbpy.utils.register_class(ModalTimerOperator)\n\ndef CriaLinhaPontosDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    Pontos = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n    vertices = []\n\n    for i in Pontos:\n        VetorAtual = i.location\n        VetX = i.location[0]\n        VetY = i.location[1]\n        VetZ = i.location[2]\n        vertices.append((VetX, VetY, VetZ))\n\n    edges = []\n\n    for i in range(len(vertices)):\n        edges.append([i,i+1])\n\n    del(edges[-1]) # Apaga o último elemento da cena\n\n    faces = []\n\n\n    mesh = bpy.data.meshes.new(name=\"LineSolid\")\n    mesh.from_pydata(vertices, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\n    bpy.context.object.location = 0,0,0\n\n    bpy.ops.object.convert(target='CURVE')\n\n    bpy.context.object.data.fill_mode = 'FULL'\n    bpy.context.object.data.bevel_depth = 0.915\n    bpy.context.object.data.bevel_resolution = 7\n\n\nclass CriaLinhaPontos(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_linha_pontos\"\n    bl_label = \"Create Points Line\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaLinhaPontosDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaLinhaPontos)\n\n#-----------------\n\n#Pontos veia\n\ndef CriaPontoVeiaDef():\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0,0,0)) #Atrasa também\n    bpy.ops.transform.translate(value=(bpy.context.scene.cursor.location))\n    bpy.context.object.name = \"PT_Linha\"\n\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n\n    if 'MatModalPoints' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatModalPointsTeeth\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.2, 0.2, 0.9, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatModalPointsTeeth\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.2, 0.2, 0.9, 1)\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    try:\n        obj.select_set(True)\n        bpy.context.view_layer.objects.active = obj\n    except:\n        print(\"Não há objeto selecionado!\")\n\n\nclass CriaPontoVeia(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_ponto_veia\"\n    bl_label = \"Create Vein Point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaPontoVeiaDef()\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaPontoVeia)\n\n\n# Bezier veia\n\ndef CriaBezierVeiaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    Pontos = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n    coords = []\n\n    for i in Pontos:\n        VetorAtual = i.location\n        VetX = i.location[0]\n        VetY = i.location[1]\n        VetZ = i.location[2]\n        coords.append((VetX, VetY, VetZ))\n\n#    edges = []\n\n#    for i in range(len(vertices)):\n#        edges.append([i,i+1])\n\n#    del(edges[-1]) # Apaga o último elemento da cena\n\n\n    # create the Curve Datablock\n    curveData = bpy.data.curves.new('myCurve', type='CURVE')\n    curveData.dimensions = '3D'\n    curveData.resolution_u = 6\n\n    # map coords to spline\n    polyline = curveData.splines.new('BEZIER')\n    polyline.bezier_points.add(len(coords)-1)\n#    for i, coord in enumerate(coords):\n#        x,y,z = coord\n#        polyline.points[i].co = (x, y, z, 1)\n\n    from bpy_extras.io_utils import unpack_list\n    polyline.bezier_points.foreach_set(\"co\", unpack_list(coords))\n\n    # Apaga pontos\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for i in Pontos:\n        i.select_set(True)\n\n    bpy.ops.object.delete(use_global=False)\n\n\n\n    # Cria Linha\n    curveOB = bpy.data.objects.new('myCurve', curveData)\n\n    # attach to scene and validate context\n    scn = bpy.context.scene\n#   scn.objects.link(curveOB)\n    scn.collection.objects.link(curveOB)\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = curveOB\n    curveOB.select_set(True)\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.curve.select_all(action='SELECT')\n    bpy.ops.curve.handle_type_set(type='AUTOMATIC')\n    bpy.ops.object.editmode_toggle()\n\n    bpy.context.object.data.bevel_depth = 1.6\n\n\n#    obj = context.active_object\n    bpy.ops.object.collection_link(collection='Collection')\n    bpy.ops.object.move_to_collection(collection_index=1)\n#    bpy.data.collections['Scene Collection'].objects.unlink(obj)\n\n\n    CriaMaterialOsteotomia(\"VeinNerve\", 1, 0, 0)\n\n#    bpy.context.object.location = 0,0,0\n\nclass CriaBezierVeia(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_curva_bezier_veia\"\n    bl_label = \"Create Bezier Vein\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaBezierVeiaDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaBezierVeia)\n\n\n#-----------------\n\ndef CriaBezierDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    Pontos = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n    coords = []\n\n    for i in Pontos:\n        VetorAtual = i.location\n        VetX = i.location[0]\n        VetY = i.location[1]\n        VetZ = i.location[2]\n        coords.append((VetX, VetY, VetZ))\n\n#    edges = []\n\n#    for i in range(len(vertices)):\n#        edges.append([i,i+1])\n\n#    del(edges[-1]) # Apaga o último elemento da cena\n\n\n    # create the Curve Datablock\n    curveData = bpy.data.curves.new('myCurve', type='CURVE')\n    curveData.dimensions = '3D'\n    curveData.resolution_u = 6\n\n    # map coords to spline\n    polyline = curveData.splines.new('BEZIER')\n    polyline.bezier_points.add(len(coords)-1)\n#    for i, coord in enumerate(coords):\n#        x,y,z = coord\n#        polyline.points[i].co = (x, y, z, 1)\n\n    from bpy_extras.io_utils import unpack_list\n    polyline.bezier_points.foreach_set(\"co\", unpack_list(coords))\n\n    # Apaga pontos\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for i in Pontos:\n        i.select_set(True)\n\n    bpy.ops.object.delete(use_global=False)\n\n\n\n    # Cria Linha\n    curveOB = bpy.data.objects.new('myCurve', curveData)\n\n    # attach to scene and validate context\n    scn = bpy.context.scene\n#   scn.objects.link(curveOB)\n    scn.collection.objects.link(curveOB)\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = curveOB\n    curveOB.select_set(True)\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.curve.select_all(action='SELECT')\n    bpy.ops.curve.handle_type_set(type='AUTOMATIC')\n    bpy.ops.object.editmode_toggle()\n\n    bpy.context.object.data.bevel_depth = 5.5\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 6\n    bpy.context.object.modifiers[\"Remesh\"].scale = 0.99\n\n#    obj = context.active_object\n    bpy.ops.object.collection_link(collection='Collection')\n    bpy.ops.object.move_to_collection(collection_index=1)\n#    bpy.data.collections['Scene Collection'].objects.unlink(obj)\n\n\n#    bpy.context.object.location = 0,0,0\n\nclass CriaBezier(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_curva_bezier\"\n    bl_label = \"Create Points Line 2\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaBezierDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaBezier)\n\ndef CriaBezierUnidoDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    Pontos = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n    coords = []\n\n    for i in Pontos:\n        VetorAtual = i.location\n        VetX = i.location[0]\n        VetY = i.location[1]\n        VetZ = i.location[2]\n        coords.append((VetX, VetY, VetZ))\n\n#    edges = []\n\n#    for i in range(len(vertices)):\n#        edges.append([i,i+1])\n\n#    del(edges[-1]) # Apaga o último elemento da cena\n\n\n    # create the Curve Datablock\n    curveData = bpy.data.curves.new('myCurve', type='CURVE')\n    curveData.dimensions = '3D'\n#    curveData.resolution_u = 6\n    curveData.resolution_u = 36\n\n\n    # map coords to spline\n    polyline = curveData.splines.new('BEZIER')\n    polyline.bezier_points.add(len(coords)-1)\n#    for i, coord in enumerate(coords):\n#        x,y,z = coord\n#        polyline.points[i].co = (x, y, z, 1)\n\n    from bpy_extras.io_utils import unpack_list\n    polyline.bezier_points.foreach_set(\"co\", unpack_list(coords))\n\n    # Apaga pontos\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for i in Pontos:\n        i.select_set(True)\n\n    bpy.ops.object.delete(use_global=False)\n\n\n\n    # Cria Linha\n    curveOB = bpy.data.objects.new('myCurve', curveData)\n\n    # attach to scene and validate context\n    scn = bpy.context.scene\n#   scn.objects.link(curveOB)\n    scn.collection.objects.link(curveOB)\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = curveOB\n    curveOB.select_set(True)\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.curve.select_all(action='SELECT')\n    bpy.ops.curve.handle_type_set(type='AUTOMATIC')\n\n    bpy.ops.curve.make_segment()\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.modifier_add(type='SHRINKWRAP')\n    bpy.context.object.modifiers[\"Shrinkwrap\"].target = obj\n    bpy.context.object.modifiers[\"Shrinkwrap\"].offset = 0.01\n    bpy.context.object.modifiers[\"Shrinkwrap\"].wrap_mode = 'ABOVE_SURFACE'\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.context.space_data.overlay.show_curve_normals = False\n    bpy.context.space_data.overlay.show_curve_handles = False\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n\nclass CriaBezierUnido(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_curva_bezier_unido\"\n    bl_label = \"Create Points Line 2\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaBezierUnidoDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaBezierUnido)\n\ndef BezierCortaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='DESELECT')\n    bpy.ops.object.editmode_toggle()\n\n    objInicial = obj.name\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['myCurve'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['myCurve']\n\n    bpy.context.object.modifiers[\"Shrinkwrap\"].offset = 0\n\n    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    context = bpy.context\n    obj = context.active_object\n    bm = bmesh.from_edit_mesh(obj.data)\n    vertices = bm.verts\n    edges = bm.verts\n\n    VertIndexOrigi = []\n\n    for i in edges:\n        print(i.index)\n        VertIndexOrigi.append(i.index)\n\n    print(\"VertIndexOrigi:\", VertIndexOrigi)\n\n    # Extruda para dentro\n    bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={\"use_normal_flip\":False, \"mirror\":False}, TRANSFORM_OT_translate={\"value\":(0, 0, 0), \"orient_type\":'GLOBAL', \"orient_matrix\":((0, 0, 0), (0, 0, 0), (0, 0, 0)), \"orient_matrix_type\":'GLOBAL', \"constraint_axis\":(False, False, False), \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"gpencil_strokes\":False, \"cursor_transform\":False, \"texture_space\":False, \"remove_on_cancel\":False, \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    for i in VertIndexOrigi:\n    #    print(vertices)\n\n        # É necessário fazer isso senão não seleciona e dá erro!\n        if hasattr(bm.edges, \"ensure_lookup_table\"):\n            bm.edges.ensure_lookup_table()\n\n        bm.edges[i].select_set(True)\n\n    # Extruda para fora\n    bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={\"use_normal_flip\":False, \"mirror\":False}, TRANSFORM_OT_translate={\"value\":(0, 0, 0), \"orient_type\":'GLOBAL', \"orient_matrix\":((0, 0, 0), (0, 0, 0), (0, 0, 0)), \"orient_matrix_type\":'GLOBAL', \"constraint_axis\":(False, False, False), \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"gpencil_strokes\":False, \"cursor_transform\":False, \"texture_space\":False, \"remove_on_cancel\":False, \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.transform.resize(value=(1.1, 1.1, 1.1), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    for i in VertIndexOrigi:\n    #    print(vertices)\n\n        # É necessário fazer isso senão não seleciona e dá erro!\n        if hasattr(bm.edges, \"ensure_lookup_table\"):\n            bm.edges.ensure_lookup_table()\n\n        bm.edges[i].select_set(True)\n\n    # Apaga vértices do meio e une as outras\n    bpy.ops.mesh.delete(type='VERT')\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.bridge_edge_loops()\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.data.objects[objInicial].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects[objInicial]\n\n\n    bpy.ops.object.join()\n\n    obj = context.active_object\n\n    bpy.ops.object.editmode_toggle()\n\n\n    bm2 = bmesh.from_edit_mesh(obj.data)\n    vertices2 = bm2.verts\n    edges2 = bm2.edges\n\n    VertIndexOrigi2 = []\n\n    for i in vertices2:\n        if i.select == True:\n            print(i.index)\n            VertIndexOrigi2.append(i.index)\n\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.intersect()\n    bpy.ops.mesh.intersect(mode='SELECT')\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n\n    for i in VertIndexOrigi2:\n    #    print(vertices)\n\n        # É necessário fazer isso senão não seleciona e dá erro!\n        if hasattr(bm2.verts, \"ensure_lookup_table\"):\n            bm2.verts.ensure_lookup_table()\n\n        bm2.verts[i].select_set(True)\n\n    bpy.ops.mesh.delete(type='VERT')\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.mesh.separate(type='LOOSE')\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n\n\nclass BezierCorta(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.bezier_corta\"\n    bl_label = \"Create Points Line 2\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        BezierCortaDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(BezierCorta)\n\ndef BezierCortaDuplaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='DESELECT')\n    bpy.ops.object.editmode_toggle()\n\n    objInicial = obj.name\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['myCurve'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['myCurve']\n\n    bpy.ops.object.convert(target='MESH')\n\n    # Revoncerte em linha\n    bpy.ops.object.convert(target='CURVE')\n    bpy.context.object.data.bevel_depth = 0.5\n\n    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='SELECT')\n\n\n    # Cria vertex group\n\n    objeto = bpy.data.objects['myCurve']\n    vg = objeto.vertex_groups.new(name=\"Apagar\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n\n\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.join()\n\n    bpy.ops.object.editmode_toggle()\n\n    context = bpy.context\n    obj = context.active_object\n\n\n    bpy.data.objects[objInicial].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects[objInicial]\n\n\n    bpy.ops.object.join()\n\n    # Corta\n    bpy.ops.object.editmode_toggle()\n\n\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.intersect(mode='SELECT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n# --------\n\n    groupName = 'Apagar'\n\n\n    obj = bpy.context.view_layer.objects.active\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n    bpy.ops.object.vertex_group_set_active(group=groupName)\n    bpy.ops.object.vertex_group_select()\n\n    bpy.ops.mesh.delete(type='VERT')\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.mesh.separate(type='LOOSE')\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n\n\nclass BezierCortaDupla(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.bezier_corta_dupla\"\n    bl_label = \"Create Points Line 2\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        BezierCortaDuplaDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(BezierCortaDupla)\n\n\n# MODAL SEPARA DENTES\n\nclass ModalTimerOperatorTeeth(bpy.types.Operator):\n    \"\"\"Operator which runs its self from a timer\"\"\"\n    bl_idname = \"wm.modal_cria_pontos_teeth\"\n    bl_label = \"Create points line on teeth\"\n\n    _timer = None\n\n    def modal(self, context, event):\n\n        context = bpy.context\n        obj = context.active_object\n\n        bpy.ops.wm.tool_set_by_id(name=\"builtin.cursor\")\n\n        if event.type in {'RIGHTMOUSE', 'ESC'}:\n            self.cancel(context)\n            return {'CANCELLED'}\n\n#        bpy.ops.object.select_pattern(pattern=\"Cub*\") # Seleciona objetos com esse padrão\n\n\n        if event.type == 'LEFTMOUSE' and event.value == 'RELEASE':\n\n\n            if context.area.type == 'VIEW_3D':\n                region = context.region\n                r3d = context.space_data.region_3d\n\n#                bpy.ops.object.empty_add(type='PLAIN_AXES', radius=1, location=(0,0,0))\n\n                bpy.ops.mesh.primitive_uv_sphere_add(radius=0.2, location=(0,0,0)) #Atrasa também\n                bpy.ops.transform.translate(value=(bpy.context.scene.cursor.location))\n                bpy.context.object.name = \"PT_Linha\"\n\n                ListaMateriais = []\n                MateriaisCena = bpy.data.materials\n\n                for i in MateriaisCena:\n                    ListaMateriais.append(i.name)\n\n                if 'MatModalPoints' in ListaMateriais:\n                    activeObject = bpy.context.active_object #Set active object to variable\n                    mat = bpy.data.materials[\"MatModalPointsTeeth\"] #set new material to variable\n                    activeObject.data.materials.append(mat) #add the material to the object\n                    bpy.context.object.active_material.diffuse_color = (0.2, 0.2, 0.9, 1)\n                else:\n                    activeObject = bpy.context.active_object #Set active object to variable\n                    mat = bpy.data.materials.new(name=\"MatModalPointsTeeth\") #set new material to variable\n                    activeObject.data.materials.append(mat) #add the material to the object\n                    bpy.context.object.active_material.diffuse_color = (0.2, 0.2, 0.9, 1)\n\n                bpy.ops.object.select_all(action='DESELECT')\n\n\n                obj.select_set(True)\n                bpy.context.view_layer.objects.active = obj\n\n\n        return {'PASS_THROUGH'}\n\n    def execute(self, context):\n        if context.area.type != 'VIEW_3D':\n            print(\"Must use in a 3d region\")\n            return {'CANCELLED'}\n\n        wm = context.window_manager\n        wm.modal_handler_add(self)\n        return {'RUNNING_MODAL'}\n\n    def cancel(self, context):\n        wm = context.window_manager\n\n    def end_ui(self, context):\n        context.area.header_text_set()\n        context.window.cursor_modal_restore()\n\n    def cleanup(self, context, cleantype=''):\n        '''\n        remove temporary object\n        '''\n        if cleantype == 'commit':\n            pass\n\n        elif cleantype == 'cancel':\n            pass\n\nbpy.utils.register_class(ModalTimerOperatorTeeth)\n\n\ndef CriaBezierUnidoTeethDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    Pontos = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n    coords = []\n\n    for i in Pontos:\n        VetorAtual = i.location\n        VetX = i.location[0]\n        VetY = i.location[1]\n        VetZ = i.location[2]\n        coords.append((VetX, VetY, VetZ))\n\n#    edges = []\n\n#    for i in range(len(vertices)):\n#        edges.append([i,i+1])\n\n#    del(edges[-1]) # Apaga o último elemento da cena\n\n\n    # create the Curve Datablock\n    curveData = bpy.data.curves.new('myCurve', type='CURVE')\n    curveData.dimensions = '3D'\n#    curveData.resolution_u = 6\n    curveData.resolution_u = 36\n\n\n    # map coords to spline\n    polyline = curveData.splines.new('BEZIER')\n    polyline.bezier_points.add(len(coords)-1)\n#    for i, coord in enumerate(coords):\n#        x,y,z = coord\n#        polyline.points[i].co = (x, y, z, 1)\n\n    from bpy_extras.io_utils import unpack_list\n    polyline.bezier_points.foreach_set(\"co\", unpack_list(coords))\n\n    # Apaga pontos\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for i in Pontos:\n        i.select_set(True)\n\n    bpy.ops.object.delete(use_global=False)\n\n\n\n    # Cria Linha\n    curveOB = bpy.data.objects.new('myCurve', curveData)\n\n    # attach to scene and validate context\n    scn = bpy.context.scene\n#   scn.objects.link(curveOB)\n    scn.collection.objects.link(curveOB)\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = curveOB\n    curveOB.select_set(True)\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.curve.select_all(action='SELECT')\n    bpy.ops.curve.handle_type_set(type='AUTOMATIC')\n\n    bpy.ops.curve.make_segment()\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.modifier_add(type='SHRINKWRAP')\n    bpy.context.object.modifiers[\"Shrinkwrap\"].target = obj\n    bpy.context.object.modifiers[\"Shrinkwrap\"].offset = 0.01 # ORIGINAL 0.01\n    bpy.context.object.modifiers[\"Shrinkwrap\"].wrap_mode = 'ABOVE_SURFACE'\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Shrinkwrap\")\n\n#    bpy.ops.object.modifier_add(type='SMOOTH')\n#    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n#    bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n\n\n    bpy.context.object.data.bevel_depth = 0.2\n\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatModalPoints' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatModalPointsTeeth\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.2, 0.2, 0.9, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatModalPointsTeeth\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.2, 0.2, 0.9, 1)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n\nclass CriaBezierUnidoTeeth(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_curva_bezier_unido_teeth\"\n    bl_label = \"Create Points Line Teeth\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaBezierUnidoTeethDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaBezierUnidoTeeth)\n\ndef BezierCortaDuplaTeethDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='DESELECT')\n    bpy.ops.object.editmode_toggle()\n\n    objInicial = obj.name\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['myCurve'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['myCurve']\n\n    bpy.ops.object.convert(target='MESH')\n\n    # Revoncerte em linha\n#    bpy.ops.object.convert(target='CURVE')\n#    bpy.context.object.data.bevel_depth = 0.5\n\n#    bpy.ops.object.convert(target='MESH')\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='SELECT')\n\n\n    # Cria vertex group\n\n    objeto = bpy.data.objects['myCurve']\n    vg = objeto.vertex_groups.new(name=\"Apagar\")\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.object.vertex_group_assign()\n\n\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.join()\n\n    bpy.ops.object.editmode_toggle()\n\n    context = bpy.context\n    obj = context.active_object\n\n\n    bpy.data.objects[objInicial].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects[objInicial]\n\n\n    bpy.ops.object.join()\n\n    # Corta\n    bpy.ops.object.editmode_toggle()\n\n\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.intersect(mode='SELECT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n# --------\n\n    groupName = 'Apagar'\n\n\n    obj = bpy.context.view_layer.objects.active\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n    bpy.ops.object.vertex_group_set_active(group=groupName)\n    bpy.ops.object.vertex_group_select()\n\n    bpy.ops.mesh.delete(type='VERT')\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.mesh.separate(type='LOOSE')\n\n    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n\n\n    # Centralizar origem\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n\n\nclass BezierCortaDuplaTeeth(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.bezier_corta_dupla_teeth\"\n    bl_label = \"Create Points Line Teeth \"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        BezierCortaDuplaTeethDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(BezierCortaDuplaTeeth)\n\ndef PreparaMalhaCorteDef(self, context):\n    bpy.ops.object.prepara_impressao_3d()\n    bpy.context.object.modifiers[\"Remesh\"].use_remove_disconnected = False\n#    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 9\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Remesh\")\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_mode(type=\"EDGE\")\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n\n\nclass PreparaMalhaCorte(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.prepara_malha_corte\"\n    bl_label = \"Prepare Mesh to Cut\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        PreparaMalhaCorteDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(PreparaMalhaCorte)\n\n'''\ndef CortaMalhaKnifeDef(self, context):\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_mode(type=\"EDGE\")\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n#    bpy.ops.mesh.knife_tool()\n    print(\"AQUIII 1\")\n    bpy.ops.mesh.knife_tool()\n    print(\"AQUII 2\")\n\nclass CortaMalhaKnife(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.corta_malha_knife\"\n    bl_label = \"Knife Cut\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CortaMalhaKnifeDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CortaMalhaKnife)\n'''\n\ndef SeparaEdgeSplitDef(self, context):\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.edge_split()\n    bpy.ops.mesh.select_mode(type=\"EDGE\")\n    bpy.ops.mesh.select_all(action = 'SELECT')\n    bpy.ops.mesh.separate(type='LOOSE')\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n\nclass SeparaEdgeSplit(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.separa_edge_split\"\n    bl_label = \"Edge Split Teeth Separation\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        SeparaEdgeSplitDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(SeparaEdgeSplit)\n\n# Modal cria pontos microscopio\n\nclass ModalTimerOperatorMicros(bpy.types.Operator):\n    \"\"\"Operator which runs its self from a timer\"\"\"\n    bl_idname = \"wm.modal_cria_pontos_micros\"\n    bl_label = \"Create points line microscope\"\n\n    _timer = None\n\n    def modal(self, context, event):\n\n        context = bpy.context\n        obj = context.active_object\n\n        context.view_layer.active_layer_collection = context.view_layer.layer_collection.children[0]\n\n        bpy.ops.wm.tool_set_by_id(name=\"builtin.cursor\")\n\n\n        if event.type in {'RIGHTMOUSE', 'ESC'}:\n            self.cancel(context)\n            return {'CANCELLED'}\n\n#        bpy.ops.object.select_pattern(pattern=\"Cub*\") # Seleciona objetos com esse padrão\n\n\n        if event.type == 'LEFTMOUSE' and event.value == 'RELEASE':\n\n\n            if context.area.type == 'VIEW_3D':\n                region = context.region\n                r3d = context.space_data.region_3d\n\n#                bpy.ops.object.empty_add(type='PLAIN_AXES', radius=1, location=(0,0,0))\n\n                bpy.ops.mesh.primitive_uv_sphere_add(radius=0.05, location=(0,0,0)) #Atrasa também\n                bpy.ops.transform.translate(value=(bpy.context.scene.cursor.location))\n                bpy.context.object.name = \"PT_Linha\"\n\n                ListaMateriais = []\n                MateriaisCena = bpy.data.materials\n\n                for i in MateriaisCena:\n                    ListaMateriais.append(i.name)\n\n                if 'MatModalPoints' in ListaMateriais:\n                    activeObject = bpy.context.active_object #Set active object to variable\n                    mat = bpy.data.materials[\"MatModalPoints\"] #set new material to variable\n                    activeObject.data.materials.append(mat) #add the material to the object\n                    bpy.context.object.active_material.diffuse_color = (0.2, 0.9, 0.2, 1)\n                else:\n                    activeObject = bpy.context.active_object #Set active object to variable\n                    mat = bpy.data.materials.new(name=\"MatModalPoints\") #set new material to variable\n                    activeObject.data.materials.append(mat) #add the material to the object\n                    bpy.context.object.active_material.diffuse_color = (0.2, 0.9, 0.2, 1)\n\n                bpy.ops.object.select_all(action='DESELECT')\n\n\n                obj.select_set(True)\n                bpy.context.view_layer.objects.active = obj\n\n\n        return {'PASS_THROUGH'}\n\n    def execute(self, context):\n\n        try:\n            PontosDel = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"PT_Linh*\")]\n\n            for i in PontosDel:\n                i.name = 'del'\n\n        except:\n            print(\"Não conta nenhum ponto PT_Linha!\")\n\n        # Torna Collection active\n        context.view_layer.active_layer_collection = context.view_layer.layer_collection.children[0]\n\n        if context.area.type != 'VIEW_3D':\n            print(\"Must use in a 3d region\")\n            return {'CANCELLED'}\n\n        wm = context.window_manager\n        wm.modal_handler_add(self)\n        return {'RUNNING_MODAL'}\n\n    def cancel(self, context):\n        wm = context.window_manager\n\n    def end_ui(self, context):\n        context.area.header_text_set()\n        context.window.cursor_modal_restore()\n\n    def cleanup(self, context, cleantype=''):\n        '''\n        remove temporary object\n        '''\n        if cleantype == 'commit':\n            pass\n\n        elif cleantype == 'cancel':\n            pass\n\nbpy.utils.register_class(ModalTimerOperatorMicros)\n"
  },
  {
    "path": "DinamicaMole.py",
    "content": "import bpy\nimport bmesh\nfrom mathutils import Matrix # Deformação do nariz\n\ndef AreasInfluenciaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n    obj.name = \"SoftTissueDynamic\"\n\n\n    #vg = obj.vertex_groups.new(name=slot.material.name)\n    bpy.ops.object.mode_set(mode='EDIT')\n#    bpy.ops.object.editmode_toggle()\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n    for v in mesh.verts:\n        v.select = True\n\n\n    # CORPO MANDÍBULA\n\n    vg = obj.vertex_groups.new(name=\"cm\")\n\n    scn.tool_settings.vertex_group_weight=0\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    # MAXILA\n\n    vg = obj.vertex_groups.new(name=\"ma\")\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    # MENTO\n\n    vg = obj.vertex_groups.new(name=\"me\")\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    # CABEÇA\n\n    vg = obj.vertex_groups.new(name=\"ca\")\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    # RAMO DIREITO\n\n    vg = obj.vertex_groups.new(name=\"rd\")\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    # RAMO ESQUERDO\n\n    vg = obj.vertex_groups.new(name=\"re\")\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    # FRENTE\n\n    vg = obj.vertex_groups.new(name=\"frente\")\n\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.vertex_group_assign()\n\n\n    bpy.ops.object.mode_set(mode='OBJECT') # Depois de fazer tudo voltar ao modo de Objeto\n\nclass AreasInfluencia(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.areas_influencia\"\n    bl_label = \"Áreas de Influência - Dinâmica de Tecidos Moles\"\n\n    def execute(self, context):\n        AreasInfluenciaDef(self, context)\n        return {'FINISHED'}\n\n\n# CRIA ÁREA DE DEFORMAÇÃO\n\ndef CriaAreasDeformacaoDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"me\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"me\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist =30\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 12 #3\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'SHARP'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Mento\"\n    bpy.context.object.modifiers[\"Mento\"].show_expanded = False\n\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"cm\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"cm\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 20\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 11\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'LINEAR'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Corpo Mandibula\"\n    bpy.context.object.modifiers[\"Corpo Mandibula\"].show_expanded = False\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"re\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"re\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 35\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 12\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'SHARP'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Ramo Esquerdo\"\n    bpy.context.object.modifiers[\"Ramo Esquerdo\"].show_expanded = False\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"rd\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"rd\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 35\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 12\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'SHARP'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Ramo Direito\"\n    bpy.context.object.modifiers[\"Ramo Direito\"].show_expanded = False\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"ma\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"ma\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 37\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 9.5\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'SHARP'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Maxila\"\n    bpy.context.object.modifiers[\"Maxila\"].show_expanded = False\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"ca\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"ca\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 90\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 0\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'SHARP'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Cabeça\"\n    bpy.context.object.modifiers[\"Cabeça\"].show_expanded = False\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"frente\"\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].target = bpy.data.objects[\"ma\"]\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist = 40\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = 20\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'LINEAR'\n    bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"Frente\"\n    bpy.context.object.modifiers[\"Maxila\"].show_expanded = False\n\nclass CriaAreasDeformacao(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_areas_deformacao\"\n    bl_label = \"Cria Areas Deformação\"\n\n    def execute(self, context):\n        CriaAreasDeformacaoDef(self, context)\n        return {'FINISHED'}\n\n# CONFIGURA DINÂMICA MOLE\n\ndef ConfiguraDinamicaMoleDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.areas_influencia()\n    bpy.ops.object.cria_areas_deformacao()\n\n    bpy.ops.object.convert(target='MESH')\n\n    #    a = bpy.data.objects['FaceMalha.001']\n    armatureHead = bpy.data.objects['Armature_Head']\n\n    armatureHead.hide_viewport=False\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = armatureHead\n    obj.select_set(True)\n    bpy.data.objects['Armature_Head'].select_set(True)\n    bpy.ops.object.parent_set(type='ARMATURE_NAME')\n\n    armatureHead.hide_viewport=True\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n#    faceMalha = bpy.data.objects['FaceMalha.001']\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n    bpy.context.object.modifiers[\"Smooth\"].vertex_group = \"frente\"\n\n\ndef CursorParaSelecao():\n    context = bpy.context\n\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            ctx = bpy.context.copy()\n            ctx['area'] = area\n            ctx['region'] = area.regions[-1]\n          #  bpy.ops.view3d.view_selected(ctx)\n            bpy.ops.view3d.snap_cursor_to_selected(ctx)\n\n\ndef SelecaoParaCursor():\n    context = bpy.context\n\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            ctx = bpy.context.copy()\n            ctx['area'] = area\n            ctx['region'] = area.regions[-1]\n          #  bpy.ops.view3d.view_selected(ctx)\n            bpy.ops.view3d.snap_selected_to_cursor(ctx)\n\n\ndef SelectionaObjeto(Obj):\n    context = bpy.context\n    Objeto = bpy.data.objects[Obj]\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Objeto.select_set(True)\n    context.view_layer.objects.active = Objeto\n\ndef SelecionaOssos(Armature, Bone):\n    context = bpy.context\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    ArmatureAtual = bpy.data.objects[Armature]\n    ArmatureAtual.select_set(True)\n    context.view_layer.objects.active = ArmatureAtual\n    bpy.ops.object.mode_set(mode = 'EDIT')\n\n\n    bpy.ops.armature.select_all(action='DESELECT')\n\n    bpy.context.object.data.edit_bones[Bone].select_tail = True\n    bpy.context.object.data.edit_bones[Bone].select_head = True\n\ndef CorrigeOssosArmature(Objeto, Armature, Osso):\n    SelectionaObjeto(Objeto)\n    CursorParaSelecao()\n    SelecionaOssos(Armature, Osso)\n    SelecaoParaCursor()\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n\ndef GeraNarizDinamicaMole():\n\n    foundTrichion = 'Trichion' in bpy.data.objects\n    foundRadix = 'Radix' in bpy.data.objects\n    foundTipofNose = 'Tip of Nose' in bpy.data.objects\n    foundAlarGrooveright = 'Alar Groove right' in bpy.data.objects\n    foundAlarGrooveleft = 'Alar Groove left' in bpy.data.objects\n    foundSubmental = 'Submental' in bpy.data.objects\n\n    if foundTrichion == True and foundRadix == True and foundTipofNose  == True and foundAlarGrooveright == True and foundAlarGrooveleft == True and foundSubmental == True:\n\n        print(\"Pontos do nariz presentes!\")\n\n        def InverseMatrix():\n            context = bpy.context\n\n            ob = context.object\n            constraints = [(pb, c) for pb in ob.pose.bones\n                    for c in pb.constraints if c.type == 'CHILD_OF']\n\n            cmd = 'SET' # or 'SET'\n            for pb, c in constraints:\n\n                if cmd == 'CLEAR':\n                    c.inverse_matrix = Matrix.Identity(4)\n\n                elif cmd == 'SET':\n                    if c.target:\n                        M = ob.convert_space(pose_bone=pb,\n                                matrix=c.target.matrix_world,\n                                from_space='WORLD',\n                                to_space='POSE')\n                        P = Matrix.Identity(4).lerp(M, c.influence)\n                        c.inverse_matrix = P.inverted()\n                # toggle a property\n                target = c.target\n                c.target = None\n                c.target = target\n                #pb.constraints.update()\n\n        # Captura objetos\n\n        ListaPontos = ['Radix', 'Tip of Nose', 'Alar Groove left', 'Alar Groove right', 'Trichion', 'Submental']\n\n        print(\"LEITURA FEITA!\")\n\n        for i in ListaPontos:\n        #            print(\"HÁ O NOME!\", i.name)\n            bpy.ops.object.select_all(action='DESELECT')\n\n            ObjetoAtual = bpy.data.objects[i]\n            ObjetoAtual.select_set(True)\n            bpy.context.view_layer.objects.active = ObjetoAtual\n            bpy.ops.object.duplicate()\n            NovoNome = str(bpy.data.objects[i].name)+\"_COPY_NOSE_DEFORM\"\n            bpy.context.object.name = NovoNome\n            bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n            bpy.ops.object.select_all(action='DESELECT')\n\n\n        EMPNasionSoft = bpy.data.objects[\"Radix_COPY_NOSE_DEFORM\"]\n        EMPPNPoint = bpy.data.objects[\"Tip of Nose_COPY_NOSE_DEFORM\"]\n        EMPAlaL = bpy.data.objects[\"Alar Groove left_COPY_NOSE_DEFORM\"]\n        EMPAlaR = bpy.data.objects[\"Alar Groove right_COPY_NOSE_DEFORM\"]\n        EMPTopHead = bpy.data.objects[\"Trichion_COPY_NOSE_DEFORM\"]\n        EMPBottomHead = bpy.data.objects[\"Submental_COPY_NOSE_DEFORM\"]\n\n        # Adiciona Empty Sphere\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.ops.object.empty_add(type='SPHERE', radius=7, view_align=False, location=EMPPNPoint.location)\n        bpy.context.object.name = \"EMPNoseUpDown\"\n\n        EMPNoseUpDown = bpy.data.objects[\"EMPNoseUpDown\"]\n\n        bpy.ops.object.constraint_add(type='TRANSFORM')\n        bpy.context.object.constraints[\"Transformation\"].target = bpy.data.objects[\"ma\"]\n        bpy.context.object.constraints[\"Transformation\"].use_motion_extrapolate = True\n        bpy.context.object.constraints[\"Transformation\"].from_max_y = 10\n        bpy.context.object.constraints[\"Transformation\"].map_to_x_from = 'Y'\n        bpy.context.object.constraints[\"Transformation\"].map_to_y_from = 'Y'\n        bpy.context.object.constraints[\"Transformation\"].map_to_z_from = 'Y'\n        bpy.context.object.constraints[\"Transformation\"].to_max_z = -5\n\n        # O CURSOR TEM QUE ESTAR NA ORIGEM TOTAL\n        #bpy.context.area.spaces[1].pivot_point='CURSOR' # ANTIGO 2.79\n        bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'\n        #bpy.context.area.spaces[1].cursor_location = (0.0, 0.0, 0.0) # ANTIGO 2.79\n        bpy.context.scene.cursor.location = 0,0,0\n\n\n        # Adiciona Armature em modo de edição\n        bpy.ops.object.armature_add(radius=1, view_align=False, enter_editmode=True)\n\n        # Desseleciona tudo\n        #bpy.ops.armature.select_all(action='TOGGLE')\n\n        # Modifica posição dos bones\n        #bpy.context.object.data.edit_bones[\"Bone\"].head = Vector((1.0, 2.0, 3.0))\n\n        bpy.context.object.data.edit_bones[\"Bone\"].name = \"Nose\"\n\n        bpy.context.object.data.edit_bones[\"Nose\"].head = EMPPNPoint.location\n\n        bpy.context.object.data.edit_bones[\"Nose\"].tail = EMPNasionSoft.location\n\n        # Adiciona Asa Esquerda\n        bpy.ops.armature.bone_primitive_add()\n\n        bpy.context.object.data.edit_bones[\"Bone\"].name = \"AlaL\"\n\n        bpy.context.object.data.edit_bones[\"AlaL\"].head = EMPPNPoint.location\n\n        bpy.context.object.data.edit_bones[\"AlaL\"].tail = EMPAlaL.location\n\n        # Adiciona Asa Direita\n        bpy.ops.armature.bone_primitive_add()\n\n        bpy.context.object.data.edit_bones[\"Bone\"].name = \"AlaR\"\n\n        bpy.context.object.data.edit_bones[\"AlaR\"].head = EMPPNPoint.location\n\n        bpy.context.object.data.edit_bones[\"AlaR\"].tail = EMPAlaR.location\n\n        # Adiciona Nariz\n        bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'\n        bpy.context.scene.cursor.location = EMPPNPoint.location\n\n        bpy.ops.armature.bone_primitive_add()\n\n        bpy.context.object.data.edit_bones[\"Bone\"].name = \"IK_Nose\"\n        bpy.context.object.data.edit_bones[\"IK_Nose\"].use_deform = False\n\n        # Adicionar Top Bottom\n\n        bpy.ops.armature.bone_primitive_add()\n\n        bpy.context.object.data.edit_bones[\"Bone\"].name = \"TopBottomHead\"\n\n        bpy.context.object.data.edit_bones[\"TopBottomHead\"].head = EMPTopHead.location\n\n        bpy.context.object.data.edit_bones[\"TopBottomHead\"].tail = EMPBottomHead.location\n\n\n        # Parentamento\n        bpy.context.object.data.edit_bones[\"Nose\"].parent = bpy.context.object.data.edit_bones['IK_Nose']\n        bpy.context.object.data.edit_bones[\"AlaL\"].parent = bpy.context.object.data.edit_bones['IK_Nose']\n        bpy.context.object.data.edit_bones[\"AlaR\"].parent = bpy.context.object.data.edit_bones['IK_Nose']\n\n        # bpy.context.object.data.draw_type = 'ENVELOPE' # ANTIGO 2.78\n        bpy.context.object.data.display_type = 'ENVELOPE'\n\n\n        # Aumenta tamanho envelope\n\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.context.object.data.edit_bones[\"Nose\"].head_radius=8.5\n        bpy.context.object.data.edit_bones[\"AlaL\"].head_radius=8.5\n        bpy.context.object.data.edit_bones[\"AlaR\"].head_radius=8.5\n        bpy.context.object.data.edit_bones[\"Nose\"].tail_radius=3.5\n        bpy.context.object.data.edit_bones[\"AlaL\"].tail_radius=3.5\n        bpy.context.object.data.edit_bones[\"AlaR\"].tail_radius=3.5\n\n        #bpy.context.object.data.edit_bones[\"Nose\"].select_head=True\n        #bpy.context.object.data.edit_bones[\"AlaL\"].select_head=True\n        #bpy.context.object.data.edit_bones[\"AlaR\"].select_head=True\n        #bpy.ops.transform.transform(mode='BONE_ENVELOPE', value=(85, 0, 0, 0))\n\n\n        # Fazendo o constraint\n        #obj = bpy.data.objects[\"Armature.002\"]\n\n        bpy.ops.object.mode_set(mode='OBJECT')\n        context = bpy.context\n        obj = context.active_object\n\n        bpy.ops.object.mode_set(mode='POSE')\n        pbase=obj.pose.bones['IK_Nose']\n        pbase.bone.select=True\n        bpy.context.object.data.bones.active = bpy.context.object.data.bones['IK_Nose']\n\n\n        # Child Of\n        selected_bone = pbase\n        constraint = selected_bone.constraints\n        ChildOf = constraint.new('CHILD_OF')\n        ChildOf.target = EMPNoseUpDown\n        InverseMatrix()\n        bpy.context.object.pose.bones[\"IK_Nose\"].constraints[\"Child Of\"].influence = 0.5\n\n        # Track to\n        pbase=obj.pose.bones['Nose']\n        pbase.bone.select=True\n        bpy.context.object.data.bones.active = bpy.context.object.data.bones['Nose']\n        selected_bone = pbase\n        constraint = selected_bone.constraints\n        StretchTo = constraint.new('STRETCH_TO')\n        StretchTo.target = EMPNasionSoft\n\n        pbase=obj.pose.bones['AlaL']\n        pbase.bone.select=True\n        bpy.context.object.data.bones.active = bpy.context.object.data.bones['AlaL']\n        selected_bone = pbase\n        constraint = selected_bone.constraints\n        StretchTo = constraint.new('STRETCH_TO')\n        StretchTo.target = EMPAlaL\n\n        pbase=obj.pose.bones['AlaR']\n        pbase.bone.select=True\n        bpy.context.object.data.bones.active = bpy.context.object.data.bones['AlaR']\n        selected_bone = pbase\n        constraint = selected_bone.constraints\n        StretchTo = constraint.new('STRETCH_TO')\n        StretchTo.target = EMPAlaR\n\n        bpy.ops.object.mode_set(mode='OBJECT')\n        Armature = context.active_object\n\n\n        bpy.ops.object.select_all(action='DESELECT')\n        Armature.select_set(True)\n\n        # Envelope configurações\n\n        bpy.ops.object.mode_set(mode='EDIT')\n\n        bpy.context.object.data.edit_bones[\"Nose\"].envelope_distance = 14\n        bpy.context.object.data.edit_bones[\"Nose\"].head_radius = 5\n        bpy.context.object.data.edit_bones[\"Nose\"].tail_radius = 1\n\n        bpy.context.object.data.edit_bones[\"AlaL\"].envelope_distance = 9\n        bpy.context.object.data.edit_bones[\"AlaL\"].head_radius = 9\n        bpy.context.object.data.edit_bones[\"AlaL\"].tail_radius = 3.5\n\n        bpy.context.object.data.edit_bones[\"AlaR\"].envelope_distance = 9\n        bpy.context.object.data.edit_bones[\"AlaR\"].head_radius = 9\n        bpy.context.object.data.edit_bones[\"AlaR\"].tail_radius = 3.5\n\n        bpy.context.object.data.edit_bones[\"TopBottomHead\"].envelope_distance = 55\n        bpy.context.object.data.edit_bones[\"TopBottomHead\"].head_radius = 22\n        bpy.context.object.data.edit_bones[\"TopBottomHead\"].tail_radius = 22\n\n\n        # Deformação\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        #bpy.context.object.data.draw_type = 'WIRE' # ANTIGO 2.78\n        bpy.context.object.data.display_type = 'WIRE'\n\n        bpy.ops.object.select_all(action='DESELECT')\n        FaceMalha = bpy.data.objects['SoftTissueDynamic']\n        Armature.select_set(True)\n        FaceMalha.select_set(True)\n        bpy.context.view_layer.objects.active = Armature\n\n        bpy.ops.object.parent_set(type='ARMATURE_ENVELOPE')\n\n        bpy.ops.object.select_all(action='DESELECT')\n        FaceMalha.select_set(True)\n        bpy.context.view_layer.objects.active = FaceMalha\n        bpy.ops.object.modifier_move_up(modifier=\"Armature.001\")\n\n        # Oculta Objetos\n        EMPNoseUpDown.hide_viewport=True\n        Armature.hide_viewport=True\n        EMPNasionSoft.hide_viewport=True\n        EMPPNPoint.hide_viewport=True\n        EMPAlaL.hide_viewport=True\n        EMPAlaR.hide_viewport=True\n        EMPTopHead.hide_viewport=True\n        EMPBottomHead.hide_viewport=True\n\n    else:\n        print(\"Falta algum ponto anatômico no processo.\")\n\n\ndef CorrigeDeformacaoOperacoesDef(self, context):\n\n    # Maxila - correção\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_MIX')\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_a = \"ma\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_b = \"cm\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mix_mode = 'SUB'\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"VertexWeightMix\")\n\n    # Corpo da mandíbula - correções\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_MIX')\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_a = \"cm\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_b = \"ma\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mix_mode = 'SUB'\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"VertexWeightMix\")\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_MIX')\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_a = \"cm\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_b = \"me\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mix_mode = 'SUB'\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mask_constant = 0.30\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"VertexWeightMix\")\n\n    # Cabeça - correçoes\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_MIX')\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_a = \"ca\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_b = \"cm\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mix_mode = 'SUB'\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mask_constant = 0.05\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"VertexWeightMix\")\n\n    bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_MIX')\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_a = \"ca\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].vertex_group_b = \"ma\"\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mix_mode = 'SUB'\n    bpy.context.object.modifiers[\"VertexWeightMix\"].mask_constant = 0.2\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"VertexWeightMix\")\n\n\nclass ConfiguraDinamicaMole(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.configura_dinamica_mole\"\n    bl_label = \"Configura Dinâmica do Mole\"\n\n    def execute(self, context):\n\n        context = bpy.context\n        ObjFace = context.active_object\n\n        bpy.data.objects['Armature_Head'].hide_viewport=False\n#        bpy.data.objects['Armature_Head'].hide_set(False)\n        CorrigeOssosArmature('re', 'Armature_Head', 're')\n        CorrigeOssosArmature('rd', 'Armature_Head', 'rd')\n        CorrigeOssosArmature('ma', 'Armature_Head', 'ma')\n        CorrigeOssosArmature('ma', 'Armature_Head', 'Maxila.GUIA')\n        CorrigeOssosArmature('cm', 'Armature_Head', 'cm')\n        CorrigeOssosArmature('cm', 'Armature_Head', 'Corpo_Mandibular.GUIA')\n        CorrigeOssosArmature('me', 'Armature_Head', 'me')\n        CorrigeOssosArmature('ca', 'Armature_Head', 'ca')\n        CorrigeOssosArmature('ca', 'Armature_Head', 'Mandibula')\n#        bpy.data.objects['Armature_Head'].hide_set(True)\n        bpy.data.objects['Armature_Head'].hide_viewport=True\n\n        SelectionaObjeto(str(ObjFace.name))\n        ConfiguraDinamicaMoleDef(self, context)\n        CorrigeDeformacaoOperacoesDef(self, context) # FAZER MAIS TESTES FUTUROS!\n        GeraNarizDinamicaMole()\n\n        return {'FINISHED'}\n"
  },
  {
    "path": "FerrFisica.py",
    "content": "import bpy\nimport fnmatch\n\ndef ColisaoArcosDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.context.scene.frame_end = 110\n\n    if len(bpy.context.selected_objects) != 2:\n\t    print(\"Selecione dois objetos!\")\n\t    # Substituir por mensagem de erro!\n    else:\n        print(\"Tudo certo\")\n\n        # Inverte gravidade.\n        bpy.context.scene.gravity[2] = -9.81\n\n\n        ObjOriginais = bpy.context.selected_objects\n\n        for i in bpy.context.selected_objects:\n            bpy.ops.object.select_all(action='DESELECT')\n            i.select_set(True)\n            bpy.context.view_layer.objects.active = i\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n\n        for i in ObjOriginais:\n            i.select_set(True)\n\n\n        if bpy.context.selected_objects[0].location[2] == bpy.context.selected_objects[1].location[2]:\n            print(\"Os objetos estão na mesma altura!\")\n\n        if bpy.context.selected_objects[0].location[2] > bpy.context.selected_objects[1].location[2]: # if bpy.context.selected_objects[0].location[2] > bpy.context.selected_objects[1].location[2]:\n\n            ArcadaSup = bpy.context.selected_objects[0]\n            ArcadaInf = bpy.context.selected_objects[1]\n            print(\"Obj[0] mais alnto\")\n\n        if bpy.context.selected_objects[0].location[2] < bpy.context.selected_objects[1].location[2]:  # if bpy.context.selected_objects[0].location[2] < bpy.context.selected_objects[1].location[2]:\n\n            ArcadaSup = bpy.context.selected_objects[1]\n            ArcadaInf = bpy.context.selected_objects[0]\n            print(\"Obj[1] mais alto\")\n\n        # Seleciona arcada inferior e cria vertex group\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ArcadaInf.select_set(True)\n        bpy.context.view_layer.objects.active = ArcadaInf\n\n\n\n        try:\n            bpy.ops.object.modifier_remove(modifier=\"ArchSupTouch\")\n            bpy.ops.object.vertex_group_remove(all=False, all_unlocked=False)\n            bpy.ops.rigidbody.object_remove()\n            ArcadaSup.animation_data_clear()\n            print(\"APAGADOS o grupo e o modificador.\")\n        except:\n            print(\"Não foi criado grupo.\")\n\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.mesh.select_mode(type=\"VERT\")\n        bpy.ops.mesh.select_all(action='SELECT')\n        vg = ArcadaInf.vertex_groups.new(name=\"ArchInf\")\n        scn.tool_settings.vertex_group_weight=1\n        bpy.ops.object.vertex_group_assign()\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        bpy.ops.rigidbody.object_add()\n        bpy.context.object.rigid_body.enabled = False\n        bpy.context.object.rigid_body.collision_shape = 'MESH'\n        bpy.context.object.rigid_body.collision_margin = 0\n\n        #Arco Superior\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ArcadaSup.select_set(True)\n        bpy.context.view_layer.objects.active = ArcadaSup\n\n        try:\n            bpy.ops.object.modifier_remove(modifier=\"ArchSupTouch\")\n            bpy.ops.object.vertex_group_remove(all=False, all_unlocked=False)\n            bpy.ops.rigidbody.object_remove()\n            ArcadaSup.animation_data_clear()\n            print(\"APAGADOS o grupo e o modificador.\")\n        except:\n            print(\"Não foi criado grupo e modificador.\")\n\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.mesh.select_mode(type=\"VERT\")\n        bpy.ops.mesh.select_all(action='SELECT')\n        vg = ArcadaSup.vertex_groups.new(name=\"ArchSup\")\n        scn.tool_settings.vertex_group_weight=0\n        bpy.ops.object.vertex_group_assign()\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        # Vertex proximity\n        bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"ArchSup\"\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].target = ArcadaInf\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist =0\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = .5 #3\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'LINEAR'\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"ArchSupTouch\"\n        bpy.context.object.modifiers[\"ArchSupTouch\"].show_expanded = False\n\n        bpy.ops.rigidbody.object_add()\n        bpy.context.object.rigid_body.collision_shape = 'MESH'\n        bpy.context.object.rigid_body.collision_margin = 0\n\n#        override = {'scene': bpy.context.scene,\n#                'point_cache': bpy.context.scene.rigidbody_world.point_cache}\n#        bpy.ops.ptcache.bake(override, bake=True)\n#        bpy.context.scene.update()\n#        bpy.ops.rigidbody.bake_to_keyframes(frame_start=1, frame_end=110)\n\n#        bpy.ops.object.mode_set(mode='WEIGHT_PAINT')\n\n        bpy.ops.screen.animation_play()\n\nclass ColisaoArcos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.colisao_arcos\"\n    bl_label = \"Archs Collision\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        if len(bpy.context.selected_objects) == 2:\n            return True\n        else:\n            if len(bpy.context.selected_objects) != 2:\n                return False\n\n    def execute(self, context):\n        ColisaoArcosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ColisaoArcos)\n\n# GARAVIDADE INVERSA\n\ndef ColisaoArcosInversoDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.context.scene.frame_end = 110\n\n    if len(bpy.context.selected_objects) != 2:\n\t    print(\"Selecione dois objetos!\")\n\t    # Substituir por mensagem de erro!\n    else:\n        print(\"Tudo certo\")\n\n        # Inverte gravidade.\n        bpy.context.scene.gravity[2] = 9.81\n\n        ObjOriginais = bpy.context.selected_objects\n\n\n        for i in ObjOriginais:\n            bpy.ops.object.select_all(action='DESELECT')\n            i.select_set(True)\n            bpy.context.view_layer.objects.active = i\n            bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n\n        for i in ObjOriginais:\n            i.select_set(True)\n\n\n        if ObjOriginais[0].location[2] == ObjOriginais[1].location[2]:\n            print(\"Os objetos estão na mesma altura!\")\n\n        if ObjOriginais[0].location[2] > ObjOriginais[1].location[2]: # if bpy.context.selected_objects[0].location[2] > bpy.context.selected_objects[1].location[2]:\n\n            ArcadaSup = ObjOriginais[0]\n            ArcadaInf = ObjOriginais[1]\n            print(\"Obj[1] mais baixo\")\n            print(\"LocSUP\",ArcadaSup.name,ArcadaSup.location[2])\n            print(\"LocINF\",ArcadaInf.name,ArcadaInf.location[2])\n\n\n        if ObjOriginais[0].location[2] < ObjOriginais[1].location[2]:  # if bpy.context.selected_objects[0].location[2] < bpy.context.selected_objects[1].location[2]:\n\n            ArcadaSup = ObjOriginais[1]\n            ArcadaInf = ObjOriginais[0]\n            print(\"Obj[0] mais baixo\")\n            print(\"LocSUP\",ArcadaSup.name,ArcadaSup.location[2])\n            print(\"LocINF\",ArcadaInf.name,ArcadaInf.location[2])\n            print(ArcadaInf.name)\n\n        #Arco Superior\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ArcadaSup.select_set(True)\n        bpy.context.view_layer.objects.active = ArcadaSup\n\n        try:\n            bpy.ops.object.modifier_remove(modifier=\"ArchInfTouch\")\n            bpy.ops.object.vertex_group_remove(all=False, all_unlocked=False)\n            bpy.ops.rigidbody.object_remove()\n            ArcadaSup.animation_data_clear()\n            print(\"APAGADOS o grupo e o modificador.\")\n        except:\n            print(\"Não foi criado grupo e modificador.\")\n\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.mesh.select_mode(type=\"VERT\")\n        bpy.ops.mesh.select_all(action='SELECT')\n        vg = ArcadaSup.vertex_groups.new(name=\"ArchSup\")\n        scn.tool_settings.vertex_group_weight=1\n        bpy.ops.object.vertex_group_assign()\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        bpy.ops.rigidbody.object_add()\n        bpy.context.object.rigid_body.enabled = False\n        bpy.context.object.rigid_body.collision_shape = 'MESH'\n        bpy.context.object.rigid_body.collision_margin = 0\n\n        # Arcada inferior\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ArcadaInf.select_set(True)\n        bpy.context.view_layer.objects.active = ArcadaInf\n\n        try:\n            bpy.ops.object.modifier_remove(modifier=\"ArchInfTouch\")\n            bpy.ops.object.vertex_group_remove(all=False, all_unlocked=False)\n            bpy.ops.rigidbody.object_remove()\n            ArcadaInf.animation_data_clear()\n            print(\"APAGADOS o grupo e o modificador.\")\n        except:\n            print(\"Não foi criado grupo.\")\n\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.mesh.select_mode(type=\"VERT\")\n        bpy.ops.mesh.select_all(action='SELECT')\n        vg = ArcadaInf.vertex_groups.new(name=\"ArchInf\")\n        scn.tool_settings.vertex_group_weight=0\n        bpy.ops.object.vertex_group_assign()\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n        # Vertex proximity\n        bpy.ops.object.modifier_add(type='VERTEX_WEIGHT_PROXIMITY')\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].vertex_group = \"ArchInf\"\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].target = ArcadaSup\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].proximity_mode = 'GEOMETRY'\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].min_dist =0\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].max_dist = .5 #3\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].falloff_type = 'LINEAR'\n        bpy.context.object.modifiers[\"VertexWeightProximity\"].name = \"ArchInfTouch\"\n        bpy.context.object.modifiers[\"ArchInfTouch\"].show_expanded = False\n\n        bpy.ops.rigidbody.object_add()\n        bpy.context.object.rigid_body.collision_shape = 'MESH'\n        bpy.context.object.rigid_body.collision_margin = 0\n\n        bpy.ops.screen.animation_play()\n\nclass ColisaoArcosInverso(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.colisao_arcos_inverso\"\n    bl_label = \"Inverted Archs Collision\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        if len(bpy.context.selected_objects) == 2:\n            return True\n        else:\n            if len(bpy.context.selected_objects) != 2:\n                return False\n\n    def execute(self, context):\n        ColisaoArcosInversoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ColisaoArcosInverso)\n\ndef AplicaAnimCorDef():\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.screen.animation_cancel()\n\n\n    override = {'scene': bpy.context.scene,\n\t            'point_cache': bpy.context.scene.rigidbody_world.point_cache}\n    bpy.ops.ptcache.bake(override, bake=True)\n    bpy.context.scene.update()\n    bpy.ops.rigidbody.bake_to_keyframes(frame_start=1, frame_end=110)\n\n    bpy.context.scene.frame_current = 110\n\n    bpy.ops.object.mode_set(mode='WEIGHT_PAINT')\n\n    bpy.ops.screen.animation_play()\n\nclass AplicaAnimCor(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.aplica_anima_cor\"\n    bl_label = \"Apply Color and Animation\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        if len(bpy.context.selected_objects) == 1:\n            return True\n        else:\n            if len(bpy.context.selected_objects) != 1:\n                return False\n\n    def execute(self, context):\n        AplicaAnimCorDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(AplicaAnimCor)\n\ndef TravaArcoDef():\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n#    bpy.ops.screen.animation_cancel()\n    bpy.ops.object.mode_set(mode='OBJECT')\n#    bpy.context.scene.frame_current = 110\n    obj.animation_data_clear()\n\n    '''\n    try:\n        bpy.ops.object.vertex_group_remove(all=False, all_unlocked=False)\n        bpy.ops.rigidbody.object_remove()\n        ArcadaSup.animation_data_clear()\n        print(\"APAGADOS o grupo e o modificador.\")\n    except:\n        print(\"Não foi criado grupo e modificador.\")\n    '''\n\n\nclass TravaArco(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.trava_arco\"\n    bl_label = \"Arch Stop\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n\n    # Programação diferente para funcionar!!!\n\n    @classmethod\n    def poll(cls, context):\n\n        scene = context.scene\n        tool_settings = context.tool_settings\n        screen = context.screen\n\n        if not screen.is_animation_playing:\n            return True\n        if screen.is_animation_playing:\n            return False\n\n    def execute(self, context):\n        bpy.ops.screen.animation_cancel()\n        TravaArcoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(TravaArco)\n\n\ndef PreparaMaxilaMandibulaDef():\n\n    context = bpy.context\n    #obj = context.active_object\n    scn = context.scene\n\n    Maxila = bpy.data.objects['ma']\n    Mandibula = bpy.data.objects['cm']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Maxila.select_set(True)\n    Mandibula.select_set(True)\n    bpy.context.view_layer.objects.active = Maxila\n\n    bpy.ops.object.duplicate()\n\n    Maxila.hide_viewport=True\n    Mandibula.hide_viewport=True\n\n#    Apagar_Ziga = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"*Ziga\")]\n        #for Ziga in Apagar_Ziga:\n\n\n    for objeto in context.selected_objects:\n        if fnmatch.fnmatchcase(objeto.name, \"ma*\"):\n            objeto.name = \"MaxillaCopyZiga\"\n            MaxilaCopia = objeto\n            objeto.animation_data_clear()\n            print(\"Maxila OK\", objeto)\n\n        if fnmatch.fnmatchcase(objeto.name, \"cm*\"):\n            objeto.name = \"MandibleCopyZiga\"\n            MandibulaCopia = objeto\n            objeto.animation_data_clear()\n            print(\"Mandibula OK\", objeto)\n\n    #Apagar_Bracket_ref = [obj for obj in bpy.context.scene.objects if fnmatch.fnmatchcase(obj.name, \"Bracket_re*\")]\n\nclass PreparaMaxilaMandibula(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.prepara_maxila_mandibula\"\n    bl_label = \"Prepares Maxilla & Mandible\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        if bpy.data.objects['MaxillaCopyZiga'] and bpy.data.objects['MandibleCopyZiga']:\n            return False\n        else:\n            return True\n\n    def execute(self, context):\n        PreparaMaxilaMandibulaDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(PreparaMaxilaMandibula)\n\n\ndef FinalizaColisaoMaxMandDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.context.scene.frame_end = 100\n    bpy.context.scene.frame_current = 100\n\n#    bpy.ops.screen.animation_cancel(restore_frame=True)\n\n#    bpy.ops.screen.animation_cancel()\n\n    bpy.ops.object.trava_arco()\n\n\n    bpy.data.objects['ma'].hide_viewport=False\n    bpy.data.objects['cm'].hide_viewport=False\n    bpy.data.objects['cm'].location = bpy.data.objects['MandibleCopyZiga'].location\n    bpy.data.objects['cm'].rotation_euler = bpy.data.objects['MandibleCopyZiga'].rotation_euler\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['cm'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['cm']\n    bpy.ops.anim.ortog_loc_rot()\n\n#    bpy.context.scene.frame_end = 100\n#    FrameEnd = bpy.data.scenes[\"Scene\"].frame_end\n#    bpy.context.scene.frame_set(FrameEnd)\n#    bpy.context.scene.frame_current = 100\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['MaxillaCopyZiga'].select_set(True)\n    bpy.data.objects['MandibleCopyZiga'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['MandibleCopyZiga']\n    bpy.ops.object.delete(use_global=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['cm'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['cm']\n\n\nclass FinalizaColisaoMaxMand(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.finaliza_colisao_max_mand\"\n    bl_label = \"Apply Maxilla & Mandible Collision\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        FinalizaColisaoMaxMandDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(FinalizaColisaoMaxMand)\n"
  },
  {
    "path": "FerrImgTomo.py",
    "content": "import bpy\nimport os\nimport pydicom as dicom\nimport subprocess\nimport tempfile\nimport platform\nfrom os.path import expanduser\nimport platform\n\n#if platform.system() == \"Linux\":\nimport SimpleITK as sitk\n\n# EXTRAI DADOS DA TOMOGRAFIA\ndef ExtraiDadosTomo():\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n\n    #Corrige tomo\n    bpy.ops.object.corrige_dicom()\n    tmpdirTomo2 = tempfile.mkdtemp()\n\n\n    os.chdir(scn.my_tool.path)\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        subprocess.call('for i in *; do gdcmconv -w -i $i -o '+tmpdirTomo2+'/$i; done', shell=True)\n        print(\"Tomografia corrigida!!!\")\n\n    if platform.system() == \"Windows\":\n        subprocess.call('for %f in (*) do C:\\OrtogOnBlender\\GDCM\\\\bin\\gdcmconv -w -i %f -o '+tmpdirTomo2+'/%f', shell=True)\n        print(\"Tomografia corrigida!!!\")\n\n    scn.my_tool.path = tmpdirTomo2+\"/\"\n\n    #Extrai dados\n\n    global  EspacoSlices, DimensaoLateralX, DimensaoLateralY, RowsPixels, ColumnsPixels, TmpDirPNG, DiretorioDCM\n\n    DiretorioDCM = scn.my_tool.path #tmpdirTomo2+\"/\" #scn.my_tool.path #\"/home/linux3dcs/prj/Estudos/Tomografia/TOMOGRAFIA_2_MENOR/ScalarVolume_10/\"\n\n    ListaArquivos =  sorted(os.listdir(DiretorioDCM))\n\n    TmpDirPNG = tempfile.mkdtemp()\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        ds = dicom.dcmread(DiretorioDCM+ListaArquivos[0], force = True) # Diretório e arquivo concatenados\n\n\n    if platform.system() == \"Windows\":\n        ds = dicom.dcmread(DiretorioDCM+\"\\\\\"+ListaArquivos[0], force = True) # Diretório e arquivo concatenados\n\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        ds = dicom.dcmread(DiretorioDCM+ListaArquivos[0], force = True) # Diretório e arquivo concatenados\n\n\n    if platform.system() == \"Windows\":\n        ds = dicom.dcmread(DiretorioDCM+\"\\\\\"+ListaArquivos[0], force = True)\n\n\n    # Distância da altura dos slices\n\n    #Tenta pegar por\n    try:\n\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            ds2 = dicom.dcmread(DiretorioDCM+ListaArquivos[1], force = True)\n\n        if platform.system() == \"Windows\":\n            ds2 = dicom.dcmread(DiretorioDCM+\"\\\\\"+ListaArquivos[1], force = True)\n\n        EspacoSlices = abs(ds.SliceLocation - ds2.SliceLocation)\n\n        print(\"Deu certo por SliceLocation!\")\n\n\n    except:\n\n        slice_thickness = ds.data_element(\"SliceThickness\")\n        sliceLimpa1 = str(slice_thickness).split('DS: ')\n        sliceLimpa2 = sliceLimpa1[1].strip('\"')\n    #    sliceLimpa1 = str(slice_thickness).strip('(0018, 0050) Slice Thickness DS:')\n    #    sliceLimpa2 = sliceLimpa1.strip('\"')\n        EspacoSlices = float(sliceLimpa2)\n\n    print(\"Espaço entre os slices:\", EspacoSlices)\n\n    bpy.types.Scene.SliceThickness = bpy.props.StringProperty \\\n      (\n        name = \"SliceThickness\",\n        description = \"Slice Thickness\",\n        default = str(EspacoSlices)\n      )\n\n\n    # Dimensões laterais\n\n    pixel_spacing = ds.data_element(\"PixelSpacing\")\n    pixelLimpa1 = str(pixel_spacing).split('DS: ')\n#    pixelLimpa1 = str(pixel_spacing).strip('(0028, 0030) Pixel Spacing DS:')\n    pixelLimpa2 = pixelLimpa1[1].strip('[')\n    pixelLimpa3 = pixelLimpa2.strip(']')\n\n    DimensoesLaterais = pixelLimpa3.split(\",\")\n\n\n    DimensaoLateralX = float(DimensoesLaterais[0].strip(\"'\"))\n\n    bpy.types.Scene.PixelSpacingX = bpy.props.StringProperty \\\n      (\n        name = \"PixelSpacingX\",\n        description = \"Pixel SpacingX\",\n        default = str(DimensaoLateralX)\n      )\n\n    DimensaoLateralY = float(DimensoesLaterais[1].strip(\"'\").strip(\" '\"))\n\n    bpy.types.Scene.PixelSpacingY = bpy.props.StringProperty \\\n      (\n        name = \"PixelSpacingY\",\n        description = \"Pixel SpacingY\",\n        default = str(DimensaoLateralY)\n      )\n\n\n    # Pixels\n\n    rows = ds.data_element(\"Rows\")\n    rowsLimpa1 = str(rows).split('US: ')\n    RowsPixels = float(rowsLimpa1[1])\n\n    bpy.types.Scene.IMGDimX = bpy.props.StringProperty \\\n      (\n        name = \"IMGDimX\",\n        description = \"IMGDimX\",\n        default = str(RowsPixels)\n      )\n\n\n    columns = ds.data_element(\"Columns\")\n    columnsLimpa1 = str(rows).split('US: ')\n    ColumnsPixels = float(rowsLimpa1[1])\n\n    bpy.types.Scene.IMGDimY = bpy.props.StringProperty \\\n      (\n        name = \"IMGDimY\",\n        description = \"IMGDimY\",\n        default = str(ColumnsPixels)\n      )\n\n# Conversão de DICOM para PNG\n\ndef ConverteDCMparaPNG():\n\n    #if platform.system() == \"Linux\":\n\n    os.chdir(DiretorioDCM)\n    ListaArquivos = os.listdir(DiretorioDCM)\n\n    for ArquivoAtual in ListaArquivos:\n        img = sitk.ReadImage(ArquivoAtual)\n        # rescale intensity range from [-1000,1000] to [0,255]\n        img = sitk.IntensityWindowing(img, -1000, 1000, 0, 255)\n        # convert 16-bit pixels to 8-bit\n        img = sitk.Cast(img, sitk.sitkUInt8)\n        sitk.WriteImage(img, TmpDirPNG+\"/\"+ArquivoAtual+\".png\")\n\n    print(\"DICOMs convertidos em PNG\")\n\n# Oficial\n#        subprocess.call('cd '+DiretorioDCM+' && for i in *; do convert -verbose -auto-level $i \"${i%.dcm}\".png; done && mv *.png '+TmpDirPNG, shell=True)\n#        print(\"DICOMs convertidos em PNG\")\n# Alternativa DCMTK\n#        subprocess.call('cd '+DiretorioDCM+' && for x in *.dcm; do dcmj2pnm --write-png $x \"${x%.dcm}\".png; done && mv *.png '+TmpDirPNG, shell=True)\n#        print(\"DICOMs convertidos em PNG\")\n# Alternativa\n#        subprocess.call('cd '+DiretorioDCM+' && for i in *; do mogrify -verbose -format png $i; done && mv *.png '+TmpDirPNG, shell=True)\n#        print(\"DICOMs convertidos em PNG\")\n'''\n    if platform.system() == \"Darwin\":\n        subprocess.call('cd '+DiretorioDCM+' && for i in *; do magick $i -auto-level -verbose \"${i%.dcm}\".png; done && mv *.png '+TmpDirPNG, shell=True)\n        print(\"DICOMs convertidos em PNG\")\n\n    if platform.system() == \"Windows\":\n        subprocess.call('cd '+DiretorioDCM+' & for %f in (*) do C:\\OrtogOnBlender\\ImageMagick\\magick %f -auto-level -verbose %f.png & move *.png '+TmpDirPNG, shell=True)\n        print(\"DICOMs convertidos em PNG\")\n#        subprocess.call('cd '+DiretorioDCM+' & for %f in (*) do C:\\OrtogOnBlender\\ImageMagick\\mogrify -verbose -format png %f & move *.png '+TmpDirPNG, shell=True)\n#        print(\"DICOMs convertidos em PNG\")\n\n'''\n\n\n# Material\n\nclass Material:\n\n    def set_cycles(self):\n        scn = bpy.context.scene\n        if not scn.render.engine == 'CYCLES':\n            scn.render.engine = 'CYCLES'\n\n    def make_material(self, name):\n        self.mat = bpy.data.materials.new(name)\n        self.mat.use_nodes = True\n        self.nodes = self.mat.node_tree.nodes\n\n    def link(self, from_node, from_slot_name, to_node, to_slot_name):\n        input = to_node.inputs[to_slot_name]\n        output = from_node.outputs[from_slot_name]\n        self.mat.node_tree.links.new(input, output)\n\n    def makeNode(self, type, name):\n        self.node = self.nodes.new(type)\n        self.node.name = name\n        self.xpos += 200\n        self.node.location = self.xpos, self.ypos\n        return self.node\n\n    def dump_node(self, node):\n        print (node.name)\n        print (\"Inputs:\")\n        for n in node.inputs: print (\"\t\", n)\n        print (\"Outputs:\")\n        for n in node.outputs: print (\"\t\", n)\n\n    def new_row():\n        self.xpos = 0\n        self.ypos += 200\n\n    def __init__(self):\n        self.xpos = 0\n        self.ypos = 0\n\n# Importação dos slices\n\ndef ImportaFatiasDef():\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    ExtraiDadosTomo()\n    ConverteDCMparaPNG()\n\n    #Diretorio = \"/home/linux3dcs/prj/Estudos/Tomografia/TOMOGRAFIA_2_MENOR/imagens/\"\n\n\n    ListaArquivos = sorted(os.listdir(TmpDirPNG))\n#    ListaArquivos = sorted(os.listdir(TmpDirPNG))\n\n\n    DistanciaZ = 0\n\n    EscalaX = DimensaoLateralX * RowsPixels\n    EscalaY = DimensaoLateralY * ColumnsPixels\n\n    #Renderização\n    #bpy.context.scene.eevee.use_gtao = True\n    bpy.context.scene.eevee.gtao_distance = 8\n    bpy.context.scene.eevee.use_gtao_bent_normals = False\n    # bpy.context.scene.eevee.use_bloom = True # NÃO FICA BOM!\n    bpy.context.scene.eevee.use_sss = False #Senão não fica bom!\n    bpy.context.scene.eevee.use_ssr = True\n    bpy.context.scene.eevee.use_ssr_refraction = True\n    bpy.context.scene.eevee.ssr_thickness = 3\n    bpy.context.scene.render.hair_type = 'STRIP'\n    bpy.context.scene.eevee.shadow_method = 'ESM'\n    bpy.context.scene.eevee.shadow_cube_size = '512'\n    bpy.context.scene.eevee.shadow_cascade_size = '512'\n    bpy.context.scene.eevee.use_soft_shadows = True\n    bpy.context.scene.eevee.light_threshold = 0.013\n    bpy.context.scene.view_settings.exposure = 0.2\n\n    bpy.context.scene.render.engine = 'BLENDER_EEVEE'\n\n    bpy.context.space_data.shading.type = 'MATERIAL' # Descobri sozinho!\n    bpy.context.space_data.shading.use_scene_world = True # Tem que ser aqui  - muda fundo\n\n    # Background\n    BackNodeTree = bpy.data.materials.data.worlds['World'].node_tree\n    BackNodeTree.nodes['Background'].inputs['Color'].default_value = (1,1,1,1)\n\n\n    # Importa node group\n\n    if platform.system() == \"Linux\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n#        section   = \"\\\\Collection\\\\\"\n#        object    = \"SPLINT\"\n        section   = \"\\\\NodeTree\\\\\"\n        object    = \"GroupVoxelShader\"\n\n    if platform.system() == \"Darwin\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\NodeTree\\\\\"\n        object    = \"GroupVoxelShader\"\n\n    if platform.system() == \"Windows\":\n\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\NodeTree\\\\\"\n        object    = \"GroupVoxelShader\"\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\n\n    # Importa fatias\n    for Arquivo in ListaArquivos:\n\n        bpy.ops.import_image.to_plane(files=[{\"name\":Arquivo, \"name\":Arquivo}], directory=TmpDirPNG)\n\n        bpy.ops.transform.translate(value=(0, 0, DistanciaZ), constraint_axis=(False, False, True), mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)\n\n        bpy.ops.transform.resize(value=(EscalaX, EscalaY, 0), constraint_axis=(False, False, False), mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n        bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)\n\n        #bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                for region in area.regions:\n                    if region.type == 'WINDOW':\n                        override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                        bpy.ops.view3d.view_all(override)\n\n        print(Arquivo)\n\n        DistanciaZ += EspacoSlices\n\n    # ATRIBUI MATERIAL\n\n        m = Material()\n        m.set_cycles()\n        # from chapter 1 of [DRM protected book, could not copy author/title]\n        m.make_material(\"mat_\"+Arquivo)\n\n        image_path = TmpDirPNG+\"/\"+Arquivo\n\n        ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n        ImageTexture.image = bpy.data.images.load(image_path)\n\n        bpy.data.materials[\"mat_\"+Arquivo].node_tree.nodes['Image Texture'].color_space = \"NONE\" # Sozinho! Coloca como Non-Color Data\n\n\n        materialOutput = m.nodes['Material Output']\n\n        m.link(ImageTexture, 'Color', materialOutput, 'Surface')\n\n        # Faze ro link com o GROUP\n\n        node_tree = bpy.data.materials[\"mat_\"+Arquivo].node_tree\n        # And a node group that you have in the file:\n        node_group_name = \"GroupVoxelShader\"\n\n\n        nodes = node_tree.nodes\n        links = node_tree.links\n\n        # Let's at least check if some image node and output node exists\n        # you might need a way to determine which ones to use if there are multiple\n        image_node = output_node = None\n        node_group_exists = False\n        for node in nodes:\n            if node.type == 'TEX_IMAGE':\n                image_node = node\n            elif node.type == 'OUTPUT_MATERIAL':\n                output_node = node\n            elif node.type == 'GROUP': # in case the script was used already\n                if node.node_tree.name == node_group_name:\n                    node_group_exists = True\n                    print('exists')\n                    group_node = node\n\n        if output_node and image_node:\n            if node_group_name in bpy.data.node_groups and not node_group_exists:\n                group_node=nodes.new(\"ShaderNodeGroup\")\n                # Creating the group is not enough, we need to specify data(node tree) for it\n                group_node.node_tree = bpy.data.node_groups[node_group_name]\n                group_node.location = (0,0) #This is default anyway,  but in case you wish to move it\n\n            links.new(image_node.outputs[0], group_node.inputs[0])\n            links.new(group_node.outputs[0], output_node.inputs[0])\n\n\n\n        # Código original\n        '''\n        ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n        ImageTexture.image = bpy.data.images.load(image_path)\n\n\n        diffuseBSDF = m.nodes['Principled BSDF']\n        diffuseBSDF.inputs[\"Base Color\"].default_value = [0.3, 0.2, 0.4, 0.5]\n        materialOutput = m.nodes['Material Output']\n        transparentBSDF = m.makeNode('ShaderNodeBsdfTransparent', 'Transparent BSDF')\n        invertColor = m.makeNode('ShaderNodeInvert', 'Invert')\n        mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n        m.dump_node(mixShader)\n        mixShader.inputs['Fac'].default_value = 0.3\n        m.link(transparentBSDF, 'BSDF', mixShader, 1)\n        m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n        m.link(mixShader, 'Shader', materialOutput, 'Surface')\n\n        m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n        m.link(ImageTexture, 'Color', transparentBSDF, 'Color')\n        m.link(ImageTexture, 'Color', mixShader, 'Fac')\n\n        m.link(ImageTexture, 'Color', invertColor, 'Color')\n        m.link(invertColor, 'Color', transparentBSDF, 'Color')\n        '''\n\n        bpy.ops.object.material_slot_remove()\n        bpy.ops.object.material_slot_add()\n\n        bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"mat_\"+Arquivo]\n\n\n        #bpy.context.object.active_material.blend_method = 'BLEND' # Descobri sozinho!\n        #bpy.context.object.active_material.blend_method = 'CLIP'\n        bpy.context.object.active_material.blend_method = 'HASHED' # Para a textura\n\n        if platform.system() == \"Windows\" or platform.system() == \"Darwin\":\n            bpy.context.object.active_material.transparent_shadow_method = 'HASHED'\n\n        if platform.system() == \"Linux\":\n            bpy.context.object.active_material.shadow_method = 'HASHED'\n\n\n\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"CT_Scan Voxel\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"CT_Scan Voxel\")\n            bpy.context.scene.collection.children.link(myCol)\n            obj.instance_collection = myCol\n            bpy.ops.object.collection_link(collection='CT_Scan Voxel')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='CT_Scan Voxel')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n    # Agrupa e ajusta posição\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for Arquivo in ListaArquivos:\n        bpy.data.objects[str(Arquivo).strip('.png')].select_set(True)\n        bpy.context.view_layer.objects.active = bpy.data.objects[str(Arquivo).strip('.png')]\n\n    bpy.ops.object.join()\n\n    bpy.ops.transform.mirror(orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    # Corrige rotacao\n    bpy.ops.transform.rotate(value=3.14159, orient_axis='Z', orient_type='VIEW', orient_matrix=((-1, 0, 0), (0, -1, 0), (-0, 0, -1)), orient_matrix_type='VIEW', mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n\n    bpy.ops.object.modifier_add(type='ARRAY')\n    bpy.context.object.modifiers[\"Array\"].use_constant_offset = True\n    bpy.context.object.modifiers[\"Array\"].use_relative_offset = False\n    bpy.context.object.modifiers[\"Array\"].constant_offset_displace[2] = 0.1\n    bpy.context.object.modifiers[\"Array\"].count = 4\n    bpy.context.object.modifiers[\"Array\"].show_viewport = False\n\n    # Cria booleana\n\n    bpy.context.object.name = \"VOXEL\"\n    bpy.context.object.name = \"VOXEL\"\n\n    VoxelDimensoes = bpy.data.objects['VOXEL'].dimensions\n\n    VoxelLoc = bpy.data.objects['VOXEL'].location\n\n    bpy.ops.mesh.primitive_cube_add(size=2, view_align=False, enter_editmode=False, location=(-24.6565, -42.9511, 16.0004))\n\n    bpy.context.object.name = \"VOXEL_Boolean\"\n    bpy.context.object.name = \"VOXEL_Boolean\"\n\n    bpy.data.objects['VOXEL_Boolean'].dimensions = VoxelDimensoes * 1.01\n    bpy.data.objects['VOXEL_Boolean'].location = VoxelLoc\n\n    bpy.context.object.display_type = 'WIRE'\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['VOXEL'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['VOXEL']\n\n    bpy.ops.object.modifier_add(type='BOOLEAN')\n    bpy.context.object.modifiers[\"Boolean\"].operation = 'INTERSECT'\n    bpy.context.object.modifiers[\"Boolean\"].object = bpy.data.objects[\"VOXEL_Boolean\"]\n\n\n\n    # Renderizador\n    bpy.context.scene.eevee.use_sss = False\n\n    bpy.context.scene.eevee.gtao_distance = 30\n    bpy.context.scene.eevee.gtao_factor = 2\n    #bpy.context.scene.eevee.use_gtao_bounce = True\n\n#    bpy.data.node_groups[\"Shader Nodetree\"].nodes[\"Background\"].inputs[0].default_value = (0.983241, 0.914842, 1, 1)\n\n    #bpy.data.screens[\"Default\"].shading.use_scene_world = True\n\n\n    # Centraliza\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            for region in area.regions:\n                if region.type == 'WINDOW':\n                    override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                    bpy.ops.view3d.view_all(override)\n\n#    bpy.context.space_data.shading.type = 'MATERIAL' # Descobri sozinho!\n\n\n\n#    bpy.ops.file.autopack_toggle()\n\n    bpy.context.scene.frame_end = int(len(ListaArquivos))+1\n\n\n    bpy.types.Scene.IMGPathSeq = bpy.props.StringProperty \\\n      (\n        name = \"IMGPathSeq\",\n        description = \"IMGPathSeq\",\n        default = str(TmpDirPNG)\n      )\n\n    bpy.ops.file.pack_all()\n\n\n\nclass ImportaFatias(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_fatias_dcm\"\n    bl_label = \"Importa fatias de tomografia DICOM\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n       #bpy.ops.object.corrige_dicom()\n       ImportaFatiasDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(ImportaFatias)\n\ndef ImportaFatiasSimplesDef():\n\n    context = bpy.context\n#    obj = context.active_object\n    scn = context.scene\n\n    ExtraiDadosTomo()\n    ConverteDCMparaPNG()\n\n    #Diretorio = \"/home/linux3dcs/prj/Estudos/Tomografia/TOMOGRAFIA_2_MENOR/imagens/\"\n\n    ListaArquivos = sorted(os.listdir(TmpDirPNG))\n#    ListaArquivos = sorted(os.listdir(TmpDirPNG))\n\n\n    DistanciaZ = 0\n\n    EscalaX = DimensaoLateralX * RowsPixels\n    EscalaY = DimensaoLateralY * ColumnsPixels\n\n    # Importa node group\n\n    if platform.system() == \"Linux\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n#        section   = \"\\\\Collection\\\\\"\n#        object    = \"SPLINT\"\n        section   = \"\\\\NodeTree\\\\\"\n        object    = \"GroupVoxelShader\"\n\n    if platform.system() == \"Darwin\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\NodeTree\\\\\"\n        object    = \"GroupVoxelShader\"\n\n    if platform.system() == \"Windows\":\n\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\NodeTree\\\\\"\n        object    = \"GroupVoxelShader\"\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\n\n    # Importa fatias\n    for Arquivo in ListaArquivos:\n\n        bpy.ops.import_image.to_plane(files=[{\"name\":Arquivo, \"name\":Arquivo}], directory=TmpDirPNG)\n\n        bpy.ops.transform.translate(value=(0, 0, DistanciaZ), constraint_axis=(False, False, True), mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)\n\n        bpy.ops.transform.resize(value=(EscalaX, EscalaY, 0), constraint_axis=(False, False, False), mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n        bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)\n\n        #bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                for region in area.regions:\n                    if region.type == 'WINDOW':\n                        override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                        bpy.ops.view3d.view_all(override)\n\n        print(Arquivo)\n\n        DistanciaZ += EspacoSlices\n\n    # ATRIBUI MATERIAL\n\n        m = Material()\n        m.set_cycles()\n        # from chapter 1 of [DRM protected book, could not copy author/title]\n        m.make_material(\"mat_\"+Arquivo)\n\n        image_path = TmpDirPNG+\"/\"+Arquivo\n\n        ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n        ImageTexture.image = bpy.data.images.load(image_path)\n\n        bpy.data.materials[\"mat_\"+Arquivo].node_tree.nodes['Image Texture'].color_space = \"NONE\" # Sozinho! Coloca como Non-Color Data\n\n\n        materialOutput = m.nodes['Material Output']\n\n        m.link(ImageTexture, 'Color', materialOutput, 'Surface')\n\n        # Faze ro link com o GROUP\n\n        node_tree = bpy.data.materials[\"mat_\"+Arquivo].node_tree\n        # And a node group that you have in the file:\n        node_group_name = \"GroupVoxelShader\"\n\n\n        nodes = node_tree.nodes\n        links = node_tree.links\n\n        # Let's at least check if some image node and output node exists\n        # you might need a way to determine which ones to use if there are multiple\n        image_node = output_node = None\n        node_group_exists = False\n        for node in nodes:\n            if node.type == 'TEX_IMAGE':\n                image_node = node\n            elif node.type == 'OUTPUT_MATERIAL':\n                output_node = node\n            elif node.type == 'GROUP': # in case the script was used already\n                if node.node_tree.name == node_group_name:\n                    node_group_exists = True\n                    print('exists')\n                    group_node = node\n\n        if output_node and image_node:\n            if node_group_name in bpy.data.node_groups and not node_group_exists:\n                group_node=nodes.new(\"ShaderNodeGroup\")\n                # Creating the group is not enough, we need to specify data(node tree) for it\n                group_node.node_tree = bpy.data.node_groups[node_group_name]\n                group_node.location = (0,0) #This is default anyway,  but in case you wish to move it\n\n            links.new(image_node.outputs[0], group_node.inputs[0])\n            links.new(group_node.outputs[0], output_node.inputs[0])\n\n\n        bpy.ops.object.material_slot_remove()\n        bpy.ops.object.material_slot_add()\n\n        bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"mat_\"+Arquivo]\n\n\n        #bpy.context.object.active_material.blend_method = 'BLEND' # Descobri sozinho!\n        #bpy.context.object.active_material.blend_method = 'CLIP'\n        bpy.context.object.active_material.blend_method = 'HASHED' # Para a textura\n\n        if platform.system() == \"Windows\" or platform.system() == \"Darwin\":\n            bpy.context.object.active_material.transparent_shadow_method = 'HASHED'\n\n        if platform.system() == \"Linux\":\n            bpy.context.object.active_material.shadow_method = 'HASHED'\n\n\n\n        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n        # ENVIA COLLECTION\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"CT_Scan Voxel\" not in ListaColl:\n\n            obj = context.active_object\n            myCol = bpy.data.collections.new(\"CT_Scan Voxel\")\n            bpy.context.scene.collection.children.link(myCol)\n            obj.instance_collection = myCol\n            bpy.ops.object.collection_link(collection='CT_Scan Voxel')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n        else:\n            obj = context.active_object\n            bpy.ops.object.collection_link(collection='CT_Scan Voxel')\n            bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n    # Agrupa e ajusta posição\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    for Arquivo in ListaArquivos:\n        bpy.data.objects[str(Arquivo).strip('.png')].select_set(True)\n        bpy.context.view_layer.objects.active = bpy.data.objects[str(Arquivo).strip('.png')]\n\n    bpy.ops.object.join()\n\n    bpy.ops.transform.mirror(orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    # Corrige rotacao\n    bpy.ops.transform.rotate(value=3.14159, orient_axis='Z', orient_type='VIEW', orient_matrix=((-1, 0, 0), (0, -1, 0), (-0, 0, -1)), orient_matrix_type='VIEW', mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n\n    bpy.ops.object.modifier_add(type='ARRAY')\n    bpy.context.object.modifiers[\"Array\"].use_constant_offset = True\n    bpy.context.object.modifiers[\"Array\"].use_relative_offset = False\n    bpy.context.object.modifiers[\"Array\"].constant_offset_displace[2] = 0.1\n    bpy.context.object.modifiers[\"Array\"].count = 4\n    bpy.context.object.modifiers[\"Array\"].show_viewport = False\n\n    # Centraliza\n    for area in bpy.context.screen.areas:\n        if area.type == 'VIEW_3D':\n            for region in area.regions:\n                if region.type == 'WINDOW':\n                    override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                    bpy.ops.view3d.view_all(override)\n\n\n    bpy.context.scene.frame_end = int(len(ListaArquivos))+1\n\n\n    bpy.types.Scene.IMGPathSeq = bpy.props.StringProperty \\\n      (\n        name = \"IMGPathSeq\",\n        description = \"IMGPathSeq\",\n        default = str(TmpDirPNG)\n      )\n\n    bpy.ops.file.pack_all()\n\n\nclass ImportaFatiasSimples(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_fatias_simples_dcm\"\n    bl_label = \"Import DICOM slices\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n       #bpy.ops.object.corrige_dicom()\n       ImportaFatiasSimplesDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(ImportaFatiasSimples)\n\n\ndef FatiasAxialSagitalCoronalDef():\n\n    context = bpy.context\n    scn = context.scene\n    obj = context.object\n\n    bpy.context.space_data.shading.type = 'MATERIAL' # Descobri sozinho!\n    bpy.context.space_data.shading.use_scene_world = True # Tem que ser aqui  - muda fundo\n\n    tmpdirAxial = tempfile.mkdtemp()\n    tmpdirCoronal = tempfile.mkdtemp()\n    tmpdirSagital = tempfile.mkdtemp()\n\n    # Converte tomos em dicom\n    def GeraSlicesVista(Vista, DiretorioDestino):\n\n        context = bpy.context\n        scn = context.scene\n\n        os.chdir(scn.my_tool.path)\n\n        if platform.system() == \"Linux\":\n            os.system(\"dicomtodicom --verbose --\"+Vista+\" -o \"+DiretorioDestino+\" *\")\n\n        if platform.system() == \"Darwin\":\n            os.system(homeall+\"/Programs/OrtogOnBlender/vtk-dicom/./dicomtodicom --verbose --\"+Vista+\" -o \"+DiretorioDestino+\" *\")\n\n        if platform.system() == \"Windows\":\n            os.system(\"C:\\\\OrtogOnBlender\\\\dicomtools\\\\dicomtodicom --verbose --\"+Vista+\" -o \"+DiretorioDestino+\" *\")\n\n    GeraSlicesVista(\"axial\", tmpdirAxial)\n    GeraSlicesVista(\"coronal\", tmpdirCoronal)\n    GeraSlicesVista(\"sagittal\", tmpdirSagital)\n\n    # Renomeia arquivos para evitar problema de nome dubplicado\n    # É possível que no futuro seja necessário renomear com ID dia_mes_ano_hora_minuto_segundo_milesimo, tem que ser assim para criar um ID único, com número de ordem ou afins pode ser duplicado.\n\n    def ConverteNome(Diretorio, NomeBase):\n\n    \tListaArquivos = os.listdir(Diretorio)\n\n    \tos.chdir(Diretorio)\n\n    \tfor i in ListaArquivos:\n    \t\tos.rename(i,NomeBase+\"-\"+i)\n\n    \tprint(\"Renomeado para\", NomeBase)\n\n    ConverteNome(tmpdirAxial, \"Axial\")\n    ConverteNome(tmpdirCoronal, \"Coronal\")\n    ConverteNome(tmpdirSagital, \"Sagital\")\n\n    scn.my_tool.path = tmpdirAxial\n    bpy.ops.object.importa_fatias_simples_dcm()\n    bpy.context.object.name = \"VOXEL_AXIAL\"\n    bpy.context.object.name = \"VOXEL_AXIAL\"\n\n    scn.my_tool.path = tmpdirCoronal\n    bpy.ops.object.importa_fatias_simples_dcm()\n    bpy.context.object.name = \"VOXEL_CORONAL\"\n    bpy.context.object.name = \"VOXEL_CORONAL\"\n\n    bpy.ops.transform.rotate(value=-1.5708, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)\n\n    bpy.data.objects['VOXEL_CORONAL'].location = bpy.data.objects['VOXEL_AXIAL'].location\n    bpy.data.objects['VOXEL_CORONAL'].dimensions = bpy.data.objects['VOXEL_AXIAL'].dimensions\n\n    bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)\n\n    scn.my_tool.path = tmpdirSagital\n    bpy.ops.object.importa_fatias_simples_dcm()\n    bpy.context.object.name = \"VOXEL_SAGITTAL\"\n    bpy.context.object.name = \"VOXEL_SAGITTAL\"\n\n    bpy.ops.transform.rotate(value=-1.5708, orient_axis='Y', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.transform.rotate(value=-1.5708, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)\n\n    bpy.data.objects['VOXEL_SAGITTAL'].location = bpy.data.objects['VOXEL_AXIAL'].location\n    bpy.data.objects['VOXEL_SAGITTAL'].dimensions = bpy.data.objects['VOXEL_AXIAL'].dimensions\n\n    bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)\n\n    #Renderização\n    #bpy.context.scene.eevee.use_gtao = True\n    bpy.context.scene.eevee.gtao_distance = 8\n    bpy.context.scene.eevee.use_gtao_bent_normals = False\n    # bpy.context.scene.eevee.use_bloom = True # NÃO FICA BOM!\n    bpy.context.scene.eevee.use_sss = False #Senão não fica bom!\n    bpy.context.scene.eevee.use_ssr = True\n    bpy.context.scene.eevee.use_ssr_refraction = True\n    bpy.context.scene.eevee.ssr_thickness = 3\n    bpy.context.scene.render.hair_type = 'STRIP'\n    bpy.context.scene.eevee.shadow_method = 'ESM'\n    bpy.context.scene.eevee.shadow_cube_size = '512'\n    bpy.context.scene.eevee.shadow_cascade_size = '512'\n    bpy.context.scene.eevee.use_soft_shadows = True\n    bpy.context.scene.eevee.light_threshold = 0.013\n    bpy.context.scene.view_settings.exposure = 0.2\n\n    bpy.context.scene.render.engine = 'BLENDER_EEVEE'\n\n    # Background\n    BackNodeTree = bpy.data.materials.data.worlds['World'].node_tree\n    BackNodeTree.nodes['Background'].inputs['Color'].default_value = (1,1,1,1)\n\n    # Boolean\n\n    VoxelDimensoes = bpy.data.objects['VOXEL_AXIAL'].dimensions\n\n    VoxelLoc = bpy.data.objects['VOXEL_AXIAL'].location\n\n    bpy.ops.mesh.primitive_cube_add(size=2, view_align=False, enter_editmode=False, location=(0, 0, 0))\n\n    bpy.context.object.name = \"VOXEL_Boolean\"\n    bpy.context.object.name = \"VOXEL_Boolean\"\n\n    bpy.data.objects['VOXEL_Boolean'].dimensions = VoxelDimensoes * 1.01\n    bpy.data.objects['VOXEL_Boolean'].location = VoxelLoc\n\n    bpy.context.object.display_type = 'WIRE'\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['VOXEL_AXIAL'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['VOXEL_AXIAL']\n\n    bpy.ops.object.modifier_add(type='BOOLEAN')\n    bpy.context.object.modifiers[\"Boolean\"].operation = 'INTERSECT'\n    bpy.context.object.modifiers[\"Boolean\"].object = bpy.data.objects[\"VOXEL_Boolean\"]\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['VOXEL_CORONAL'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['VOXEL_CORONAL']\n\n    bpy.ops.object.modifier_add(type='BOOLEAN')\n    bpy.context.object.modifiers[\"Boolean\"].operation = 'INTERSECT'\n    bpy.context.object.modifiers[\"Boolean\"].object = bpy.data.objects[\"VOXEL_Boolean\"]\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['VOXEL_SAGITTAL'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['VOXEL_SAGITTAL']\n\n    bpy.ops.object.modifier_add(type='BOOLEAN')\n    bpy.context.object.modifiers[\"Boolean\"].operation = 'INTERSECT'\n    bpy.context.object.modifiers[\"Boolean\"].object = bpy.data.objects[\"VOXEL_Boolean\"]\n\nclass FatiasAxialSagitalCoronal(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_fatias_axial_coronal_sagital\"\n    bl_label = \"Import DICOM slices axial, coronal and sagittal\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n       #bpy.ops.object.corrige_dicom()\n       FatiasAxialSagitalCoronalDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(FatiasAxialSagitalCoronal)\n\n# IMPORTA IMAGENS\n\ndef ImportaSeqTomoDef(self, context):\n\n    layout = self.layout\n    scn = context.scene\n    obj = context.object\n\n    IMGDir = str(bpy.types.Scene.IMGPathSeq[1]['default'])\n\n    ListaArquivos = sorted(os.listdir(IMGDir))\n\n    listaIMG=[]\n\n    for Arquivo in ListaArquivos:\n        listaIMG.append( {\"name\":Arquivo, \"name\":Arquivo} )\n\n    print(listaIMG)\n\n    bpy.ops.image.open(directory=IMGDir, files=listaIMG, relative_path=True, show_multiview=False)\n    bpy.data.images[str(ListaArquivos[0])].source = 'SEQUENCE'\n\n    space = context.space_data\n    space.image_user.use_auto_refresh = True\n\n\n#    bpy.data.screens[\"Default\"]..use_auto_refresh = True\n\nclass ImportaSeqTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_img_tomo\"\n    bl_label = \"Import CT-Scan Images\"\n\n    def execute(self, context):\n        ImportaSeqTomoDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(ImportaSeqTomo)\n\ndef ExportaSeqTomoDef(self, context):\n\n    layout = self.layout\n    scn = context.scene\n    obj = context.object\n\n    IMGDir = str(bpy.types.Scene.IMGPathSeq[1]['default'])\n\n    SliceThickness = str(bpy.types.Scene.SliceThickness[1]['default'])\n\n    PixelSpacingX = str(bpy.types.Scene.PixelSpacingX[1]['default'])\n\n    PixelSpacingY = str(bpy.types.Scene.PixelSpacingY[1]['default'])\n\n    DimPixelX = str(bpy.types.Scene.IMGDimX[1]['default'])\n\n    DimPixelY = str(bpy.types.Scene.IMGDimY[1]['default'])\n\n    DirDcmExp = tempfile.mkdtemp()\n\n    if platform.system() == \"Linux\":\n\n        subprocess.call('cd '+IMGDir+' && mkdir GREY && for i in *.png; do convert $i -type Grayscale -depth 8 GREY/$i; done', shell=True)\n        print(\"PNGs GERADOS!!!\")\n\n        with open(\"/etc/issue\") as f:\n         Versao = str(f.read().lower().split()[1])\n\n        if Versao == \"18.04\":\n\n            subprocess.call('python ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -i '+IMGDir+'/GREY/ -o '+DirDcmExp+' -s '+PixelSpacingX+' '+PixelSpacingY+' '+SliceThickness+' -t png', shell=True)\n        print(\"DICOM BASE GERADO!!!\")\n\n        if Versao == \"20.04\":\n\n            subprocess.call('python3 ~/Programs/OrtogOnBlender/Img2Dcm2004/img2dcm.py -i '+IMGDir+'/GREY/ -o '+DirDcmExp+' -s '+PixelSpacingX+' '+PixelSpacingY+' '+SliceThickness+' -t png', shell=True)\n\n            #print(\"Entrando....\")\n            #subprocess.call('cd '+IMGDir+'/GREY/ && for i in *.png; do convert -quality 100 $i ${i%.png}.jpg; done && for i in *.jpg; do img2dcm $i ${i%.jpg}.dcm; done && mv *.dcm '+DirDcmExp, shell=True)\n            #print(\"Feito\")\n\n            ListaArquivos = sorted(os.listdir(DirDcmExp))\n\n            os.chdir(DirDcmExp)\n\n            for fatia in range(len(ListaArquivos)):\n                ds = dicom.dcmread(str(ListaArquivos[fatia]), force=True)\n                ds.SeriesNumber = \"1\"\n                ds.AccessionNumber = \"1\"\n                ds.Modality = \"CT\"\n                #ds.ImagePositionPatient = \"0\\\\0\\\\\"+str((fatia)*float(SliceThickness)) # Valor do SliceThickness\n                ds.PatientID = \"OrtogOnBlender\"\n                ds.InstanceNumber = str(int(fatia)-1)\n                ds.SliceThickness = SliceThickness\n                ds.SliceLocation = str((fatia)*float(SliceThickness))\n                ds.PixelSpacing = PixelSpacingX+\"\\\\\"+PixelSpacingY\n                ds.StudyID = \"TESTEID\"\n                ds.PatientName = \"Teste\"\n                ds.Rows = int(float(DimPixelX))\n                ds.Columns = int(float(DimPixelY))\n                ds.save_as(str(ListaArquivos[fatia]))\n\n                scn.my_tool.path = DirDcmExp\n                print(\"DirDcmExp:\", DirDcmExp)\n\n        scn.my_tool.path = DirDcmExp+\"/\"\n\n        bpy.ops.object.corrige_dicom()\n\n\n        # Corrige Raw\n        tmpdirTomo2 = tempfile.mkdtemp()\n\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('for i in *; do gdcmconv -w -i $i -o '+tmpdirTomo2+'/$i; done', shell=True)\n            print(\"Tomografia corrigida!!!\")\n\n        if platform.system() == \"Windows\":\n            subprocess.call('for %f in (*) do C:\\OrtogOnBlender\\GDCM\\\\bin\\gdcmconv -w -i %f -o '+tmpdirTomo2+'/%f', shell=True)\n            print(\"Tomografia corrigida!!!\")\n\n        scn.my_tool.path = tmpdirTomo2+\"/\"\n        print(\"tmpdirTomo2:\", tmpdirTomo2)\n\n#            subprocess.call('python2 ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -i '+IMGDir+'/GREY/ -o '+DirDcmExp+' -s '+PixelSpacingX+' '+PixelSpacingY+' '+SliceThickness+' -t png', shell=True)\n        print(\"DICOM BASE GERADO!!!\")\n\n#        ListaArquivos = sorted(os.listdir(DirDcmExp))\n       # ListaArquivos = sorted(os.listdir(IMGDir+'/GREY/'))\n\n#        subprocess.call('cd '+DirDcmExp, shell=True)\n\n#        for fatia in range(len(ListaArquivos)):\n#            ds = dicom.dcmread(ListaArquivos[fatia])\n#            ds.ImagePositionPatient[2] = int(fatia)*float(SliceThickness)\n#            print(\"Fatia\", ListaArquivos[fatia], \"Slice\", int(fatia)*float(SliceThickness))\n#            ds.save_as(ListaArquivos[fatia])\n#        print(\"LOOP FINALIZADO\")\n\n\n\n\n    if platform.system() == \"Darwin\":\n\n\n# Converte slices em PNGs e depois o PNGs em JPGs monocromaticos\n        subprocess.call('cd '+IMGDir+' && mkdir GREY && for i in *.png; do convert $i -type Grayscale -depth 8 -quality 100 GREY/${i%.png}.jpg; done', shell=True)\n        print(\"JPEGs GERADOS!!!\")\n\n        subprocess.call('cd '+IMGDir+'/GREY/ && for i in *.jpg; do img2dcm $i ${i%.jpg}.dcm; done && rm *.jpg', shell=True)\n\n# Ajusta os DICOMs nos campos que dao erro\n        ListaArquivos = sorted(os.listdir(IMGDir+\"/GREY/\"))\n\n        os.chdir(IMGDir+\"/GREY/\")\n\n        for fatia in range(len(ListaArquivos)):\n            ds = dicom.dcmread(str(ListaArquivos[fatia]), force=True)\n            ds.SeriesNumber = \"1\"\n            ds.AccessionNumber = \"1\"\n            ds.Modality = \"CT\"\n            ds.ImagePositionPatient = \"0\\\\0\\\\\"+str((fatia)*float(SliceThickness)) # Valor do SliceThickness\n            ds.PatientID = \"OrtogOnBlender\"\n            #ds.InstanceNumber = str(int(fatia)-1)\n            ds.SliceThickness = SliceThickness\n            ds.PixelSpacing = PixelSpacingX+\"\\\\\"+PixelSpacingY\n            ds.StudyID = \"TESTEID\"\n            ds.PatientName = \"Teste\"\n            ds.Rows = int(float(DimPixelX))\n            ds.Columns = int(float(DimPixelY))\n            ds.save_as(str(ListaArquivos[fatia]))\n\n            scn.my_tool.path = IMGDir+\"/GREY/\"\n\n\n    if platform.system() == \"Windows\":\n\n\n        DirGrayDcm = tempfile.mkdtemp()\n\n        os.chdir(IMGDir)\n\n# Converte slices em PNGs e depois o PNGs em JPGs monocromaticos\n#        subprocess.call('for %f in (*); do C:\\OrtogOnBlender\\ImageMagick\\magick %f -type Grayscale -depth 8 -quality 100 %f.jpg; done && mkdir GREY && move *.jpg GREY', shell=True)\n\n        subprocess.call('C:\\OrtogOnBlender\\ImageMagick\\mogrify -type Grayscale -format jpg *.png && mkdir GREY && move *.jpg GREY', shell=True)\n\n        print(\"JPEGs GERADOS!!!\")\n        scn.my_tool.path = IMGDir\n\n#        subprocess.call('cd '+IMGDir+'/GREY & mkdir DCM', shell=True)\n\n#        subprocess.call('cd '+IMGDir+'/GREY & for %f in *.jpg do C:\\OrtogOnBlender\\dcmtk\\img2dcm %f %f.dcm', shell=True)\n\n        ListaArquivos = sorted(os.listdir(IMGDir+\"/GREY/\"))\n\n        os.chdir(IMGDir+\"/GREY/\")\n\n        for arquivo in ListaArquivos:\n            subprocess.call('C:\\OrtogOnBlender\\dcmtk\\img2dcm '+arquivo+' '+DirGrayDcm+'\\\\'+arquivo+'.dcm', shell=True)\n            print(\"Arquivo \"+arquivo+\" gerado!\")\n\n#            scn.my_tool.path = DirGrayDcm\n\n# Ajusta os DICOMs nos campos que dao erro\n        ListaArquivos = sorted(os.listdir(DirGrayDcm))\n\n        os.chdir(DirGrayDcm)\n\n        for fatia in range(len(ListaArquivos)):\n            ds = dicom.dcmread(str(ListaArquivos[fatia]), force=True)\n            ds.SeriesNumber = \"1\"\n            ds.AccessionNumber = \"1\"\n            ds.Modality = \"CT\"\n            ds.ImagePositionPatient = \"0\\\\0\\\\\"+str((fatia)*float(SliceThickness)) # Valor do SliceThickness\n            ds.PatientID = \"OrtogOnBlender\"\n            ds.InstanceNumber = str(int(fatia)-1)\n            ds.SliceThickness = SliceThickness\n            ds.PixelSpacing = PixelSpacingX+\"\\\\\"+PixelSpacingY\n            ds.StudyID = \"TESTEID\"\n            ds.PatientName = \"Teste\"\n            ds.Rows = int(float(DimPixelX))\n            ds.Columns = int(float(DimPixelY))\n            ds.save_as(str(ListaArquivos[fatia]))\n            print(\"Ajustados parâmetros de \"+str(fatia))\n\n            scn.my_tool.path = DirGrayDcm\n\n# Ajusta com o dicomtodicom e corrige os pontos que dao erro na importacao\n\n\n        bpy.ops.object.corrige_dicom()\n\n\n        ListaArquivos = sorted(os.listdir(DirGrayDcm+\"/FIXED/\"))\n\n        os.chdir(DirGrayDcm+\"/FIXED/\")\n\n        for fatia in range(len(ListaArquivos)):\n            ds = dicom.dcmread(str(ListaArquivos[fatia]), force=True)\n            ds.SeriesNumber = \"1\"\n            ds.AccessionNumber = \"1\"\n            ds.Modality = \"CT\"\n            ds.ImagePositionPatient = \"0\\\\0\\\\\"+str((fatia)*float(SliceThickness)) # Valor do SliceThickness\n            ds.PatientID = \"OrtogOnBlender\"\n            ds.InstanceNumber = str(int(fatia)-1)\n            ds.SliceThickness = SliceThickness\n            ds.PixelSpacing = PixelSpacingX+\"\\\\\"+PixelSpacingY\n            ds.StudyID = \"TESTEID\"\n            ds.PatientName = \"Teste\"\n            ds.Rows = int(float(DimPixelX))\n            ds.Columns = int(float(DimPixelY))\n            ds.save_as(str(ListaArquivos[fatia]))\n            print(\"Ajustados FIXED de \"+str(fatia))\n\n\n            scn.my_tool.path = DirGrayDcm+\"/FIXED/\"\n\n\nclass ExportaSeqTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.exporta_img_tomo\"\n    bl_label = \"Teste\"\n\n    def execute(self, context):\n        ExportaSeqTomoDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(ExportaSeqTomo)\n\n\n# Abre o SLicer para ver o Threshold\n\ndef AbreSlicerDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    if scn.my_tool.path == \"\":\n            bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n            return {'FINISHED'}\n\n    else:\n\n        homeall = expanduser(\"~\")\n\n        os.chdir(scn.my_tool.path)\n        DirAtual = os.getcwd()\n        ArqAtual = os.listdir(os.getcwd())[0]\n        print(\"Atual:\", os.getcwd())\n        print (os.listdir(os.getcwd())[0])\n\n\n        # ABRE SLICER\n\n        if platform.system() == \"Linux\":\n            subprocess.call(homeall+'/Programs/OrtogOnBlender/Slicer481/./Slicer '+str(DirAtual+\"/\"+ArqAtual+\" &\"), shell=True)\n\n        if platform.system() == \"Windows\":\n            subprocess.call('START /B C:/OrtogOnBlender/Slicer410/Slicer.exe '+str(DirAtual+\"/\"+ArqAtual), shell=True)\n\n        if platform.system() == \"Darwin\":\n            subprocess.call(homeall+'/Programs/OrtogOnBlender/Slicer/Slicer.app/Contents/MacOS/Slicer '+str(DirAtual+\"/\"+ArqAtual+\" &\"), shell=True)\n\nclass AbreSlicer(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.abre_slicer\"\n    bl_label = \"Open Slicer\"\n\n    def execute(self, context):\n        AbreSlicerDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(AbreSlicer)\n\n\ndef AbreSlicerMHADef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    homeall = expanduser(\"~\")\n\n    if platform.system() == \"Linux\":\n        subprocess.call(homeall+'/Programs/OrtogOnBlender/Slicer481/./Slicer '+scn.my_tool.filepathmha+\" &\", shell=True)\n\n    if platform.system() == \"Windows\":\n        subprocess.call('START /B C:/OrtogOnBlender/Slicer410/Slicer.exe '+scn.my_tool.filepathmha, shell=True)\n\n    if platform.system() == \"Darwin\":\n        subprocess.call(homeall+'/Programs/OrtogOnBlender/Slicer/Slicer.app/Contents/MacOS/Slicer '+scn.my_tool.filepathmha+\" &\", shell=True)\n\nclass AbreSlicerMHA(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.abre_slicer_mha\"\n    bl_label = \"Open Slicer MHA\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        AbreSlicerMHADef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(AbreSlicerMHA)\n\n\ndef VoxelShaderDefaultDef():\n\n    try:\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[0].position = 0.164\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[1].position = 1\n\n        # Cor pele\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.364313\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['RGB Curves'].inputs['Fac'].default_value = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['RGB Curves'].inputs['Fac'].default_value = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[0].position = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.364\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[2].position = 0.776\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[3].position = 1\n\n    except:\n        print(\"Problema com o material do voxel na cena, pode não conter!\")\n\n\nclass VoxelShaderDefault(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.voxelshader_default\"\n    bl_label = \"Voxel Shader Default\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        VoxelShaderDefaultDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(VoxelShaderDefault)\n\n\n\ndef VoxelShaderOssoDef():\n\n    try:\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[0].position = 0.55\n\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[1].position = 1\n\n        # Cor pele\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.364313\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['RGB Curves'].inputs['Fac'].default_value = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['RGB Curves'].inputs['Fac'].default_value = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[0].position = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.364\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[2].position = 0.776\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[3].position = 1\n\n    except:\n        print(\"Problema com o material do voxel na cena, pode não conter!\")\n\n\nclass VoxelShaderOsso(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.voxelshader_osso\"\n    bl_label = \"Voxel Shader Bone\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        VoxelShaderOssoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(VoxelShaderOsso)\n\n\ndef VoxelShaderPeleDef():\n\n    try:\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[0].position = 0.04\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[1].position = 1\n\n        # Cor pele\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.08\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['RGB Curves'].inputs['Fac'].default_value = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[0].position = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.364\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[2].position = 0.776\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[3].position = 1\n\n    except:\n        print(\"Problema com o material do voxel na cena, pode não conter!\")\n\n\nclass VoxelShaderPele(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.voxelshader_pele\"\n    bl_label = \"Voxel Shader Skin\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        VoxelShaderPeleDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(VoxelShaderPele)\n\n\ndef VoxelShaderMusculoDef():\n\n    try:\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[0].position = 0.444\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.004'].color_ramp.elements[1].position = 1\n\n        # Cor pele\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.08\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['RGB Curves'].inputs['Fac'].default_value = 1\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[0].position = 0\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[1].position = 0.108\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[2].position = 0.286\n\n        bpy.data.materials.data.node_groups['GroupVoxelShader'].nodes['ColorRamp.003'].color_ramp.elements[3].position = 1\n\n    except:\n        print(\"Problema com o material do voxel na cena, pode não conter!\")\n\n\nclass VoxelShaderMusculo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.voxelshader_musculo\"\n    bl_label = \"Voxel Shader Muscle\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        VoxelShaderMusculoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(VoxelShaderMusculo)\n"
  },
  {
    "path": "FerrMalhas.py",
    "content": "import bpy\n\n\ndef FechaMoldeSimplesDef(self, context):\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.select_all(action='DESELECT')\n    bpy.ops.mesh.select_non_manifold()\n\n    bpy.ops.mesh.fill()\n    bpy.ops.object.editmode_toggle()\n\n\nclass FechaMoldeSimples(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.fecha_molde_simples\"\n    bl_label = \"Close hole simple\"\n\n    def execute(self, context):\n        FechaMoldeSimplesDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(FechaMoldeSimples)\n\n\ndef ParenteiaObjetosDef():\n\n#    objetos_selecionados = [ o for o in bpy.context.selected_objects ]\n\n#    for i in objetos_selecionados:\n#        if i.visible_get() == True:\n#            bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)\n\n    bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)\n    print(\"Parenteado!\")\n\n\nclass ParenteiaObjetos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.parenteia_objetos\"\n    bl_label = \"Parenteia objetos\"\n\n    def execute(self, context):\n        ParenteiaObjetosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ParenteiaObjetos)\n\n\n\ndef DesparenteiaObjetosDef():\n\n    bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n    print(\"Desparenteado!\")\n\n\nclass DesparenteiaObjetos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desparenteia_objetos\"\n    bl_label = \"Desparenteia objetos\"\n\n    def execute(self, context):\n        DesparenteiaObjetosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(DesparenteiaObjetos)\n\n\ndef CriaShapeKeysDef():\n\n    bpy.ops.object.shape_key_add(from_mix=False)\n    bpy.ops.object.shape_key_add(from_mix=False)\n    bpy.data.shape_keys[\"Key\"].key_blocks[\"Key 1\"].value = 1\n\n\nclass CriaShapeKeys(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_shape_keys\"\n    bl_label = \"Cria ShapeKeys Def\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        CriaShapeKeysDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaShapeKeys)\n\n\nclass EntraEditModeLimpo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.entra_editmode_limpo\"\n    bl_label = \"Cria ShapeKeys Def\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.mesh.select_all(action='DESELECT')\n        return {'FINISHED'}\n\nbpy.utils.register_class(EntraEditModeLimpo)\n\n\ndef SelecionaObjeto(NomeObjeto):\n\n    context = bpy.context\n    scn = context.scene\n\n    objeto = bpy.data.objects[NomeObjeto]\n    bpy.ops.object.select_all(action='DESELECT')\n    objeto.select_set(True)\n    context.view_layer.objects.active = objeto\n"
  },
  {
    "path": "FerrMedidas.py",
    "content": "import bpy\nimport math\nfrom math import sqrt\n\ndef CriaPontoMedidasDef():\n\n    context = bpy.context\n    objInicial = context.active_object # Objeto selecionado\n    scn = context.scene\n\n    bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n\n    bpy.context.object.name = bpy.context.scene.nome_ponto_customizado\n    #bpy.context.object.show_name = True\n\n    obj = context.active_object # Muda para o ponto\n\n\n    # Atribui a coleção\n\n    ListaColecoes = []\n    ColocoesCena =  bpy.data.collections\n    colecao = \"Anatomical Measure Custom\"\n\n    for i in ColocoesCena:\n        ListaColecoes.append(i.name)\n\n    if colecao in ListaColecoes:\n        bpy.ops.object.collection_link(collection=colecao)\n#        bpy.data.collections['Collection'].objects.unlink(obj)\n    else:\n        myCol = bpy.data.collections.new(colecao)\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection=colecao)\n#        bpy.data.collections['Collection'].objects.unlink(obj)\n\n    bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n    # Adiciona material\n\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatCustomPoints' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatCustomPoints\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.8, 0.7, 0, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatCustomPoints\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.8, 0.70, 0, 1)\n\n    bpy.ops.object.duplicate_move()\n    bpy.context.object.name = bpy.context.scene.nome_ponto_customizado+\"Parent\"\n    objParent = context.active_object\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    # Parenteia cópia a osteotomia\n    objInicial.select_set(True)\n    objParent.select_set(True)\n    bpy.context.view_layer.objects.active = objInicial\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n\n    # Cria objeto X\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.object.duplicate_move()\n    bpy.context.object.name = bpy.context.scene.nome_ponto_customizado+\"X\"\n    objX = context.active_object\n\n    # Apaga todos os Materiais do objeto\n\n    for ob in bpy.context.selected_editable_objects:\n        ob.active_material_index = 0\n        for i in range(len(ob.material_slots)):\n            bpy.ops.object.material_slot_remove({'object': ob})\n\n    # Cria e atribui material\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatCustomPointsX' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatCustomPointsX\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.8, 0, 0, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatCustomPointsX\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.8, 0, 0, 1)\n\n    # Atribui constraint X\n    bpy.ops.object.constraint_add(type='COPY_LOCATION')\n    bpy.context.object.constraints[\"Copy Location\"].target = objParent\n    bpy.context.object.constraints[\"Copy Location\"].use_y = False\n    bpy.context.object.constraints[\"Copy Location\"].use_z = False\n\n    # Atribui medida X\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    objX.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.context.scene.measureit_default_color = (1, 0.210597, 0.00242219, 1)\n    bpy.context.scene.measureit_font_size = 22\n    bpy.ops.measureit.addlink()\n    bpy.ops.object.select_all(action='DESELECT')\n\n\n    # Cria objeto Y\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.object.duplicate_move()\n    bpy.context.object.name = bpy.context.scene.nome_ponto_customizado+\"Y\"\n    objY = context.active_object\n\n    # Apaga todos os Materiais do objeto\n\n    for ob in bpy.context.selected_editable_objects:\n        ob.active_material_index = 0\n        for i in range(len(ob.material_slots)):\n            bpy.ops.object.material_slot_remove({'object': ob})\n\n    # Cria e atribui material\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatCustomPointsY' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatCustomPointsY\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0, 0.8, 0, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatCustomPointsY\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0, 0.8, 0, 1)\n\n    # Atribui constraint Y\n    bpy.ops.object.constraint_add(type='COPY_LOCATION')\n    bpy.context.object.constraints[\"Copy Location\"].target = objParent\n    bpy.context.object.constraints[\"Copy Location\"].use_x = False\n    bpy.context.object.constraints[\"Copy Location\"].use_z = False\n\n    # Atribui medida Y\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    objY.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.context.scene.measureit_default_color = (0.393438, 1, 0.265891, 1)\n    bpy.context.scene.measureit_font_size = 22\n    bpy.ops.measureit.addlink()\n\n\n\n    # Cria objeto Z\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.object.duplicate_move()\n    bpy.context.object.name = bpy.context.scene.nome_ponto_customizado+\"Z\"\n    objZ = context.active_object\n\n    # Apaga todos os Materiais do objeto\n\n    for ob in bpy.context.selected_editable_objects:\n        ob.active_material_index = 0\n        for i in range(len(ob.material_slots)):\n            bpy.ops.object.material_slot_remove({'object': ob})\n\n    # Cria e atribui material\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatCustomPointsZ' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatCustomPointsZ\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0, 0, 0.8, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatCustomPointsZ\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0, 0, 0.8, 1)\n\n    # Atribui constraint Z\n    bpy.ops.object.constraint_add(type='COPY_LOCATION')\n    bpy.context.object.constraints[\"Copy Location\"].target = objParent\n    bpy.context.object.constraints[\"Copy Location\"].use_x = False\n    bpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n    # Atribui medida Z\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    objZ.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.context.scene.measureit_default_color = (0.49548, 0.676547, 1, 1)\n    bpy.context.scene.measureit_font_size = 22\n    bpy.ops.measureit.addlink()\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    # Apagar as medidas a MAIS\n\n\n    objY.select_set(True)\n    bpy.context.view_layer.objects.active = objY\n    bpy.ops.measureit.deletesegment(tag=0)\n    bpy.ops.object.select_all(action='DESELECT')\n\n    objZ.select_set(True)\n    bpy.context.view_layer.objects.active = objZ\n    bpy.ops.measureit.deletesegment(tag=0)\n    bpy.ops.measureit.deletesegment(tag=0)\n    bpy.ops.object.select_all(action='DESELECT')\n\n\nclass CriaPontoMedida(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_ponto_medida\"\n    bl_label = \"Create Measure Anatomical Point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = len(bpy.context.selected_objects)\n\n        if found == 1:\n            return True\n        else:\n            if found != 1:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoMedidasDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaPontoMedida)\n\n\ndef CalculaAngulo(Obj1, Obj2, Obj3):\n\n        # Calcula\n\n        d1_2 = DistanciaObjetos(Obj1, Obj2)\n        d2_3 = DistanciaObjetos(Obj2, Obj3)\n        d1_3 = DistanciaObjetos(Obj1, Obj3)\n\n\n        Grau = (d2_3**2 + d1_2**2 - d1_3**2) / (2 * d2_3 * d1_2)\n\n        Angulo = float(round(math.degrees(math.acos(Grau)),2))\n\n        print(\"Grau (rad):\", Grau)\n\n        print(\"Ângulo:\", Angulo)\n\n        return str(Angulo)+\"º\"\n\n\ndef DistanciaObjetos(obj1, obj2):\n\n    objA = bpy.data.objects[obj1].location\n    objB = bpy.data.objects[obj2].location\n\n    distancia = sqrt( (objB[0] - objA[0])**2 + (objB[1] - objA[1])**2 + (objB[2] - objA[2])**2 )\n\n    print(\"Distancia\", obj1 , \"<-->\", obj2 , \"=\" , distancia )\n\n    return distancia\n\n\n\ndef MedidasVerDentesDef(self, context):\n\n\tcontext = bpy.context\n\tobj = context.active_object\n\n\tbpy.context.scene.measureit_default_color = (1, 1, 1, 1)\n\tbpy.context.scene.measureit_font_size = 16\n\n\tbpy.ops.mesh.add_linhabase(location=(0,0,0), rotation=(0, 1.5708, 0))\n#\tbpy.context.object.show_x_ray = True\n\tbpy.context.object.lock_location[0] = True\n\tbpy.context.object.lock_location[1] = True\n\tbpy.context.object.name = \"LinhaMedida\"\n\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\n\t# CRIA CÓPIAS DOS EMPTIES\n\n\tbpy.data.objects['Tooth 8'].select_set(True)\n\tbpy.data.objects['Tooth 9'].select_set(True)\n\tbpy.data.objects['Tooth 6'].select_set(True)\n\tbpy.data.objects['Tooth 11'].select_set(True)\n\tbpy.data.objects['Tooth 3'].select_set(True)\n\tbpy.data.objects['Tooth 14'].select_set(True)\n\n\tbpy.ops.object.duplicate()\n\n\t# TRAVA OS EMPTIES NA LINHA DE REFERÊNCIA\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tobjAct = bpy.data.objects['Tooth 8.001']\n\tobjAct.select_set(True)\n\tcontext.view_layer.objects.active = objAct\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedida\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[\"Tooth 8\"]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tobjAct = bpy.data.objects['Tooth 9.001']\n\tobjAct.select_set(True)\n\tcontext.view_layer.objects.active = objAct\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedida\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[\"Tooth 9\"]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tobjAct = bpy.data.objects['Tooth 6.001']\n\tobjAct.select_set(True)\n\tcontext.view_layer.objects.active = objAct\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedida\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[\"Tooth 6\"]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tobjAct = bpy.data.objects['Tooth 11.001']\n\tobjAct.select_set(True)\n\tcontext.view_layer.objects.active = objAct\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedida\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[\"Tooth 11\"]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tobjAct = bpy.data.objects['Tooth 3.001']\n\tobjAct.select_set(True)\n\tcontext.view_layer.objects.active = objAct\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedida\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[\"Tooth 3\"]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\tobjAct = bpy.data.objects['Tooth 14.001']\n\tobjAct.select_set(True)\n\tcontext.view_layer.objects.active = objAct\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedida\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[\"Tooth 14\"]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\n\n\t# CRIA MEDIDAS\n\n\tbpy.ops.measureit.runopengl()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['Tooth 8']\n\tb = bpy.data.objects['Tooth 8.001']\n\ta.select_set(True)\n\tb.select_set(True)\n\tcontext.view_layer.objects.active = a\n\tbpy.ops.measureit.addlink()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['Tooth 9']\n\tb = bpy.data.objects['Tooth 9.001']\n\ta.select_set(True)\n\tb.select_set(True)\n\tcontext.view_layer.objects.active = a\n\tbpy.ops.measureit.addlink()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['Tooth 6']\n\tb = bpy.data.objects['Tooth 6.001']\n\ta.select_set(True)\n\tb.select_set(True)\n\tcontext.view_layer.objects.active = a\n\tbpy.ops.measureit.addlink()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['Tooth 11']\n\tb = bpy.data.objects['Tooth 11.001']\n\ta.select_set(True)\n\tb.select_set(True)\n\tcontext.view_layer.objects.active = a\n\tbpy.ops.measureit.addlink()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['Tooth 3']\n\tb = bpy.data.objects['Tooth 3.001']\n\ta.select_set(True)\n\tb.select_set(True)\n\tcontext.view_layer.objects.active = a\n\tbpy.ops.measureit.addlink()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['Tooth 14']\n\tb = bpy.data.objects['Tooth 14.001']\n\ta.select_set(True)\n\tb.select_set(True)\n\tcontext.view_layer.objects.active = a\n\tbpy.ops.measureit.addlink()\n\n# SELECIONA LINHA MEDIDA\n\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\ta = bpy.data.objects['LinhaMedida']\n\ta.select_set(True)\n\tcontext.view_layer.objects.active = a\n\ndef CriaMedidaHor(Obj1, Obj2):\n\n\tbpy.context.scene.measureit_default_color = (1, 1, 0, 1)\n\tbpy.context.scene.measureit_font_size = 16\n\n\tbpy.ops.object.empty_add(type='PLAIN_AXES')\n#\tbpy.context.space_data.context = 'CONSTRAINT'\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location\"].target = bpy.data.objects[\"LinhaMedidaHor\"]\n\tbpy.context.object.constraints[\"Copy Location\"].use_y = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_z = False\n\tbpy.context.object.constraints[\"Copy Location\"].use_z = True\n\tbpy.ops.object.constraint_add(type='COPY_LOCATION')\n\tbpy.context.object.constraints[\"Copy Location.001\"].target = bpy.data.objects[Obj1]\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_x = False\n\tbpy.context.object.constraints[\"Copy Location.001\"].use_z = False\n\tbpy.ops.object.parent_set(type='OBJECT', keep_transform=True)\n\tbpy.context.object.name = Obj2\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\n\tbpy.data.objects[Obj1].select_set(True)\n\tbpy.data.objects[Obj2].select_set(True)\n#\tcontext.view_layer.objects.active = bpy.data.objects['Tooth 9.001']\n\n\tbpy.ops.measureit.addlink()\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\n\ndef MedidasHorDentesDef(self, context):\n\n\tcontext = bpy.context\n\tobj = context.active_object\n\n\tbpy.ops.mesh.add_linhabase(location=(0,0,0), rotation=( 1.5708, 0 , 0))\n\n\n#\tbpy.context.object.show_x_ray = True\n\tbpy.context.object.lock_location[0] = True\n\tbpy.context.object.lock_location[1] = True\n\tbpy.context.object.name = \"LinhaMedidaHor\"\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\n\tbpy.data.objects['LinhaMedida'].select_set(True)\n\tbpy.data.objects['LinhaMedidaHor'].select_set(True)\n\tcontext.view_layer.objects.active = bpy.data.objects['LinhaMedida']\n\tbpy.ops.object.parent_set(type='OBJECT', keep_transform=True)\n\n\n\n\tbpy.ops.object.select_all(action='DESELECT')\n\n\n\tCriaMedidaHor(\"Tooth 9.001\", \"EMPHor_9\")\n\tCriaMedidaHor(\"Tooth 8.001\", \"EMPHor_8\")\n\tCriaMedidaHor(\"Tooth 6.001\", \"EMPHor_6\")\n\tCriaMedidaHor(\"Tooth 11.001\", \"EMPHor_11\")\n\tCriaMedidaHor(\"Tooth 3.001\", \"EMPHor_3\")\n\tCriaMedidaHor(\"Tooth 14.001\", \"EMPHor_14\")\n\n\n\nclass MedidasVerHorDentes(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.medverhor_dentes\"\n    bl_label = \"Medidas Verticais\"\n\n    def execute(self, context):\n\n        MedidasVerDentesDef(self, context)\n        MedidasHorDentesDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(MedidasVerHorDentes)\n\n\ndef ApagaPontosCopiadosDef():\n\n    ListaPontos = [\"Tooth 9.001\",\"Tooth 8.001\",\"Tooth 6.001\",\"Tooth 11.001\",\"Tooth 3.001\",\"Tooth 14.001\"]\n\n    for ob in ListaPontos:\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.data.objects[ob].select_set(True)\n        bpy.ops.object.delete(use_global=False)\n\nclass ApagaPontosCopiados(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.apaga_pontos_objetos\"\n    bl_label = \"Apaga Pontos Copiados\"\n\n    def execute(self, context):\n\n        ApagaPontosCopiadosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ApagaPontosCopiados)\n"
  },
  {
    "path": "FerrSegmentacao.py",
    "content": "\nimport bpy\nimport bmesh\nimport tempfile\nimport subprocess\nimport platform\n\n#from .__init__ import *\n\nfrom .AjustaTomo import *\nfrom .ConfOsteotomiaAuto import *\n\nfrom math import sqrt\n\ndef CriaVoxelCubePlanosDef():\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['VoxelCube'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['VoxelCube']\n\n    Origem = bpy.data.objects['VoxelCube'].location\n\n    bpy.ops.mesh.primitive_cube_add(size=300, view_align=False, enter_editmode=False, location=Origem)\n\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatVoxelCube' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatVoxelCube\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (1, 1, 1, 0.5)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatVoxelCube\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (1, 1, 1, 0.5)\n\n\nclass CriaVoxelCubePlanos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_voxelcube_planos\"\n    bl_label = \"Create VoxelCube Planes\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        CriaVoxelCubePlanosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaVoxelCubePlanos)\n\n\ndef ImportaObjBlendDef(nome): #, colecao):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    try:\n        bpy.ops.object.mode_set(mode='OBJECT')\n    except:\n        print(\"Erro com o Object Mode!\")\n\n\n    if platform.system() == \"Linux\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n#        section   = \"\\\\Collection\\\\\"\n#        object    = \"SPLINT\"\n        section   = \"\\\\Object\\\\\"\n        object    = nome\n\n    if platform.system() == \"Darwin\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = nome\n\n    if platform.system() == \"Windows\":\n\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = nome\n\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\n    ObjImportado = bpy.data.objects[nome]\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    ObjImportado.select_set(True)\n    context.view_layer.objects.active = ObjImportado\n\n    # Coloca na camada\n    obj2 = bpy.context.view_layer.objects.active\n\n    '''\n    ListaColl = []\n\n    for i in bpy.data.collections:\n        ListaColl.append(i.name)\n\n    if colecao not in ListaColl:\n\n        myCol = bpy.data.collections.new(colecao)\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection=colecao)\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    else:\n        bpy.ops.object.collection_link(collection=colecao)\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n        '''\n\nclass ImportaVoxelCube(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_voxelcube\"\n    bl_label = \"Import VoxelCube\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'VoxelCube' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ImportaObjBlendDef(\"VoxelCube\") #, \"Collection\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ImportaVoxelCube)\n\n\ndef Converte3DparaVoxelDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    # Seleciona o VoxelCube\n\n    bpy.data.objects['VoxelCube'].select_set(True)\n\n    # Exporta como STL\n    bpy.ops.export_mesh.stl(filepath=tmpdir+\"/Model.stl\", check_existing=True, filter_glob=\"*.stl\", use_selection=True, global_scale=1, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF', axis_forward='Y', axis_up='Z')\n\n    if platform.system() == \"Linux\":\n\n        with open(\"/etc/issue\") as f:\n            Versao = str(f.read().lower().split()[1])\n\n        if Versao == \"18.04\":\n            # Converte objeto em slices de imagens\n            subprocess.call('cd '+tmpdir+' && mkdir '+tmpdir+'/VOXEL && python3 ~/Programs/OrtogOnBlender/StlToVoxel/stltovoxel.py '+tmpdir+'/Model.stl '+tmpdir+'/VOXEL/img.png', shell=True)\n\n            # Converte em greyscale\n            subprocess.call('cd '+tmpdir+'/VOXEL && mkdir '+tmpdir+'/VOXEL/GREY && for i in *.png; do convert $i -type Grayscale -depth 8 '+tmpdir+'/VOXEL/GREY/${i%.png}.png; done', shell=True)\n\n            # Converte em DICOM\n            subprocess.call('cd '+tmpdir+'/VOXEL/GREY && mkdir '+tmpdir+'/VOXEL/GREY/DCM/ && python ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -i '+tmpdir+'/VOXEL/GREY/ -o '+tmpdir+'/VOXEL/GREY/DCM/ -s 0.588 0.588 0.588 -t png', shell=True)\n            print(\"DICOM BASE GERADO!!!\")\n\n            subprocess.call('~/Programs/OrtogOnBlender/VolView/bin/VolView '+tmpdir+'/VOXEL/GREY/DCM/0000.dcm &', shell=True)\n\n        if Versao == \"20.04.1\" or Versao == \"20.04\":\n            # Converte objeto em slices de imagens\n            subprocess.call('cd '+tmpdir+' && mkdir '+tmpdir+'/VOXEL && python3 ~/Programs/OrtogOnBlender/StlToVoxel/stltovoxel.py '+tmpdir+'/Model.stl '+tmpdir+'/VOXEL/img.png', shell=True)\n\n            # Converte em greyscale\n            subprocess.call('cd '+tmpdir+'/VOXEL && mkdir '+tmpdir+'/VOXEL/GREY && for i in *.png; do convert $i -type Grayscale -depth 8 '+tmpdir+'/VOXEL/GREY/${i%.png}.png; done', shell=True)\n\n            # Converte em DICOM\n            subprocess.call('cd '+tmpdir+'/VOXEL/GREY && mkdir '+tmpdir+'/VOXEL/GREY/DCM/ && python2 ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -i '+tmpdir+'/VOXEL/GREY/ -o '+tmpdir+'/VOXEL/GREY/DCM/ -s 0.588 0.588 0.588 -t png', shell=True)\n            print(\"DICOM BASE GERADO!!!\")\n\n            subprocess.call('~/Programs/OrtogOnBlender/VolView/bin/VolView '+tmpdir+'/VOXEL/GREY/DCM/0000.dcm &', shell=True)\n\n\n\n    if platform.system() == \"Windows\":\n\n\n        Temporario = str(tmpdir).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n        os.chdir(tmpdir)\n\n        subprocess.call('mkdir VOXEL', shell=True)\n\n        # Converte objeto em slices de imagens\n        subprocess.call(\"wsl python3 \\\"/mnt/c/OrtogOnBlender/StlToVoxel/stltovoxel.py\\\" \\\"\"+Temporario+\"/Model.stl\\\" \\\"\"+Temporario+\"/VOXEL/img.png\\\"\", shell=True)\n\n\n        # Converte em greyscale\n        os.chdir(tmpdir+\"/VOXEL\")\n        subprocess.call('mkdir GREY', shell=True)\n\n        subprocess.call(\"wsl for i in *.png; do convert $i -type Grayscale -depth 8 GREY/${i%.png}.png; done\", shell=True)\n\n\n        # Converte em DICOM\n        os.chdir(tmpdir+\"/VOXEL/GREY\")\n        subprocess.call('mkdir DEC', shell=True)\n\n        subprocess.call(\"wsl python \\\"/mnt/c/OrtogOnBlender/Img2Dcm/img2dcm.py\\\" -i \\\"\"+Temporario+\"/VOXEL/GREY\\\" -o \\\"\"+Temporario+\"/DCM\\\" -s \\\"0.588\\\" \\\"0.588\\\" \\\"0.588\\\" -t png\", shell=True)\n\n        print(\"DICOM BASE GERADO!!!\")\n\n        #subprocess.call('C:/OrtogOnBlender/VolView/bin/VolView.exe '+tmpdir+'/DCM/0000.dcm', shell=True) # POR ALGUM MOTIVO NÃO FUNCIONA!!! USE O DE BAIXO!\n\n        subprocess.call(\"C:\\\\OrtogOnBlender\\\\VolView\\\\bin\\\\VolView \"+tmpdir+\"\\\\DCM\\\\0000.dcm &\", shell=True)\n\n\nclass Converte3DparaVoxel(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.converte_3d_voxel\"\n    bl_label = \"Convert 3D to Voxel\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'VoxelCube' in bpy.data.objects\n\n        if found == False:\n            return False\n        else:\n            if found == True:\n                return True\n\n    def execute(self, context):\n        Converte3DparaVoxelDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Converte3DparaVoxel)\n\n\n\ndef ConverteImagensTomoDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    s1 = bpy.context.scene.S1\n    s2 = bpy.context.scene.S2\n    s3 = bpy.context.scene.S3\n\n    print(\"s1: \", s1)\n    print(\"s2: \", s2)\n    print(\"s3: \", s3)\n\n    try:\n        tmpdir = tempfile.mkdtemp()\n        print(\"Criei tmp\")\n\n        if platform.system() == \"Linux\":\n\n            subprocess.call('cd '+scn.my_tool.path_slices_img+' && mkdir '+tmpdir+'/GREY && for i in *.jpg; do convert $i -type Grayscale -depth 8 -quality 100 '+tmpdir+'/GREY/${i%.png}.jpg; done', shell=True)\n\n            #subprocess.call('mkdir '+tmpdir+'/DCM && python2.7 ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -t jpg -i '+tmpdir+'/GREY/ -o '+tmpdir+'/DCM/ -s '+str(s1)+' '+str(s2)+' '+str(s3), shell=True)\n\n            subprocess.call('python ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -i '+tmpdir+'/GREY/ -o '+tmpdir+'/DCM/ -s '+str(s1)+' '+str(s2)+' '+str(s3)+' -t jpg', shell=True)\n            print(\"DICOM BASE GERADO!!!\")\n\n            subprocess.call('~/Programs/OrtogOnBlender/VolView/bin/VolView '+tmpdir+'/DCM/0000.dcm &', shell=True)\n\n\n        if platform.system() == \"Windows\":\n\n            os.chdir(scn.my_tool.path_slices_img)\n            print(\"Entrrei\")\n\n            subprocess.call('C:\\OrtogOnBlender\\ImageMagick\\mogrify -type Grayscale -format jpg *.png && mkdir GREY && move *.jpg GREY', shell=True)\n            print(\"Rodei\")\n\n            #subprocess.call('python ~/Programs/OrtogOnBlender/Img2Dcm/img2dcm.py -i '+tmpdir+'/GREY/ -o '+tmpdir+'/DCM/ -s '+str(s1)+' '+str(s2)+' '+str(s3)+' -t jpg', shell=True)\n            #print(\"DICOM BASE GERADO!!!\")\n\n            Entrada = str(scn.my_tool.path_slices_img+\"/GREY\").replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n            Saida = str(scn.my_tool.path_slices_img+\"/DCM\").replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n            subprocess.call(\"mkdir DCM\", shell=True)\n            print(\"Criei DCM\")\n\n            print(\"wsl python \\\"/mnt/c/OrtogOnBlender/Img2Dcm/img2dcm.py\\\" -i \\\"\"+Entrada+\"\\\" -o \\\"\"+Saida+\"\\\" -t jpg\")\n\n            subprocess.call(\"wsl python \\\"/mnt/c/OrtogOnBlender/Img2Dcm/img2dcm.py\\\" -i \\\"\"+Entrada+\"\\\" -o \\\"\"+Saida+\"\\\" -s \"+str(s1)+\" \"+str(s2)+\" \"+str(s3)+\" -t jpg\", shell=True)\n\n\n\n            '''\n\n            ListaArquivos = sorted(os.listdir(scn.my_tool.path_slices_img+\"/GREY/\"))\n\n            os.chdir(scn.my_tool.path_slices_img+\"/GREY/\")\n\n\n            subprocess.call('mkdir DCM', shell=True)\n\n            for arquivo in ListaArquivos:\n                subprocess.call('C:\\OrtogOnBlender\\dcmtk\\img2dcm '+arquivo+' DCM\\\\'+arquivo+'.dcm', shell=True)\n                print(\"Convertendo para DCM:\", arquivo)\n            print(\"Arquivo \"+arquivo+\" gerado!\")\n\n            print(\"C:\\\\OrtogOnBlender\\\\VolView\\\\bin\\\\VolView \"+scn.my_tool.path_slices_img+\"\\\\GREY\\\\DCM\\\\\"+str(ListaArquivos[0])+\".dcm &\")\n            '''\n\n\n            subprocess.call(\"C:\\\\OrtogOnBlender\\\\VolView\\\\bin\\\\VolView \"+scn.my_tool.path_slices_img+\"\\\\DCM\\\\0000.dcm &\", shell=True)\n\n\n\n    except:\n        print(\"Não consegui converter as imagens em GREY!\")\n\nclass ConverteImagensTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.converte_imagens_tomo\"\n    bl_label = \"Convert Images to CT-Scan\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ConverteImagensTomoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ConverteImagensTomo)\n\n\n\ndef CalculaDimensaoDCMDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n#    FatorEscalaDCM = bpy.context.scene.FatorEscalaDCM\n#    MedidaRealDCM = bpy.context.scene.MedidaRealDCM\n#    MedidaAtualDCM = bpy.context.scene.MedidaAtualDCM\n\n    FatorEscala = float(bpy.context.scene.MedidaRealDCM) / float(bpy.context.scene.MedidaAtualDCM)\n\n    bpy.types.Scene.FatorEscalaDCM = bpy.props.StringProperty \\\n    (\n     name = \"\",\n     description = \"Scale Factor\",\n     default = str(round((FatorEscala),2))\n    )\n\nclass CalculaDimensaoDCM(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.calcula_dimensao_dcm\"\n    bl_label = \"Calc CT-Scan Dimension\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        CalculaDimensaoDCMDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CalculaDimensaoDCM)\n\n\ndef ConverteVideoImagemDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    try:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call(\"ffmpeg -i \"+scn.my_tool.filepathvideo+\" -quality 100 \"+tmpdir+\"/pic_%04d.jpg\", shell=True)\n            subprocess.call(\"cd \"+tmpdir+\" && mkdir SELECTED\", shell=True)\n            abrir_diretorio(tmpdir)\n            scn.my_tool.path_slices_img = tmpdir+\"/SELECTED\"\n\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\\\OrtogOnBlender\\\\ffmpeg\\\\ffmpeg.exe -i '+scn.my_tool.filepathvideo+\" -quality 100 \"+tmpdir+\"\\pic_%04d.jpg\", shell=True)\n            #subprocess.call(['C:\\OrtogOnBlender\\ffmpeg\\ffmpeg.exe','-i', scn.my_tool.filepathvideo, '-quality', '100', tmpdir+\"\\pic_%04d.jpg\" ])\n            abrir_diretorio(tmpdir)\n            scn.my_tool.path_slices_img = tmpdir+\"/SELECTED\"\n\n    except:\n        print(\"Algo deu errado com o arquivo de vídeo!\")\n\nclass ConverteVideoImagem(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.converte_video_imagem\"\n    bl_label = \"Convert Video to Image\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ConverteVideoImagemDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ConverteVideoImagem)\n\n\ndef ConverteVideoImagemWINDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    try:\n        if platform.system() == \"Windows\":\n            subprocess.call('C:\\\\OrtogOnBlender\\\\ffmpeg\\\\ffmpeg.exe -i '+scn.my_tool.filepathvideo+\" \"+tmpdir+\"\\pic_%04d.png\", shell=True)\n\n            subprocess.call(\"cd \"+tmpdir+\" && mkdir SELECTED\", shell=True)\n\n            abrir_diretorio(tmpdir)\n            scn.my_tool.path_slices_img = tmpdir+\"/SELECTED\"\n\n    except:\n        print(\"Algo deu errado com o arquivo de vídeo!\")\n\n\nclass ConverteVideoImagemWIN(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.converte_video_imagem_win\"\n    bl_label = \"Convert Video to Image\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ConverteVideoImagemWINDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ConverteVideoImagemWIN)\n\n\n\ndef SegmentaLinkedDef(self, context):\n\n    listaDist = []\n\n#    ponto = bpy.context.scene.cursor_location\n\n    ponto = bpy.context.scene.cursor.location\n\n#    obj = bpy.context.scene.objects.active\n\n    obj = bpy.context.view_layer.objects.active\n\n    # Duplica objeto\n    bpy.ops.object.duplicate()\n    obj2 = bpy.context.view_layer.objects.active\n\n    # Joga outro layer\n\n    #TESTA SE HÁ Copied_Objects\n\n\n    ListaColl = []\n\n    for i in bpy.data.collections:\n        ListaColl.append(i.name)\n\n    if \"Copied_Objects\" not in ListaColl:\n\n        myCol = bpy.data.collections.new(\"Copied_Objects\")\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection='Copied_Objects')\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    else:\n        bpy.ops.object.collection_link(collection='Copied_Objects')\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    bpy.data.collections['Copied_Objects'].hide_viewport=True\n\n#    bpy.ops.object.move_to_layer(layers=(False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False))\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n            # Lista os vértices do objeto\n    if obj.mode == 'EDIT':\n        bm = bmesh.from_edit_mesh(obj.data)\n        vertices = bm.verts\n\n    else:\n        vertices = obj.data.vertices\n\n            # Todos os vértices por vetor\n#    verts = [obj.matrix_world * vert.co for vert in vertices]\n    verts = [obj.matrix_world @ vert.co for vert in vertices]\n\n            # Captura vetor do objeto\n\n    referencia = bpy.context.scene.cursor.location\n\n            # Calcula distância pontos\n\n    def DistanciaObjs(obj1, obj2):\n        objA = referencia\n        objB = obj2\n\n        distancia = sqrt( (objB[0] - objA[0])**2 + (objB[1] - objA[1])**2 + (objB[2] - objA[2])**2 )\n\n        return distancia\n\n\n    for i in range(len(verts)):\n\n        vertAtual = verts[i]\n\n        distanciaVert = DistanciaObjs(ponto, vertAtual)\n\n        listaDist.append([distanciaVert, i])\n\n\n\n    listaFin = sorted(listaDist)\n    print(\"MAIS PRÓXIMO!\", listaFin[0])\n\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n    obj.data.vertices[listaFin[0][1]].select = True\n    bpy.ops.object.mode_set(mode = 'EDIT')\n\n    bpy.ops.mesh.select_linked()\n\n    bpy.ops.mesh.select_all(action='INVERT')\n\n    bpy.ops.mesh.delete(type='VERT')\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n\nclass SegmentaLinked(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.segmenta_linked\"\n    bl_label = \"SegmentaLinked\"\n\n    def execute(self, context):\n        SegmentaLinkedDef(self, context)\n        return {'FINISHED'}\n\n# WEIGHTS\n\ndef Weight1Def(self, context):\n    bpy.ops.object.mode_set(mode='WEIGHT_PAINT')\n    bpy.data.brushes[\"Draw\"].vertex_tool = 'DRAW'\n    bpy.ops.brush.curve_preset(shape='MAX')\n    bpy.context.scene.tool_settings.unified_paint_settings.weight = 1\n\nclass Weight1(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.weight_1\"\n    bl_label = \"Change Weight to 1\"\n\n    def execute(self, context):\n        Weight1Def(self, context)\n        return {'FINISHED'}\n\ndef Weight0Def(self, context):\n    bpy.ops.object.mode_set(mode='WEIGHT_PAINT')\n    bpy.data.brushes[\"Draw\"].vertex_tool = 'DRAW'\n    bpy.ops.brush.curve_preset(shape='MAX')\n    bpy.context.scene.tool_settings.unified_paint_settings.weight = 0\n\nclass Weight0(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.weight_0\"\n    bl_label = \"Change Weight to 0\"\n\n    def execute(self, context):\n        Weight0Def(self, context)\n        return {'FINISHED'}\n\n# Segmentação por pintura - Apaga Azul\n\ndef MantemPintadoDef(self, context):\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    bpy.context.object.name = \"ObjSplint\"\n\n    # Seleciona área interesse\n\n    # Which group to find?\n    groupName = 'Group'\n\n    # Use the active object\n    obj = bpy.context.view_layer.objects.active\n\n    # Make sure you're in edit mode\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    # Deselect all verts\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    # Make sure the active group is the one we want\n    bpy.ops.object.vertex_group_set_active(group=groupName)\n\n    # Select the verts\n    bpy.ops.object.vertex_group_select()\n\n\n    bpy.ops.object.vertex_group_assign()\n    bpy.ops.mesh.select_all(action='INVERT')\n\n    bpy.ops.mesh.delete(type='VERT')\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\nclass MantemPintado(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mantem_pintado\"\n    bl_label = \"MantemPintado\"\n\n    def execute(self, context):\n        MantemPintadoDef(self, context)\n        return {'FINISHED'}\n\n# Segmentação por pintura - Apaga Vermelho\n\ndef ApagaPintadoDef(self, context):\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    bpy.context.object.name = \"ObjSplint\"\n\n    # Seleciona área interesse\n\n    # Which group to find?\n    groupName = 'Group'\n\n    # Use the active object\n    obj = bpy.context.view_layer.objects.active\n\n    # Make sure you're in edit mode\n    bpy.ops.object.mode_set(mode='EDIT')\n\n    # Deselect all verts\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    # Make sure the active group is the one we want\n    bpy.ops.object.vertex_group_set_active(group=groupName)\n\n    # Select the verts\n    bpy.ops.object.vertex_group_select()\n\n\n    bpy.ops.object.vertex_group_assign()\n#    bpy.ops.mesh.select_all(action='INVERT')\n\n    bpy.ops.mesh.delete(type='VERT')\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\nclass ApagaPintado(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.apaga_pintado\"\n    bl_label = \"ApagaPintado\"\n\n    def execute(self, context):\n        ApagaPintadoDef(self, context)\n        return {'FINISHED'}\n\n# SEGMENTA DESENHO\n\ndef SegmentaDesenhoDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    #bpy.ops.gpencil.convert(type='POLY')\n    #bpy.ops.gpencil.convert(type='POLY', use_normalize_weights=True, radius_multiplier=1.0, use_link_strokes=False, timing_mode='FULL', frame_range=100, start_frame=1, use_realtime=False, end_frame=250, gap_duration=0.0, gap_randomness=0.0, seed=0, use_timing_data=False)\n\n    # Desenha\n\n    bpy.ops.gpencil.convert_old_files()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.convert(type='POLY', use_timing_data=True)\n\n    # Seleciona linha e converte em mesh\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['Note']\n    linha.select_set(True)\n#    linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n\n    bpy.ops.object.convert(target='MESH')\n\n\n#    bpy.ops.gpencil.layer_remove()\n#    bpy.ops.object.editmode_toggle()\n#    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha.select_set(True)\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n    bpy.ops.object.mode_set(mode='EDIT')\n#    bpy.ops.object.editmode_toggle()\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n#    for v in mesh.verts:\n    for v in mesh.verts and mesh.faces:\n        #print(v)\n        v.select = True\n#        v.select = True\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active # Atualiza viewport\n\n#    bpy.ops.mesh.flip_normals() # Inverter para funcionar o Knife fora a fora\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n\n    bpy.ops.mesh.select_mode(type='FACE')\n    bpy.ops.mesh.knife_project(cut_through=True) # CUIDADO! Seleciona apenas a parte de trás\n#    bpy.context.scene.objects.active = bpy.context.scene.objects.active\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active\n    bpy.ops.mesh.select_all(action='INVERT')\n    bpy.ops.mesh.separate(type='SELECTED')\n#    bpy.ops.mesh.delete(type='FACE')\n    bpy.ops.mesh.select_all(action = 'SELECT')\n#    bpy.ops.mesh.flip_normals()\n    bpy.ops.mesh.select_mode(type='VERT')\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['GP_Scene'].select_set(True)\n    bpy.ops.object.delete()\n    bpy.data.objects['Note'].select_set(True)\n#    bpy.context.object.name = \"Cut_Line\"\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['Note'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n    bpy.context.object.name = \"Cutline_to_Delete\"\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n\n#    bpy.ops.object.delete()\n\n\nclass SegmentaDesenho(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.segmenta_desenho\"\n    bl_label = \"Segmenta Desenho\"\n\n    def execute(self, context):\n        SegmentaDesenhoDef(self, context)\n        return {'FINISHED'}\n\ndef DesenhaBooleanaDentroDef(self, context):\n\n    context = bpy.context\n    objOrigi = context.active_object\n    scn = context.scene\n\n    #bpy.ops.gpencil.convert(type='POLY')\n    #bpy.ops.gpencil.convert(type='POLY', use_normalize_weights=True, radius_multiplier=1.0, use_link_strokes=False, timing_mode='FULL', frame_range=100, start_frame=1, use_realtime=False, end_frame=250, gap_duration=0.0, gap_randomness=0.0, seed=0, use_timing_data=False)\n\n    # Centraliza no selecionado\n#    bpy.ops.view3d.snap_cursor_to_selected()\n\n    # Desenha\n\n    bpy.ops.gpencil.convert_old_files()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.convert(type='POLY', use_timing_data=True)\n\n\n    # Seleciona linha e converte em mesh\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['Note']\n    linha.select_set(True)\n#    linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n\n    bpy.ops.object.convert(target='MESH')\n    bpy.context.object.name = \"BoolCorte\"\n\n    # EXTRUSÃO\n\n#    bpy.ops.view3d.snap_cursor_to_selected() # NAO USAR SENAÔ MUDA O CENTER!!!\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.edge_face_add()\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={\"mirror\":False}, TRANSFORM_OT_shrink_fatten={\"value\":300, \"use_even_offset\":False, \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.ops.mesh.select_non_manifold()\n\n    bpy.ops.mesh.edge_face_add()\n#    bpy.ops.mesh.fill()\n\n    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={\"mirror\":False}, TRANSFORM_OT_shrink_fatten={\"value\":300, \"use_even_offset\":False, \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"release_confirm\":False, \"use_accurate\":False})\n\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.flip_normals()\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    objBool = context.active_object\n\n    objOrigi.select_set(True)\n    objBool.select_set(True)\n    bpy.context.view_layer.objects.active = objBool\n\n    bpy.ops.object.booleana_osteo_geral()\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n    '''\n#    bpy.ops.gpencil.layer_remove()\n#    bpy.ops.object.editmode_toggle()\n#    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha.select_set(True)\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n    bpy.ops.object.mode_set(mode='EDIT')\n#    bpy.ops.object.editmode_toggle()\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n#    for v in mesh.verts:\n    for v in mesh.verts and mesh.faces:\n        #print(v)\n        v.select = True\n#        v.select = True\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active # Atualiza viewport\n\n#    bpy.ops.mesh.flip_normals() # Inverter para funcionar o Knife fora a fora\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n\n    bpy.ops.mesh.select_mode(type='FACE')\n    bpy.ops.mesh.knife_project(cut_through=True) # CUIDADO! Seleciona apenas a parte de trás\n#    bpy.context.scene.objects.active = bpy.context.scene.objects.active\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active\n    bpy.ops.mesh.select_all(action='INVERT')\n    bpy.ops.mesh.separate(type='SELECTED')\n#    bpy.ops.mesh.delete(type='FACE')\n    bpy.ops.mesh.select_all(action = 'SELECT')\n#    bpy.ops.mesh.flip_normals()\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['GP_Scene'].select_set(True)\n    bpy.ops.object.delete()\n    bpy.data.objects['Note'].select_set(True)\n    bpy.context.object.name = \"Cut_Line\"\n\n#    bpy.ops.object.delete()\n    '''\n\nclass DesenhaBooleanaDentro(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desenha_booleana_dentro\"\n    bl_label = \"Segmenta Desenho\"\n\n    def execute(self, context):\n        DesenhaBooleanaDentroDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(DesenhaBooleanaDentro)\n\n\ndef DesenhaBooleanaForaDef(self, context):\n\n    context = bpy.context\n    objOrigi = context.active_object\n    scn = context.scene\n\n    #bpy.ops.gpencil.convert(type='POLY')\n    #bpy.ops.gpencil.convert(type='POLY', use_normalize_weights=True, radius_multiplier=1.0, use_link_strokes=False, timing_mode='FULL', frame_range=100, start_frame=1, use_realtime=False, end_frame=250, gap_duration=0.0, gap_randomness=0.0, seed=0, use_timing_data=False)\n\n    # Centraliza no selecionado\n#    bpy.ops.view3d.snap_cursor_to_selected()\n\n    # Desenha\n\n    bpy.ops.gpencil.convert_old_files()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.paintmode_toggle()\n    bpy.ops.gpencil.convert(type='POLY', use_timing_data=True)\n\n\n    # Seleciona linha e converte em mesh\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['Note']\n    linha.select_set(True)\n#    linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['Note']\n\n    bpy.ops.object.convert(target='MESH')\n    bpy.context.object.name = \"BoolCorte\"\n\n    # EXTRUSÃO\n\n#    bpy.ops.view3d.snap_cursor_to_selected() # NAO USAR SENAÔ MUDA O CENTER!!!\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.edge_face_add()\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={\"mirror\":False}, TRANSFORM_OT_shrink_fatten={\"value\":300, \"use_even_offset\":False, \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.ops.mesh.select_non_manifold()\n\n    bpy.ops.mesh.edge_face_add()\n#    bpy.ops.mesh.fill()\n\n    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={\"mirror\":False}, TRANSFORM_OT_shrink_fatten={\"value\":300, \"use_even_offset\":False, \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"release_confirm\":False, \"use_accurate\":False})\n\n\n    bpy.ops.mesh.select_all(action='SELECT')\n\n    bpy.ops.mesh.flip_normals()\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    objBool = context.active_object\n\n    objOrigi.select_set(True)\n    objBool.select_set(True)\n    bpy.context.view_layer.objects.active = objBool\n\n    bpy.ops.object.booleana_osteo_inter()\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n    '''\n#    bpy.ops.gpencil.layer_remove()\n#    bpy.ops.object.editmode_toggle()\n#    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha.select_set(True)\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n    bpy.ops.object.mode_set(mode='EDIT')\n#    bpy.ops.object.editmode_toggle()\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n#    for v in mesh.verts:\n    for v in mesh.verts and mesh.faces:\n        #print(v)\n        v.select = True\n#        v.select = True\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active # Atualiza viewport\n\n#    bpy.ops.mesh.flip_normals() # Inverter para funcionar o Knife fora a fora\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n\n    bpy.ops.mesh.select_mode(type='FACE')\n    bpy.ops.mesh.knife_project(cut_through=True) # CUIDADO! Seleciona apenas a parte de trás\n#    bpy.context.scene.objects.active = bpy.context.scene.objects.active\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active\n    bpy.ops.mesh.select_all(action='INVERT')\n    bpy.ops.mesh.separate(type='SELECTED')\n#    bpy.ops.mesh.delete(type='FACE')\n    bpy.ops.mesh.select_all(action = 'SELECT')\n#    bpy.ops.mesh.flip_normals()\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['GP_Scene'].select_set(True)\n    bpy.ops.object.delete()\n    bpy.data.objects['Note'].select_set(True)\n    bpy.context.object.name = \"Cut_Line\"\n\n#    bpy.ops.object.delete()\n    '''\n\nclass DesenhaBooleanaFora(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desenha_booleana_fora\"\n    bl_label = \"Segmenta Desenho Fora\"\n\n    def execute(self, context):\n        DesenhaBooleanaForaDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(DesenhaBooleanaFora)\n\n# Segmenta mandíbula\n\nimport bpy\nimport platform\n\ndef ImportaSeparaMandibulaDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n    if platform.system() == \"Linux\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Collection\\\\\"\n        object    = \"Separa_Mandibula\"\n\n    if platform.system() == \"Darwin\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Collection\\\\\"\n        object    = \"Separa_Mandibula\"\n\n    if platform.system() == \"Windows\":\n\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Collection\\\\\"\n        object    = \"Separa_Mandibula\"\n\n\n#    if platform.system() == \"Darwin\":\n\n#        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n#        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n#        section   = \"\\\\Group\\\\\"\n#        object    = \"SPLINT\"\n\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\n#ImportaSeparaMandibulaDef()\n\n\nclass ImportaSeparaMandibula(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_separa_mandibula\"\n    bl_label = \"Importa Separa Mandíbula\"\n\n    def execute(self, context):\n        ImportaSeparaMandibulaDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(ImportaSeparaMandibula)\n\ndef MovePara(objOrigem, objMove):\n\n    ObjetoOrigem = bpy.data.objects[objOrigem]\n    ObjetoMove = bpy.data.objects[objMove]\n\n#    bpy.ops.object.select_all(action='DESELECT')\n#    ObjetoMove.select_set(True)\n#    context.view_layer.objects.active = ObjetoMove\n    ObjetoMove.location[0] = ObjetoOrigem.location[0]\n    ObjetoMove.location[1] = ObjetoOrigem.location[1]\n    ObjetoMove.location[2] = ObjetoOrigem.location[2]\n\ndef AjustaMandibula():\n    MovePara(\"Condylar Process left\", \"EMP_Proc_Cond_esq\")\n    MovePara(\"Condylar Process right\", \"EMP_Proc_Cond_dir\")\n\n    MovePara(\"Coronoid Process left\", \"EMP_Proc_Cor_esq\")\n    MovePara(\"Coronoid Process right\", \"EMP_Proc_Cor_dir\")\n\n    MovePara(\"Mid Go-Ramus Fracure left\", \"EMP_Ang_Mand_esq\")\n    MovePara(\"Mid Go-Ramus Fracure right\", \"EMP_Ang_Mand_dir\")\n\n    MovePara(\"Go left\", \"EMP_Gon_esq\")\n    MovePara(\"Go right\", \"EMP_Gon_dir\")\n\n    MovePara(\"Mid Mandibula Angle left\", \"EMP_Meio_Mand_esq\")\n    MovePara(\"Mid Mandibula Angle right\", \"EMP_Meio_Mand_dir\")\n\n    MovePara(\"Gn point\", \"EMP_Protuberancia_down\")\n    MovePara(\"B point\", \"EMP_Protuberancia\")\n    MovePara(\"Mid Upper Incisors\", \"EMP_Protuberancia_up\")\n\ndef BooleanSeparaMandibula():\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    MandibulaBase = bpy.data.objects['MandibulaBase']\n\n    MandibulaBase.select_set(True)\n    bpy.context.view_layer.objects.active = MandibulaBase\n\n    obj = context.active_object\n    bpy.ops.object.collection_link(collection='Collection')\n\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    Cranio = bpy.data.objects['Bones']\n    MandibulaBase = bpy.data.objects['MandibulaBase']\n\n    Cranio.select_set(True)\n    MandibulaBase.select_set(True)\n\n    bpy.context.view_layer.objects.active = MandibulaBase\n\n    bpy.ops.object.booleana_osteo_inter()\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n\n    ListaObjetos = ['EMP_Proc_Cor_dir', 'EMP_Proc_Cond_dir', 'EMP_Proc_Cor_esq', 'EMP_Proc_Cond_esq', 'EMP_Gon_dir', 'EMP_Ang_Mand_dir', 'EMP_Gon_esq', 'EMP_Ang_Mand_esq', 'EMP_Meio_Mand_esq', 'EMP_Meio_Mand_dir', 'EMP_Protuberancia_down', 'EMP_Protuberancia', 'EMP_Protuberancia_up', 'ArmatureMandibula', 'Condylar Process right', 'Coronoid Process right', 'Condylar Process left', 'Coronoid Process left', 'Mid Go-Ramus Fracure right', 'Go right', 'Mid Go-Ramus Fracure left', 'Go left', 'Mid Mandibula Angle right', 'Mid Mandibula Angle left', 'Gn point', 'B point', 'Mid Upper Incisors']\n\n\n    for i in ListaObjetos:\n\n        bpy.data.objects[i].select_set(True)\n        bpy.context.view_layer.objects.active = bpy.data.objects[i]\n        bpy.ops.object.delete(use_global=False)\n\n\n\n# Traz para Collection\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Cranio.select_set(True)\n\n\n\n    bpy.context.view_layer.objects.active = Cranio\n\n    bpy.ops.object.collection_link(collection='Collection')\n    Cranio.hide_viewport=False\n\n    try:\n        bpy.context.object.active_material.diffuse_color = (0.8, 0.684753, 0.470028, 0.5)\n    except:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MaterialSkull\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.8, 0.684753, 0.470028, 0.5) #change color\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n\n    try:\n        objAct = bpy.data.objects[\"Result.001\"]\n        objAct.select_set(True)\n        bpy.context.view_layer.objects.active = objAct\n    except:\n        objAct = bpy.data.objects[\"Result\"]\n        objAct.select_set(True)\n        bpy.context.view_layer.objects.active = objAct\n\n\n\n\nclass SeparacaoMandibula(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.separacao_mandibula\"\n    bl_label = \"Importa Separa Mandíbula\"\n\n    def execute(self, context):\n        ImportaSeparaMandibulaDef(self, context)\n        AjustaMandibula()\n        BooleanSeparaMandibula()\n#        bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(SeparacaoMandibula)\n\n\n\ndef SeparaMandibulaCranioDef():\n\n    bpy.ops.object.duplicate()\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.transform.shrink_fatten(value=-0.35, use_even_offset=False, mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n    bpy.ops.object.mode_set(mode='OBJECT')\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 8\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Remesh\")\n\n    context = bpy.context\n    Mandibula = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    Cranio = bpy.data.objects['Bones']\n\n    Cranio.select_set(True)\n    Mandibula.select_set(True)\n\n    bpy.context.view_layer.objects.active = Mandibula\n\n    bpy.ops.object.booleana_osteo_geral()\n\nclass SeparaMandibulaCranio(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.separacao_mandibula_cranio\"\n    bl_label = \"Importa Separa Mandíbula Crânio\"\n\n    def execute(self, context):\n        SeparaMandibulaCranioDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SeparaMandibulaCranio)\n\n\nclass PreparaImpressao3D(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.prepara_impressao_3d\"\n    bl_label = \"Prepara Impressão 3D\"\n\n    def execute(self, context):\n        bpy.ops.object.modifier_add(type='REMESH')\n        bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n        bpy.context.object.modifiers[\"Remesh\"].octree_depth = 8\n        bpy.context.object.modifiers[\"Remesh\"].scale = 0.99\n        return {'FINISHED'}\n\nbpy.utils.register_class(PreparaImpressao3D)\n\ndef FecharBuracosTodosDef():\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.select_non_manifold()\n    bpy.ops.mesh.remove_doubles(threshold=0.2)\n    bpy.ops.mesh.edge_face_add()\n    bpy.ops.object.mode_set(mode='OBJECT')\n\nclass FecharBuracosTodos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.fecha_buraco_todos\"\n    bl_label = \"Prepara Impressão 3D\"\n\n    def execute(self, context):\n        FecharBuracosTodosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(FecharBuracosTodos)\n\ndef SeparaObjetoDef():\n\n    bpy.ops.mesh.select_mode(type=\"FACE\")\n    bpy.ops.mesh.select_all(action='INVERT')\n    bpy.ops.mesh.separate(type='SELECTED')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.object.mode_set(mode='OBJECT')\n    objSel = bpy.context.view_layer.objects.active\n    bpy.ops.object.select_all(action='DESELECT')\n    objSel.select_set(True)\n    bpy.context.view_layer.objects.active = objSel\n\nclass SeparaObjeto(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.separa_objeto\"\n    bl_label = \"Separa Ojeto\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n\n        if bpy.context.active_object.mode == 'EDIT':\n            return True\n        else:\n            if bpy.context.active_object.mode == 'OBJECT':\n                return False\n\n    def execute(self, context):\n        SeparaObjetoDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SeparaObjeto)\n\n\n# SEGMENTA MICROSCÓPIO\n\ndef SegmentaDesenhoMicrosDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha = bpy.data.objects['myCurve']\n    linha.select_set(True)\n#    linha = bpy.context.view_layer.objects.active\n    bpy.context.view_layer.objects.active = bpy.data.objects['myCurve']\n\n    bpy.ops.object.convert(target='MESH')\n\n\n#    bpy.ops.gpencil.layer_remove()\n#    bpy.ops.object.editmode_toggle()\n#    bpy.ops.object.mode_set(mode='EDIT')\n\n    bpy.ops.object.select_all(action='DESELECT')\n    linha.select_set(True)\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n    bpy.ops.object.mode_set(mode='EDIT')\n#    bpy.ops.object.editmode_toggle()\n    mesh=bmesh.from_edit_mesh(bpy.context.object.data)\n#    for v in mesh.verts:\n    for v in mesh.verts and mesh.faces:\n        #print(v)\n        v.select = True\n#        v.select = True\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active # Atualiza viewport\n\n#    bpy.ops.mesh.flip_normals() # Inverter para funcionar o Knife fora a fora\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n\n    bpy.ops.mesh.select_mode(type='FACE')\n    bpy.ops.mesh.knife_project(cut_through=True) # CUIDADO! Seleciona apenas a parte de trás\n#    bpy.context.scene.objects.active = bpy.context.scene.objects.active\n    bpy.context.view_layer.objects.active = bpy.context.view_layer.objects.active\n    bpy.ops.mesh.select_all(action='INVERT')\n    bpy.ops.mesh.separate(type='SELECTED')\n#    bpy.ops.mesh.delete(type='FACE') # Não é bom pois o usuário pode não querer apagar tudo\n#    bpy.ops.mesh.select_all(action = 'SELECT')\n#    bpy.ops.mesh.flip_normals()\n    bpy.ops.mesh.select_mode(type='VERT')\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects['myCurve'].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects['myCurve']\n    #bpy.context.object.name = \"Cutline_to_Delete\"\n    bpy.ops.object.delete(use_global=False)\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.select_box\")\n\n\n#    bpy.ops.object.delete()\n\n\nclass SegmentaDesenhoMicros(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.segmenta_desenho_micros\"\n    bl_label = \"Segmenta Desenho\"\n\n    def execute(self, context):\n        SegmentaDesenhoMicrosDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(SegmentaDesenhoMicros)\n"
  },
  {
    "path": "ForensicOnBlender.py",
    "content": "import bpy\nimport platform\nfrom .__init__ import *\nfrom .ForensicTools import *\nfrom .Version import *\n\nclass FORENSIC_PT_AtualizaAddonSec(bpy.types.Panel):\n    bl_label = \"Upgrade Script\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"VERSION: \"+VERSION)\n\n        row = layout.row()\n        row.operator(\"object.atualiza_script\", text=\"UPGRADE FORENSIC!\", icon=\"RECOVER_LAST\")\n\nbpy.utils.register_class(FORENSIC_PT_AtualizaAddonSec)\n\n\nclass FORENSIC_PT_NomeReconstrucao(bpy.types.Panel):\n    bl_label = \"Reconstruction Data\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        scene = context.scene\n#        rd = scene.render\n\n#        row = layout.row()\n#        row.label(text=\"CT-Scan Reconstruction:\")\n\n#        col = layout.column(align=True)\n#        col.prop(scn.my_tool, \"path\", text=\"\")\n\n        row = layout.row()\n#        row.operator(\"object.tomo_heli\", text=\"CT-Scan\")\n#        row.operator(\"object.tomo_cone\", text=\"CBCT\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"nome_paciente\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"sobrenome_paciente\")\n\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(FORENSIC_PT_NomeReconstrucao)\n\n\nclass FORENSIC_PT_Fotogrametria(bpy.types.Panel):\n    bl_label = \"Photogrammetry Start\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"OpenMVG+OpenMVS:\")\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n        col = self.layout.column(align = True)\n        col.alignment = 'RIGHT'\n        col.prop(context.scene, \"d_factorForensic\")\n        col.prop(context.scene, \"smooth_factorForensic\")\n\n        if platform.system() == \"Windows\":\n            row = layout.row()\n            row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n        row = layout.row()\n        row.operator(\"object.gera_modelo_foto\", text=\"Start Photogrammetry!\", icon=\"IMAGE_DATA\")\n\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_fotogram\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(FORENSIC_PT_Fotogrametria)\n\nbpy.types.Scene.d_factorForensic = bpy.props.StringProperty \\\n  (\n    name = \"D FactorForensic\",\n    description = \"D FactorForensic\",\n    default = \"5\"\n  )\nbpy.types.Scene.smooth_factorForensic = bpy.props.StringProperty \\\n  (\n    name = \"Smooth Factor\",\n    description = \"Smooth Factor\",\n    default = \"5\"\n  )\n\nclass FORENSIC_PT_AlinhaFace(bpy.types.Panel):\n    bl_label = \"Photogrammetry - Align & Scale\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Align Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1b\", text=\"Point A\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp2b\", text=\"Point B\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp3b\", text=\"Align Point\", icon=\"SORTBYEXT\")\n\n#        row = layout.row()\n#        row.operator(\"object.cria_tres_pontos\", text=\"3 Points Click\", icon=\"OUTLINER_OB_MESH\")\n\n        row = self.layout.row(align = True)\n        row.label(text=\"Distance A<>B:\")\n        row.prop(context.scene, \"medida_real2\")\n\n        row = layout.row()\n        row.operator(\"object.alinha_forca\", text=\"Align and Resize!\", icon=\"ORIENTATION_LOCAL\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Segmentation Cut Through:\")\n\n        row = layout.row()\n        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n\n        row = layout.row()\n        linha=row.operator(\"object.segmenta_desenho\", text=\"Cut Draw!\", icon=\"FCURVE\")\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Surface Cut:\")\n\n        row = layout.row()\n        row.operator(\"wm.modal_cria_pontos\", icon='CURVE_DATA', text=\"Create Points\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_unido\", icon='CURVE_BEZCIRCLE', text=\"Create Bezier Line\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta\", text=\"Cut Line!\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta_dupla\", text=\"Cut Line Double!\", icon=\"MOD_THICKNESS\")\n\n        row = layout.row()\n        row.label(text=\"Frankfurt Alignment:\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        circle=row.operator(\"object.renomeia_cranio\", text=\"RENAME TO Bones!\", icon=\"BONE_DATA\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.orbital_right_pt\", text=\"Orbital right\")\n        linha=row.operator(\"object.orbital_left_pt\", text=\"Orbital left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.n_pt\", text=\"N point\")\n        linha=row.operator(\"object.po_left\", text=\"Po left\")\n\n        row = layout.row()\n        row.operator(\"object.alinha_cranio_frankfurt\", text=\"Align!\", icon=\"ORIENTATION_LOCAL\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_alinha_face\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(FORENSIC_PT_AlinhaFace)\n\n\nclass FORENSIC_PT_ColocaMarcadores(bpy.types.Panel):\n    bl_label = \"Soft Tissue Markers\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Create Custom Marker:\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"nome_marcador\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"dimensao_marcador\")\n\n        row = layout.row()\n        linha=row.operator(\"object.adiciona_marcador\", text=\"Create Marker\", icon=\"EMPTY_SINGLE_ARROW\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Import CSV Sheet:\")\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathcsv\", text=\"\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_cria_botoes\", text=\"Generate Soft Tissue Markers!\", icon=\"EMPTY_SINGLE_ARROW\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.oculta_nomes\", text=\"Hide Names\", icon=\"HIDE_ON\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Vertical Center Line\", icon=\"SORT_DESC\")\n        linha.location=(0,-200,0)\n\n        row = layout.row()\n        linha=row.operator(\"object.engrossa_linha\", text=\"Make Tube Line\", icon=\"OUTLINER_OB_CURVE\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_luzes\", text=\"ILLUMINATE!\", icon=\"LIGHT_DATA\")\n\n        row = layout.row()\n        row.label(text=\"1) Please select the skull.\")\n        row = layout.row()\n        row.label(text=\"2) So, click on Skull Material Adjustment.\")\n        row = layout.row()\n        linha=row.operator(\"object.ajusta_material_cranio\", text=\"Skull Material Adjustment\", icon=\"OUTLINER_OB_CURVE\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_olho\", text=\"Import Eye\", icon=\"HIDE_OFF\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_markers\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(FORENSIC_PT_ColocaMarcadores)\n\n\nbpy.types.Scene.nome_marcador = bpy.props.StringProperty \\\n  (\n    name = \"Name\",\n    description = \"Object Size\",\n    default = \"Marker\"\n  )\n\nbpy.types.Scene.dimensao_marcador = bpy.props.StringProperty \\\n  (\n    name = \"Size\",\n    description = \"Object Size\",\n    default = \"None\"\n  )\n\nclass FORENSIC_PT_Musculos(bpy.types.Panel):\n    bl_label = \"Muscles\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_temporalis\", text=\"Temporalis\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_masseter\", text=\"Masseter\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_orbicularis_oculi\", text=\"Orbicularis Oculi\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_elevator_labii_superioris\", text=\"Elevator Labii Superioris\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_nasalis\", text=\"Nasalis\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_zygomaticus\", text=\"Zygomaticus\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_orbicularis_oris\", text=\"Orbicularis Oris\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_buccinator\", text=\"Buccinator\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_mentalis\", text=\"Mentalis+\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_sternocleidomastoid\", text=\"Sternocleidomastoid+\")\n\n        row = layout.row()\n        row.label(text=\"Deform Muscle:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_grab\", text=\"Grab\", icon=\"BRUSH_GRAB\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_smooth\", text=\"Smooth\", icon=\"BRUSH_SMOOTH\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_clay_strips\", text=\"Clay Strips\", icon=\"BRUSH_CLAY_STRIPS\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mode_set\", text=\"OK! (Object Mode)\", icon=\"META_CUBE\").mode='OBJECT'\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_copia_espelha\", text=\"Copy & Mirror\", icon=\"MOD_TRIANGULATE\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_muscles\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(FORENSIC_PT_Musculos)\n\n\nclass FORENSIC_PT_FaceBasica(bpy.types.Panel):\n    bl_label = \"Basic Face Sculpt\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"1) Put all structure in the origin of scene.\")\n\n        row = layout.row()\n        row.label(text=\"2) Select all interest muscules.\")\n\n        row = layout.row()\n        row.label(text=\"3) Create Basic Shape!\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_cria_face_basica\", text=\"Create Basic Shape!\", icon=\"MESH_ICOSPHERE\")\n\n\n        row = layout.row()\n        row.label(text=\"Sculpture:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_grab\", text=\"Grab\", icon=\"BRUSH_GRAB\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_smooth\", text=\"Smooth\", icon=\"BRUSH_SMOOTH\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_clay_strips\", text=\"Clay Strips\", icon=\"BRUSH_CLAY_STRIPS\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mode_set\", text=\"OK! (Object Mode)\", icon=\"META_CUBE\").mode='OBJECT'\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_sculpt\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(FORENSIC_PT_FaceBasica)\n\n\nclass FORENSIC_PT_Importa(bpy.types.Panel):\n    bl_label = \"Import Face\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Forensic\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.operator(\"object.forensic_gera_imagem\", text=\"Render Viewport\", icon=\"IMAGE_RGB_ALPHA\")\n\n        row = layout.row()\n        row.label(text=\"Import OBJ:\")\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathobj\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.forensic_importa_obj\", text=\"Import MakeHuman OBJ\", icon=\"SCENE_DATA\")\n\n\nbpy.utils.register_class(FORENSIC_PT_Importa)\n"
  },
  {
    "path": "ForensicTools.py",
    "content": "import bpy\nimport re\nimport platform\nimport subprocess\nimport tempfile\n\nfrom datetime import datetime\n\nfrom .PontosAnatomicos import *\nfrom .FerrImgTomo import *\n\ndef AdicionaMarcadorDef(nome, distancia):\n\n    bpy.ops.object.empty_add(type='SINGLE_ARROW', view_align=False)\n    bpy.context.object.empty_display_size = distancia\n\n    bpy.context.object.name = nome\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    Marcador_EMP = obj\n#    Marcador_EMP.select_set(True)\n#    bpy.context.view_layer.objects.active = Marcador_EMP\n\n    Marcador_EMP.location = bpy.context.scene.cursor.location\n    Marcador_EMP.rotation_euler = bpy.context.scene.cursor.rotation_euler\n\n#    bpy.context.scene.tool_settings.snap_elements = {'FACE'}\n#    bpy.context.scene.tool_settings.use_snap_align_rotation = True\n\n#    bpy.ops.wm.tool_set_by_id(name=\"builtin.rotate\")\n\n#    bpy.context.scene.transform_orientation_slots[0].type = 'NORMAL'\n\n#    bpy.ops.view3d.view_selected(use_all_regions=False)\n\n#    bpy.ops.view3d.view_center_cursor()\n\nclass AdicionaMarcador(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.adiciona_marcador\"\n    bl_label = \"Add Soft Tissue Marker\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        NomePonto = bpy.context.scene.nome_marcador\n        DistPonto = float(bpy.context.scene.dimensao_marcador)\n        AdicionaMarcadorDef(NomePonto, DistPonto)\n        return {'FINISHED'}\n\nbpy.utils.register_class(AdicionaMarcador)\n\n\n#-----------------------------------\n# Cria Botões Marcadores Tecido mole\n\n'''\nwith open('/home/linux3dcs/prj/Arc-Team_Santo/planilha.csv', 'r') as f:\n    fileLines = f.readlines()\n\nfor i in range(len(fileLines)):\n    limpaFinalLinha = fileLines[i].strip()\n    separa = limpaFinalLinha.split(',')\n    print(separa)\n'''\n\n\ndef CriaBotoesDef():\n\n    context = bpy.context\n    #obj = context.object\n    scn = context.scene\n\n    bpy.context.scene.tool_settings.transform_pivot_point = 'MEDIAN_POINT' # Tem que estar assim senão o alinhamento dá errado!\n\n\n#        with open('/home/linux3dcs/prj/Arc-Team_Santo/planilha.csv', 'r') as f:\n    with open(scn.my_tool.filepathcsv, 'r') as f:\n        fileLines = f.readlines()\n\n    posicaoZ = 0\n\n    # Se vier do Excel\n    if fnmatch.fnmatchcase(fileLines[0], '*;*'):\n        separador = \";\"\n\n    # Se vier do LibreOffile\n    if not fnmatch.fnmatchcase(fileLines[0], '*;*'):\n        separador = \",\"\n\n    # Se o arquivo tiver medidas com vírgula\n    arquivoNovo = []\n\n    tmpdirCSV = tempfile.mkdtemp()\n\n    if fnmatch.fnmatchcase(fileLines[0], '*\\\"*'):\n        with open(tmpdirCSV+'/teste.csv', \"a\") as arq:\n            for i in fileLines:\n                linha = i.split(\"\\\"\")\n                valor1 = linha[0]\n                valor2 = linha[1].replace(',','.')\n                valor3 = '\\n'\n                linhaCompleta = valor1+valor2+valor3\n                #print(valor1,valor2,valor3)\n                arq.write(linhaCompleta)\n            arq.close()\n\n            with open(tmpdirCSV+'/teste.csv', 'r') as f:\n                fileLines = f.readlines()\n                print(fileLines)\n\n\n    Mk_Numero = len(fileLines) # Conta o número de itens, pois está invertido.\n\n    for i in range(len(fileLines))[::-1]:\n        limpaFinalLinha = fileLines[i].strip()\n\n        separa = limpaFinalLinha.split(separador)\n        #print(separa)\n\n        # Cria def do botão\n        Nome = str(Mk_Numero)+\" \"+separa[0]\n        NomeClass = Nome.replace(\" \", \"\")\n        NomeMin = \"object.\"+Nome.lower().replace(\" \", \"_\")\n\n        bpy.ops.object.empty_add(type='SINGLE_ARROW', view_align=False, location=(-150, 0, posicaoZ))\n        bpy.context.object.name = Nome\n        bpy.context.object.empty_display_size = float(separa[1])\n        bpy.context.object.show_name = True\n        bpy.ops.transform.rotate(value=1.5708, orient_axis='Y')\n        posicaoZ += 10\n        Mk_Numero -= 1\n\n    # ENVIA COLLECTION\n\n        obj2 = bpy.context.view_layer.objects.active\n\n        ListaColl = []\n\n        for i in bpy.data.collections:\n            ListaColl.append(i.name)\n\n        if \"Soft Tissue Markers\" not in ListaColl:\n\n            myCol = bpy.data.collections.new(\"Soft Tissue Markers\")\n            bpy.context.scene.collection.children.link(myCol)\n            bpy.ops.object.collection_link(collection='Soft Tissue Markers')\n    #        mainCol = bpy.data.collections['Collection']\n    #        bpy.context.scene.collection.children.unlink(mainCol)\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n        else:\n            bpy.ops.object.collection_link(collection='Soft Tissue Markers')\n    #        mainCol = bpy.data.collections['Collection']\n    #        bpy.context.scene.collection.children.unlink(mainCol)\n            bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    bpy.context.scene.tool_settings.snap_elements = {'FACE'}\n    bpy.context.scene.tool_settings.use_snap_align_rotation = True\n\n\n\n\nclass CriaBotoes(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_cria_botoes\"\n    bl_label = \"Cria Botões\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        CriaBotoesDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaBotoes)\n\ndef OcultaNomesDef():\n    context = bpy.context\n    #obj = context.object\n    scn = context.scene\n\n    for i in bpy.context.selected_objects:\n        i.show_name = False\n\nclass OcultaNomes(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.oculta_nomes\"\n    bl_label = \"Hide Names\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        OcultaNomesDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(OcultaNomes)\n\ndef EngrossaLinhaDef():\n    context = bpy.context\n    #obj = context.object\n    scn = context.scene\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n    bpy.ops.object.convert(target='CURVE')\n    bpy.context.object.data.bevel_depth = 0.84\n\nclass EngrossaLinha(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.engrossa_linha\"\n    bl_label = \"Make Tube Line\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        EngrossaLinhaDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class( EngrossaLinha)\n\n\ndef ForensicImportaMuscleDef(nome, colecao):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    try:\n        bpy.ops.object.mode_set(mode='OBJECT')\n    except:\n        print(\"Erro com o Object Mode!\")\n\n\n    if platform.system() == \"Linux\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/ForensicObj.blend\"\n#        section   = \"\\\\Collection\\\\\"\n#        object    = \"SPLINT\"\n        section   = \"\\\\Object\\\\\"\n        object    = nome\n\n    if platform.system() == \"Darwin\":\n\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/ForensicObj.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = nome\n\n    if platform.system() == \"Windows\":\n\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/'\n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/ForensicObj.blend\"\n        section   = \"\\\\Object\\\\\"\n        object    = nome\n\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath,\n        filename=filename,\n        directory=directory)\n\n    ObjImportado = bpy.data.objects[nome]\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    ObjImportado.select_set(True)\n    context.view_layer.objects.active = ObjImportado\n\n    # Coloca na camada\n    obj2 = bpy.context.view_layer.objects.active\n\n    ListaColl = []\n\n    for i in bpy.data.collections:\n        ListaColl.append(i.name)\n\n    if colecao not in ListaColl:\n\n        myCol = bpy.data.collections.new(colecao)\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection=colecao)\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\n    else:\n        bpy.ops.object.collection_link(collection=colecao)\n#        mainCol = bpy.data.collections['Collection']\n#        bpy.context.scene.collection.children.unlink(mainCol)\n        bpy.data.collections['Collection'].objects.unlink(obj2)\n\nclass ForensicImportaTemporalis(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_temporalis\"\n    bl_label = \"Import Temporalis\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Temporalis' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Temporalis\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaTemporalis)\n\n\nclass ForensicImportaMasseter(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_masseter\"\n    bl_label = \"Import Masseter\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Masseter' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Masseter\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaMasseter)\n\n\nclass ForensicImportaOrbicularisOculi(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_orbicularis_oculi\"\n    bl_label = \"Import Orbicularis Oculi\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Orbicularis Oculi' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Orbicularis Oculi\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaOrbicularisOculi)\n\n\nclass ForensicImportaElevatorLabiiSuperioris(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_elevator_labii_superioris\"\n    bl_label = \"Import Elevator Labii Superioris\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Elevator Labii Superioris' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Elevator Labii Superioris\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaElevatorLabiiSuperioris)\n\n\nclass ForensicImportaNasalis(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_nasalis\"\n    bl_label = \"Import Nasalis\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Nasalis' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Nasalis\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaNasalis)\n\nclass ForensicImportaZygomaticus(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_zygomaticus\"\n    bl_label = \"Import Zygomaticus\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Zygomaticus' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Zygomaticus\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaZygomaticus)\n\n\nclass ForensicImportaOrbicularisOris(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_orbicularis_oris\"\n    bl_label = \"Import Orbicularis Oris\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Orbicularis Oris' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Orbicularis Oris\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaOrbicularisOris)\n\n\nclass ForensicImportaBuccinator(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_buccinator\"\n    bl_label = \"Import Buccinator\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Buccinator' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Buccinator\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaBuccinator)\n\n\nclass ForensicImportaMentalis(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_mentalis\"\n    bl_label = \"Import Mentalis\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mentalis+' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Mentalis+\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaMentalis)\n\n\nclass ForensicImportaSternocleidomastoid(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_sternocleidomastoid\"\n    bl_label = \"Import Sternocleidomastoid\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Sternocleidomastoid+' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Sternocleidomastoid+\", \"Muscle\")\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaSternocleidomastoid)\n\n\nclass ForensicImportaOlho(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_olho\"\n    bl_label = \"Import Eye\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Eye' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"Eye\", \"Eyes\")\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(ForensicImportaOlho)\n\ndef CopiaEspelhaDef():\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n    bpy.context.scene.tool_settings.transform_pivot_point = 'MEDIAN_POINT'\n    bpy.ops.object.duplicate_move()\n    bpy.ops.transform.mirror(orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\nclass CopiaEspelha(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_copia_espelha\"\n    bl_label = \"Copy and Mirror\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n\n    def execute(self, context):\n        CopiaEspelhaDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CopiaEspelha)\n\ndef ForensicEsculturaGrabDef():\n\n    context = bpy.context\n    scn = context.scene\n\n#    bpy.context.space_data.shading.type = 'MATERIAL'\n    bpy.ops.object.mode_set(mode = 'SCULPT')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin_brush.Grab\")\n    bpy.context.scene.tool_settings.sculpt.use_symmetry_x = False\n\nclass ForensicEsculturaGrab(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_escultura_grab\"\n    bl_label = \"Change to Grab\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT' or bpy.context.mode == 'SCULPT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        ForensicEsculturaGrabDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicEsculturaGrab)\n\n\ndef ForensicEsculturaClayStripsDef():\n\n    context = bpy.context\n    scn = context.scene\n\n#    bpy.context.space_data.shading.type = 'MATERIAL'\n    bpy.ops.object.mode_set(mode = 'SCULPT')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin_brush.Clay Strips\")\n    bpy.context.scene.tool_settings.sculpt.use_symmetry_x = False\n\nclass ForensicEsculturaClayStrips(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_escultura_clay_strips\"\n    bl_label = \"Change to Grab\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT' or bpy.context.mode == 'SCULPT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        ForensicEsculturaClayStripsDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicEsculturaClayStrips)\n\n\ndef ForensicEsculturaSmoothDef():\n\n    context = bpy.context\n    scn = context.scene\n\n#    bpy.context.space_data.shading.type = 'MATERIAL'\n    bpy.ops.object.mode_set(mode = 'SCULPT')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin_brush.Smooth\")\n    bpy.context.scene.tool_settings.sculpt.use_symmetry_x = False\n\nclass ForensicEsculturaSmooth(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_escultura_smooth\"\n    bl_label = \"Change to Smooth\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT' or bpy.context.mode == 'SCULPT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        ForensicEsculturaSmoothDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicEsculturaSmooth)\n\n\n\ndef GeraBaseSculptDef():\n\n    # Usuário seleciona tudo\n\n    bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={\"linked\":False, \"mode\":'TRANSLATION'}, TRANSFORM_OT_translate={\"value\":(0, 0, 0), \"orient_type\":'GLOBAL', \"orient_matrix\":((0, 0, 0), (0, 0, 0), (0, 0, 0)), \"orient_matrix_type\":'GLOBAL', \"constraint_axis\":(False, False, False), \"mirror\":False, \"proportional\":'DISABLED', \"proportional_edit_falloff\":'SMOOTH', \"proportional_size\":1, \"snap\":False, \"snap_target\":'CLOSEST', \"snap_point\":(0, 0, 0), \"snap_align\":False, \"snap_normal\":(0, 0, 0), \"gpencil_strokes\":False, \"cursor_transform\":False, \"texture_space\":False, \"remove_on_cancel\":False, \"release_confirm\":False, \"use_accurate\":False})\n\n    bpy.ops.object.join()\n\n    bpy.context.object.name = \"Muscles\"\n\n    # Adiciona esfera\n\n    bpy.ops.mesh.primitive_uv_sphere_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0))\n\n    bpy.ops.transform.resize(value=(180, 180, 180), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=34.004)\n\n    # Joga na colação Face Scupting\n\n    obj2 = bpy.context.view_layer.objects.active\n\n    ListaColl = []\n\n    for i in bpy.data.collections:\n        ListaColl.append(i.name)\n\n    if \"Face Sculpting\" not in ListaColl:\n\n        myCol = bpy.data.collections.new(\"Face Sculpting\")\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection='Face Sculpting')\n        ColecaoAtual = bpy.context.collection\n        ColecaoAtual.objects.unlink(obj2)\n\n    else:\n        bpy.ops.object.collection_link(collection='Face Sculpting')\n        ColecaoAtual = bpy.context.collection\n        ColecaoAtual.objects.unlink(obj2)\n\n\n    bpy.ops.object.modifier_add(type='SHRINKWRAP')\n    bpy.context.object.modifiers[\"Shrinkwrap\"].target = bpy.data.objects[\"Muscles\"]\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Shrinkwrap\")\n\n    # Sistema de Escultura\n\n    #bpy.ops.object.mode_set(mode='SCULPT')\n    bpy.ops.object.forensic_escultura_clay_strips()\n    bpy.ops.sculpt.dynamic_topology_toggle()\n    bpy.context.scene.tool_settings.sculpt.detail_size = 3\n\n\n\nclass GeraBaseSculpt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_cria_face_basica\"\n    bl_label = \"Create Basic Face Sculpting\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        GeraBaseSculptDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraBaseSculpt)\n\n\nclass RenomeiaCranio(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.renomeia_cranio\"\n    bl_label = \"Rename Skull\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Bones' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        bpy.context.object.name = \"Bones\"\n        return {'FINISHED'}\n\nbpy.utils.register_class(RenomeiaCranio)\n\n\n\nclass ForensicImportaLuzes(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_luzes\"\n    bl_label = \"Import Forensic Lights\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ForensicLight' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        ForensicImportaMuscleDef(\"ForensicLight\", \"Lights\")\n        ForensicImportaMuscleDef(\"ForensicLight.001\", \"Lights\")\n        ForensicImportaMuscleDef(\"ForensicLight.002\", \"Lights\")\n        ForensicImportaMuscleDef(\"ForensicLight.003\", \"Lights\")\n        ForensicImportaMuscleDef(\"ForensicLight.004\", \"Lights\")\n\n        bpy.context.scene.eevee.use_gtao = True\n        bpy.context.scene.eevee.gtao_distance = 8\n        bpy.context.scene.eevee.use_gtao_bent_normals = False\n        # bpy.context.scene.eevee.use_bloom = True # NÃO FICA BOM!\n        bpy.context.scene.eevee.use_sss = True\n        bpy.context.scene.eevee.use_ssr = True\n        bpy.context.scene.eevee.use_ssr_refraction = True\n        bpy.context.scene.eevee.ssr_thickness = 3\n        bpy.context.scene.render.hair_type = 'STRIP'\n        bpy.context.scene.eevee.shadow_method = 'ESM'\n        bpy.context.scene.eevee.shadow_cube_size = '512'\n        bpy.context.scene.eevee.shadow_cascade_size = '512'\n        bpy.context.scene.eevee.use_soft_shadows = True\n        bpy.context.scene.eevee.light_threshold = 0.013\n        bpy.context.scene.view_settings.exposure = 0.2\n\n        bpy.context.space_data.shading.type = 'RENDERED'\n\n        bpy.context.scene.render.engine = 'BLENDER_EEVEE'\n\n        bpy.context.space_data.overlay.show_extras = False # Oculta gráficos das luzes\n\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaLuzes)\n\n\ndef CriaMaterialOssosDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    Cranio = obj.name\n\n\n\n    m = Material()\n#    m.set_cycles()\n    # from chapter 1 of [DRM protected book, could not copy author/title]\n    m.make_material(\"Final_Bones\")\n\n#    image_path = TmpDirPNG+\"/\"+Arquivo\n\n    ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n    bpy.data.objects[Cranio].active_material_index = 0\n    MaterialPeleNativo = bpy.data.objects[Cranio].active_material\n    NomeTextura = MaterialPeleNativo.node_tree.nodes['Image Texture'].image.name\n    ImageTexture.image = bpy.data.images[NomeTextura]\n    #ImageTexture.image = bpy.data.images[\"scene_dense_mesh_texture_material_0_map_Kd.jpg\"]\n\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    diffuseBSDF.inputs[\"Base Color\"].default_value = [0.2, 0.2, 0.2, 1]\n    materialOutput = m.nodes['Material Output']\n\n    mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n    m.dump_node(mixShader)\n    mixShader.inputs['Fac'].default_value = 0.3\n\n    mixShader2 = m.makeNode('ShaderNodeMixShader', 'Mix Shader 2')\n    mixShader2.inputs['Fac'].default_value = 0.015\n\n    sssShader = m.makeNode('ShaderNodeSubsurfaceScattering', 'Subsurface Scattering')\n    sssShader.inputs[1].default_value = 20\n\n    glossyShader = m.makeNode('ShaderNodeBsdfGlossy', 'Glossy BSDF')\n    glossyShader.inputs[1].default_value = .15\n\n    m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n    m.link(sssShader, 'BSSRDF', mixShader, 1)\n    m.link(glossyShader, 'BSDF', mixShader2, 2)\n    m.link(mixShader, 'Shader', mixShader2, 1)\n    m.link(mixShader2, 'Shader', materialOutput, 'Surface')\n    m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n    m.link(ImageTexture, 'Color', sssShader, 'Color')\n\n    bpy.ops.object.material_slot_remove()\n    bpy.ops.object.material_slot_add()\n\n    bpy.data.objects[\"Bones\"].active_material = bpy.data.materials[\"Final_Bones\"]\n\n#    bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"Final_Bones\"]\n\n\nclass CriaMaterialOssos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ajusta_material_cranio\"\n    bl_label = \"Skull Material Adjustament\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = bpy.data.objects[\"Bones\"].active_material.name\n\n        if found == \"Final_Bones\":\n            return False\n        else:\n            if found != \"Final_Bones\":\n                return True\n\n    def execute(self, context):\n        CriaMaterialOssosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaMaterialOssos)\n\n\ndef ForensicGeraImagemDef():\n\n\n    context = bpy.context\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomeArquivoImagem = \"IMG_\"+str(datetime.now()).replace(\",\",\"\").replace(\":\",\"\").replace(\".\",\"-\").replace(\" \",\"-\")+\".png\"\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    NomePacienteDir = homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Render\"\n\n#        if found == False:\n    if not os.path.exists(NomePacienteDir):\n        print(\"Patience Dir does not exist!\")\n        try:\n            os.mkdir(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Render\")\n            bpy.ops.render.opengl()\n\n            bpy.data.images['Render Result'].save_render(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Render/\"+NomeArquivoImagem)\n\n            CaminhoCompletoImagem = homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Render/\"+NomeArquivoImagem\n\n            if platform.system() == 'Darwin':\n                subprocess.call(('open', CaminhoCompletoImagem))\n            elif platform.system() == 'Windows':\n                os.startfile(CaminhoCompletoImagem)\n            else:\n                subprocess.call(('xdg-open', CaminhoCompletoImagem))\n\n        except:\n            print(\"Não rolou a renderização!\")\n    else:\n        if os.path.exists(NomePacienteDir):\n            #shutil.copytree(Origem, NomePacienteDir+\"/Render\")\n\n            bpy.ops.render.opengl()\n\n            bpy.data.images['Render Result'].save_render(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Render/\"+NomeArquivoImagem)\n\n            CaminhoCompletoImagem = homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Render/\"+NomeArquivoImagem\n\n            if platform.system() == 'Darwin':\n                subprocess.call(('open', CaminhoCompletoImagem))\n            elif platform.system() == 'Windows':\n                os.startfile(CaminhoCompletoImagem)\n            else:\n                subprocess.call(('xdg-open', CaminhoCompletoImagem))\n\nclass ForensicGeraImagem(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_gera_imagem\"\n    bl_label = \"Forensic Render Image\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ForensicGeraImagemDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicGeraImagem)\n\ndef ForensicImportaOBJDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    bpy.ops.import_scene.obj(filepath=scn.my_tool.filepathobj, filter_glob=\"*.obj;*.mtl\", use_edges=True, use_smooth_groups=True, use_split_objects=True, use_split_groups=False, use_groups_as_vgroups=False, use_image_search=True, split_mode='ON', global_clight_size=0, axis_forward='-Z', axis_up='Y')\n\n    bpy.ops.transform.resize(value=(101, 101, 101), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        NomeOBJ = scn.my_tool.filepathobj.split(\"/\")[-1].split(\".\")[0] # Separa o nome do objeto\n        print(\"NOME HUMANO:\", NomeOBJ)\n\n\n    if platform.system() == \"Windows\":\n        NomeOBJ = scn.my_tool.filepathobj.split(\"\\\\\")[-1].split(\".\")[0] # Separa o nome do objeto\n        print(\"NOME HUMANO:\", NomeOBJ)\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects[NomeOBJ].select_set(True)\n    context.view_layer.objects.active = bpy.data.objects[NomeOBJ]\n\n    bpy.ops.transform.translate(value=(0, 0, -1481.77), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n    # Apaga olhos\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    ListaMaterial = []\n\n    for i in bpy.data.objects[NomeOBJ].material_slots:\n        ListaMaterial.append(i.name)\n\n    IndexMaterial = ListaMaterial.index('Eye_brown')\n\n    bpy.data.objects[NomeOBJ].active_material_index = IndexMaterial\n    bpy.ops.object.material_slot_select()\n    bpy.ops.mesh.delete(type='VERT')\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n    # Atribui modificadores\n\n    bpy.ops.object.shade_smooth()\n    bpy.ops.object.modifier_add(type='MULTIRES')\n    bpy.ops.object.multires_subdivide(modifier=\"Multires\")\n\n\n    bpy.ops.view3d.view_all(center=False)\n\n    # Criando material da pele\n\n    bpy.data.objects[NomeOBJ].active_material_index = 0\n    MaterialPeleNativo = bpy.data.objects[NomeOBJ].active_material\n    NomeTextura = MaterialPeleNativo.node_tree.nodes['Image Texture'].image.name\n\n    m = Material()\n    m.make_material(\"Final_Skin\")\n\n    ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n    ImageTexture.image = bpy.data.images[NomeTextura]\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    diffuseBSDF.inputs[\"Base Color\"].default_value = [0.2, 0.2, 0.2, 1]\n    materialOutput = m.nodes['Material Output']\n\n    mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n    m.dump_node(mixShader)\n    mixShader.inputs['Fac'].default_value = 0.3\n\n    mixShader2 = m.makeNode('ShaderNodeMixShader', 'Mix Shader 2')\n    mixShader2.inputs['Fac'].default_value = 0.07 # Glossy\n\n    sssShader = m.makeNode('ShaderNodeSubsurfaceScattering', 'Subsurface Scattering')\n    sssShader.inputs[1].default_value = 20\n\n    glossyShader = m.makeNode('ShaderNodeBsdfGlossy', 'Glossy BSDF')\n    glossyShader.inputs[1].default_value = .35\n\n    m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n    m.link(sssShader, 'BSSRDF', mixShader, 1)\n    m.link(glossyShader, 'BSDF', mixShader2, 2)\n    m.link(mixShader, 'Shader', mixShader2, 1)\n    m.link(mixShader2, 'Shader', materialOutput, 'Surface')\n    m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n    m.link(ImageTexture, 'Color', sssShader, 'Color')\n\n    bpy.ops.object.material_slot_add()\n\n    bpy.data.objects[NomeOBJ].active_material = bpy.data.materials[\"Final_Skin\"]\n\n    # Atribui material\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.data.objects[NomeOBJ].active_material_index = 0\n    bpy.ops.object.material_slot_select()\n\n    ListaMaterial2 = []\n\n    for i in bpy.data.objects[NomeOBJ].material_slots:\n        ListaMaterial2.append(i.name)\n\n    IndexMaterial2 = ListaMaterial2.index('Final_Skin')\n\n    bpy.data.objects[NomeOBJ].active_material_index = IndexMaterial2\n\n    bpy.ops.object.material_slot_assign()\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n\n    # Criando material dos cílios\n\n    try:\n\n        bpy.data.objects[NomeOBJ].active_material_index = 4\n        MaterialSobrancelhaNativo = bpy.data.objects[NomeOBJ].active_material\n        NomeTextura = MaterialSobrancelhaNativo.node_tree.nodes['Image Texture'].image.name\n\n        m = Material()\n        m.make_material(\"Final_Eyelashes\")\n\n        ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n        ImageTexture.image = bpy.data.images[NomeTextura]\n\n        diffuseBSDF = m.nodes['Principled BSDF']\n        materialOutput = m.nodes['Material Output']\n\n\n\n        transpBSDF = m.makeNode('ShaderNodeBsdfTransparent', 'Transparent BSDF')\n\n        mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n\n        m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n        m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n        m.link(transpBSDF, 'BSDF', mixShader, 1)\n        m.link(ImageTexture, 'Alpha', mixShader, 0)\n        m.link(mixShader, 'Shader', materialOutput, 'Surface')\n\n        bpy.ops.object.material_slot_add()\n\n        bpy.data.objects[NomeOBJ].active_material = bpy.data.materials[\"Final_Eyelashes\"]\n\n        bpy.context.object.active_material.blend_method = 'HASHED'\n\n        if platform.system() == \"Windows\":\n            bpy.context.object.active_material.transparent_shadow_method = 'NONE'\n\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            bpy.context.object.active_material.shadow_method = 'NONE'\n\n\n\n\n\n        # Atribui material\n\n        bpy.ops.object.mode_set(mode='EDIT')\n        bpy.ops.mesh.select_all(action='DESELECT')\n\n        bpy.data.objects[NomeOBJ].active_material_index = 4\n        bpy.ops.object.material_slot_select()\n\n\n        ListaMaterial3 = []\n\n        for i in bpy.data.objects[NomeOBJ].material_slots:\n            ListaMaterial3.append(i.name)\n\n        IndexMaterial3 = ListaMaterial3.index('Final_Eyelashes')\n\n        bpy.data.objects[NomeOBJ].active_material_index = IndexMaterial3\n\n        bpy.ops.object.material_slot_assign()\n\n        bpy.ops.object.mode_set(mode='OBJECT')\n\n    except:\n        print(\"Problema com o material!\")\n\n\n    # Criando material da sobrancelha\n\n    bpy.data.objects[NomeOBJ].active_material_index = 3\n    MaterialSobrancelhaNativo = bpy.data.objects[NomeOBJ].active_material\n    NomeTextura = MaterialSobrancelhaNativo.node_tree.nodes['Image Texture'].image.name\n\n    m = Material()\n    m.make_material(\"Final_Eyebrow\")\n\n    ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n    ImageTexture.image = bpy.data.images[NomeTextura]\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    materialOutput = m.nodes['Material Output']\n\n    transpBSDF = m.makeNode('ShaderNodeBsdfTransparent', 'Transparent BSDF')\n\n    mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n\n    m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n    m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n    m.link(transpBSDF, 'BSDF', mixShader, 1)\n    m.link(ImageTexture, 'Alpha', mixShader, 0)\n    m.link(mixShader, 'Shader', materialOutput, 'Surface')\n\n    bpy.ops.object.material_slot_add()\n\n    bpy.data.objects[NomeOBJ].active_material = bpy.data.materials[\"Final_Eyebrow\"]\n\n    bpy.context.object.active_material.blend_method = 'HASHED'\n\n    if platform.system() == \"Windows\":\n        bpy.context.object.active_material.transparent_shadow_method = 'NONE'\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        bpy.context.object.active_material.shadow_method = 'NONE'\n\n\n    # Atribui material\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.data.objects[NomeOBJ].active_material_index = 3\n    bpy.ops.object.material_slot_select()\n\n    ListaMaterial4 = []\n\n    for i in bpy.data.objects[NomeOBJ].material_slots:\n        ListaMaterial4.append(i.name)\n\n    IndexMaterial4 = ListaMaterial4.index('Final_Eyebrow')\n\n    bpy.data.objects[NomeOBJ].active_material_index = IndexMaterial4\n\n    bpy.ops.object.material_slot_assign()\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n\n    # Criando material dos cabelos\n\n    bpy.data.objects[NomeOBJ].active_material_index = 1\n    MaterialSobrancelhaNativo = bpy.data.objects[NomeOBJ].active_material\n    NomeTextura = MaterialSobrancelhaNativo.node_tree.nodes['Image Texture'].image.name\n\n    m = Material()\n    m.make_material(\"Final_Hair\")\n\n    ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n    ImageTexture.image = bpy.data.images[NomeTextura]\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    diffuseBSDF.inputs[\"Specular\"].default_value = 0.0\n\n    materialOutput = m.nodes['Material Output']\n\n    transpBSDF = m.makeNode('ShaderNodeBsdfTransparent', 'Transparent BSDF')\n\n    mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n\n    m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n    m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n    m.link(transpBSDF, 'BSDF', mixShader, 1)\n    m.link(ImageTexture, 'Alpha', mixShader, 0)\n    m.link(mixShader, 'Shader', materialOutput, 'Surface')\n\n    bpy.ops.object.material_slot_add()\n\n    bpy.data.objects[NomeOBJ].active_material = bpy.data.materials[\"Final_Hair\"]\n\n    bpy.context.object.active_material.blend_method = 'HASHED'\n\n    if platform.system() == \"Windows\":\n        bpy.context.object.active_material.transparent_shadow_method = 'NONE'\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        bpy.context.object.active_material.shadow_method = 'NONE'\n\n\n    # Atribui material\n\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n\n    bpy.data.objects[NomeOBJ].active_material_index = 1\n    bpy.ops.object.material_slot_select()\n\n    ListaMaterial5 = []\n\n    for i in bpy.data.objects[NomeOBJ].material_slots:\n        ListaMaterial5.append(i.name)\n\n    IndexMaterial5 = ListaMaterial5.index('Final_Hair')\n\n    bpy.data.objects[NomeOBJ].active_material_index = IndexMaterial5\n\n    bpy.ops.object.material_slot_assign()\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n\nclass ForensicImportaOBJ(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.forensic_importa_obj\"\n    bl_label = \"Forensic Import OBJ\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ForensicImportaOBJDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ForensicImportaOBJ)\n"
  },
  {
    "path": "FotogrametriaMeshroom.py",
    "content": "import bpy\nimport subprocess\nimport platform\nfrom os.path import expanduser\nimport shutil\nimport tempfile\nfrom os import listdir\nfrom os.path import isfile, join\nimport exifread\nimport re\nimport os\nimport bmesh\n\nfrom .FerrImgTomo import *\n\ndef GeraModeloFotoMeshroomDef(self, context):\n\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    homeall = expanduser(\"~\")\n\n# Database\n\n    mypath = scn.my_tool.path_photo  # Tem que ter o / no final\n#       mypathFotos = mypath+'*'\n#       print(\"Caminho:\"+mypathFotos)\n\n    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n\n    FotoTeste = onlyfiles[1]\n\n    try:\n        with open(mypath + FotoTeste, 'rb') as f_jpg:\n            tags = exifread.process_file(f_jpg, details=True)\n            print (tags['Image Model'])\n            CamModel = str(tags['Image Model'])\n        #print(\"CamModel:\", CamModel)\n    except:\n        print(\"Não rolou!\")\n#                subprocess.call([os.system('cd'+mypath), '&&', homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh'])\n        if platform.system() == \"Linux\":\n            os.system('cd '+mypath+' && '+homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh')\n\n        if platform.system() == \"Darwin\":\n            os.system('cd '+mypath+' && /OrtogOnBlender/openMVGMACelcap/ExifTool.sh')\n\n        if platform.system() == \"Windows\":\n            print(mypath)\n            subprocess.call(['C:\\OrtogOnBlender\\ExitTool\\exiftool.exe', '-overwrite_original', '-Model=\"Z00AD\"', '-FocalLength=4', mypath+'*']) # Solução colocando o 4 sem as aspas duplas!\n\n        print(\"Resolvido!\")\n\n    with open(mypath + FotoTeste, 'rb') as f_jpg:\n        tags = exifread.process_file(f_jpg, details=True)\n        print (tags['Image Model'])\n        CamModel = str(tags['Image Model'])+\";\"\n\n# Inscreve no Banco de dados\n\n    if platform.system() == \"Linux\":\n        camDatabase = homeall+\"/Programs/OrtogOnBlender/Meshroom/aliceVision/share/aliceVision/cameraSensors.db\"\n        \n    if platform.system() == \"Windows\":\n        camDatabase = \"C:/OrtogOnBlender/Meshroom/aliceVision/share/aliceVision/cameraSensors.db\"\n\n    infile = open(camDatabase, \"r\")\n\n    numlines = 0\n    found = 0\n    for line in infile:\n        numlines += 1\n        while 1:\n            str_found_at = line.find(CamModel)\n            if str_found_at == -1:\n                # string not found in line ...\n                # go to next (ie break out of the while loop)\n                break\n            else:\n                # string found in line\n                found += 1\n                # more than once in this line?\n                # lets strip string and anything prior from line and\n                # then go through the testing loop again\n                line = line[str_found_at + len(CamModel):]\n    infile.close()\n\n    print(CamModel, \"was found\", found, \"times in\", numlines, \"lines\")\n\n    if found == 0:\n        print(\"Nao apareceu!\")\n\n        with open(camDatabase, 'a') as file:\n            inputCam = CamModel,CamModel, \"3.80;devicespecifications\"\n            print(inputCam)\n #           if platform.system() == \"Darwin\" or platform.system() == \"Windows\":\n #              file.write(\"\\n\")\n            file.write(\"\\n\")\n            file.writelines(inputCam) # Escreve o modelo de camera no arquivo\n\n# GERA FOTOGRAMETRIA\n\n    if platform.system() == \"Linux\":\n\n        \n        subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i '+tmpdir+'/JPG/; done ', shell=True)\n\n\n        subprocess.call('~/Programs/OrtogOnBlender/Meshroom/meshroom_photogrammetry --input '+tmpdir+'/JPG/ --output '+tmpdir+' --scale 2 --save '+tmpdir+'/PipelineOrtogOnBlender.txt', shell=True)\n\n\n    if platform.system() == \"Windows\":\n\n        print(\"TENTA COPIAR\")\n        subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f '+tmpdir+'\\JPG', shell=True)\n\n        print(\"TENTA RODAR MESHROOM\")\n        subprocess.call('C:/OrtogOnBlender/Meshroom/meshroom_photogrammetry --input '+tmpdir+'/JPG/ --output '+tmpdir+' --scale 2 --save '+tmpdir+'/PipelineOrtogOnBlender.txt', shell=True)\n        \n\n\n    with open(tmpdir+'/PipelineOrtogOnBlender.txt', 'r') as fd:\n        txt = fd.read()\n\n        txt = txt.replace('\"iterations\": 5','\"iterations\": 16')\n        txt = txt.replace('\"maxInputPoints\": 50000000','\"maxInputPoints\": 5000000', 1)\n        txt = txt.replace('\"maxPoints\": 5000000','\"maxPoints\": 500000', 1)\n\n    with open(tmpdir+'/PipelineOrtogOnBlender.txt', 'w') as fd:\n        fd.write(txt)\n    \n    print(\"ARQUIVO CRIADO!\")\n\n    if platform.system() == \"Linux\":\n\n        subprocess.call('~/Programs/OrtogOnBlender/Meshroom/meshroom_photogrammetry --input '+tmpdir+'/JPG/ --output '+tmpdir+' --scale 2 --pipeline '+tmpdir+'/PipelineOrtogOnBlender.txt', shell=True)\n\n\n    if platform.system() == \"Windows\":\n\n        subprocess.call('C:/OrtogOnBlender/Meshroom/meshroom_photogrammetry --input '+tmpdir+'/JPG/ --output '+tmpdir+' --scale 2 --pipeline '+tmpdir+'/PipelineOrtogOnBlender.txt', shell=True)\n\n\n    tmpOBJface = tmpdir+'/texturedMesh.obj'\n\n    bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n\n    texturedMesh = bpy.data.objects['texturedMesh']\n\n    bpy.ops.object.select_all(action='DESELECT')\n    texturedMesh.select_set(True)\n    bpy.context.view_layer.objects.active = texturedMesh\n\n    bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')\n    bpy.ops.view3d.view_all(center=False)\n    bpy.ops.file.pack_all()\n\n\n# UNIFICA UV MAP\n\n    print(\"FIX MESHROOM SURFACE AND MAP\")\n\n    ob   = bpy.context.active_object\n\n    me = ob.data\n    Faces = len(me.polygons)\n    Fator = 500000 / Faces\n\n    bpy.ops.object.modifier_add(type='DECIMATE')\n    bpy.context.object.modifiers[\"Decimate\"].ratio = Fator\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Decimate\")\n\n\n\n    photogrammetry_original = bpy.context.active_object\n\n    #bpy.ops.object.duplicate()\n\n    bpy.ops.object.duplicate_move()\n\n    photogrammetry_original.select_set(False)\n    photogrammetry_copy = bpy.context.active_object\n\n    print(photogrammetry_original)\n    print(photogrammetry_copy)\n\n\n\n    # Entra em modo de edição e seleciona todos os vértices\n    ob   = bpy.context.active_object\n\n# FATOR DECIMATE\n\n    me = ob.data\n    Faces = len(me.polygons)\n    Fator = 100000 / Faces\n\n    bpy.ops.object.modifier_add(type='DECIMATE')\n    bpy.context.object.modifiers[\"Decimate\"].ratio = Fator\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Decimate\")\n\n    #Apaga todos os materiais\n    for i in range(len(ob.material_slots)):\n        bpy.ops.object.material_slot_remove({'object': ob})\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    mesh = bmesh.from_edit_mesh(ob.data)\n    for v in mesh.verts:\n        v.select = True\n\n    # Cria UV map com espaço entre os grupos    \n    bpy.ops.uv.smart_project(island_margin=0.03)\n#    bpy.ops.uv.smart_project(island_margin=0.3)\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n\n    #Cria imagem\n    bpy.ops.image.new(name='UV_FACE', width=2048, height=2048, color=(0.5, 0.5, 0.5, 1), alpha=True, generated_type='BLANK', float=False, use_stereo_3d=False)\n\n    #Cria material\n\n\n    m = Material()\n    m.set_cycles()\n    # from chapter 1 of [DRM protected book, could not copy author/title]\n    m.make_material(\"FaceUVunic\")\n\n    ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n    ImageTexture.image = bpy.data.images['UV_FACE']\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    diffuseBSDF.inputs[5].default_value = 0\n\n    m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n\n    bpy.ops.object.material_slot_remove()\n    bpy.ops.object.material_slot_add()\n\n    bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"FaceUVunic\"]\n\n\n    # BAKE\n\n    ob.data.uv_layers['UVMap'].active = True\n\n\n#    bpy.data.scenes[\"Scene\"].cycles.bake_type = 'UV'\n    bpy.context.scene.cycles.bake_type = 'DIFFUSE'\n    bpy.context.scene.render.bake.use_pass_direct = False\n    bpy.context.scene.render.bake.use_pass_indirect = False\n\n    bpy.context.scene.render.bake.use_selected_to_active = True\n    bpy.context.scene.render.bake.margin = 2\n    bpy.context.scene.render.bake.cage_extrusion = 0.32\n\n    photogrammetry_original.select_set(True)\n\n    bpy.ops.object.bake(type='DIFFUSE')\n\n    bpy.data.images['UV_FACE'].pack()\n    bpy.ops.file.pack_all()\n    \n    # Oculta original\n    photogrammetry_original.hide_viewport=True\n\n\n\n    # MODIFICADORES\n\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n    bpy.context.object.modifiers[\"Smooth\"].show_viewport = False\n\n            #bpy.ops.object.convert(target='MESH')\n\n            # MultRes\n    bpy.ops.object.modifier_add(type='MULTIRES')\n    bpy.context.object.modifiers[\"Multires\"].show_viewport = False\n    bpy.ops.object.multires_subdivide(modifier=\"Multires\")\n\n    context = bpy.context\n    obj = context.active_object\n\n    heightTex = bpy.data.textures.new('Texture name', type='IMAGE')\n   # heightTex.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n    heightTex.image = bpy.data.images['UV_FACE']\n    dispMod = obj.modifiers.new(\"Displace\", type='DISPLACE')\n    dispMod.texture = heightTex\n    bpy.context.object.modifiers[\"Displace\"].texture_coords = 'UV'\n    bpy.context.object.modifiers[\"Displace\"].strength = 3.2\n    bpy.context.object.modifiers[\"Displace\"].mid_level = 0.5\n    bpy.context.object.modifiers[\"Displace\"].show_viewport = False\n\n            #Comprime modificadores\n    bpy.context.object.modifiers[\"Smooth\"].show_expanded = False\n    bpy.context.object.modifiers[\"Multires\"].show_expanded = False\n    bpy.context.object.modifiers[\"Displace\"].show_expanded = False\n\n    bpy.ops.object.shade_smooth()\n\n    bpy.context.space_data.shading.type = 'MATERIAL'\n\n\nclass GeraModeloFotoMeshroom(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelo_foto_meshroom\"\n    bl_label = \"Gera Modelos Foto Meshroom\"\n    \n    def execute(self, context):\n        GeraModeloFotoMeshroomDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModeloFotoMeshroom)\n\n\n\n\n"
  },
  {
    "path": "FotogrametriaOpenMVG.py",
    "content": "import bpy\nimport subprocess\nimport platform\nfrom os.path import expanduser\nimport shutil\nimport tempfile\nfrom os import listdir\nfrom os.path import isfile, join\nimport multiprocessing\nimport exifread\nimport re\nimport os\n\n\n# MENSAGENS\n\nclass MessageFaltaFotos(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_falta_foto\"\n    bl_label = \"Doesn't have photo path!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have photo path!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageFaltaFotos)\n\n'''\n# ERROS\n\ndef ERROruntimeFotosDef(self, context):\n    self.layout.label(\"Doesn't have photo path!\")\n\ndef ERROTermFoto():\n     CRED = '\\033[91m'\n     CEND = '\\033[0m'\n     print(CRED + \"Doesn't have photo path!\" + CEND)\n'''\n\n# Converte JPG\n\ndef ConverteHEICtoJPG():\n\n    context = bpy.context\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    mypath = scn.my_tool.path_photo\n    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n    FotoTeste = onlyfiles[1]\n    print(\"Listando arquivos...\")\n\n    Testajpg = \".jpg\" in FotoTeste\n    TestaHEIC = \".HEIC\" in FotoTeste\n    Testaheic = \".heic\" in FotoTeste\n    Testajpeg = \".jpeg\" in FotoTeste\n    TestaJPEG = \".JPEG\" in FotoTeste\n\n\n    # Copia arquivos tmp\n\n    if Testajpg == True or TestaHEIC == True or Testaheic == True or Testajpeg == True or TestaJPEG == True:\n\n        tmpFotos = tempfile.mkdtemp()\n\n\n        print(\"COPIANDO ARQUIOS...\")\n        print(\"tmpFotos:\", tmpFotos)\n\n        os.chdir(scn.my_tool.path_photo)\n\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('cp * '+tmpFotos, shell=True)\n            scn.my_tool.path_photo = tmpFotos+\"/\"\n\n        if platform.system() == \"Windows\":\n            subprocess.call('copy *.* '+tmpFotos, shell=True)\n            scn.my_tool.path_photo = tmpFotos+\"\\\\\"\n\n        os.chdir(scn.my_tool.path_photo)\n\n    else:\n        print(\"Algo deu errado com a cópia dos arquivos...\")\n\n\n\t# TESTA ARQUIVOS\n\n    mypath = scn.my_tool.path_photo # Novamente para atualizar\n    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n    FotoTeste = onlyfiles[1]\n    print(\"Listando arquivos...\")\n\n    Testajpg = \".jpg\" in FotoTeste\n    TestaHEIC = \".HEIC\" in FotoTeste\n    Testaheic = \".heic\" in FotoTeste\n    Testajpeg = \".jpeg\" in FotoTeste\n    TestaJPEG = \".JPEG\" in FotoTeste\n\n    if TestaHEIC == True or Testaheic == True:\n        if platform.system() == \"Linux\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do heif-convert $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && mogrify -format jpg *.HEIC && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n\n    if Testajpeg == True:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Windows\" :\n\n            subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f %f.jpg & move *.jpg '+tmpdir+'\\JPG', shell=True)\n            scn.my_tool.path_photo = tmpdir+'\\JPG\\\\' # Se não colocar as duas barras não funciona!\n\n\n    if TestaJPEG == True:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Windows\" :\n\n            subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f %f.jpg & move *.jpg '+tmpdir+'\\JPG', shell=True)\n            scn.my_tool.path_photo = tmpdir+'\\JPG\\\\' # Se não colocar as duas barras não funciona!\n\n\n# PREPARA CENA\n\ndef PreparaCenaFotogramDef(self, context):\n    try:\n        bpy.ops.object.select_all(action='SELECT')\n\n        objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n        for i in objetos_selecionados:\n            i.hide_viewport = True\n    except:\n        print(\"Cena já preparada.\")\n\nclass PreparaCenaFotogram(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.prepara_cena_fotogram\"\n    bl_label = \"Photogrammetry Scene Setup\"\n\n    def execute(self, context):\n        PreparaCenaFotogramDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(PreparaCenaFotogram)\n\n# MODELOS\n\ndef GeraModeloFotoDef(self, context):\n\n    scn = context.scene\n\n    #CRIA OU SETA DIRETÓRIO TEMPORÁRIO\n#    if platform.system() == \"Linux\":\n    tmpdir = tempfile.mkdtemp()\n#    else:\n#        tmpdir = tempfile.gettempdir()\n\n    dFactor = scn.d_factor\n    smoothFactor = scn.smooth_factor\n\n    homeall = expanduser(\"~\")\n\n    '''\n\n    mypath = scn.my_tool.path_photo\n    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n    FotoTeste = onlyfiles[1]\n    print(\"Listando arquivos...\")\n\n    Testajpg = \".jpg\" in FotoTeste\n    TestaHEIC = \".HEIC\" in FotoTeste\n    Testaheic = \".heic\" in FotoTeste\n    Testajpeg = \".jpeg\" in FotoTeste\n    TestaJPEG = \".JPEG\" in FotoTeste\n\n\n    # Copia arquivos tmp\n\n    if Testajpg == True or TestaHEIC == True or Testaheic == True or Testajpeg == True or TestaJPEG == True:\n\n        tmpFotos = tempfile.mkdtemp()\n\n\n        print(\"COPIANDO ARQUIOS...\")\n        print(\"tmpFotos:\", tmpFotos)\n\n        os.chdir(scn.my_tool.path_photo)\n\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('cp * '+tmpFotos, shell=True)\n            scn.my_tool.path_photo = tmpFotos+\"/\"\n\n        if platform.system() == \"Windows\":\n            subprocess.call('copy *.* '+tmpFotos, shell=True)\n            scn.my_tool.path_photo = tmpFotos+\"\\\\\"\n\n        os.chdir(scn.my_tool.path_photo)\n\n    else:\n        print(\"Algo deu errado com a cópia dos arquivos...\")\n\n\n\t# TESTA ARQUIVOS\n\n    mypath = scn.my_tool.path_photo # Novamente para atualizar\n    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n    FotoTeste = onlyfiles[1]\n    print(\"Listando arquivos...\")\n\n    Testajpg = \".jpg\" in FotoTeste\n    TestaHEIC = \".HEIC\" in FotoTeste\n    Testaheic = \".heic\" in FotoTeste\n    Testajpeg = \".jpeg\" in FotoTeste\n    TestaJPEG = \".JPEG\" in FotoTeste\n\n    if TestaHEIC == True or Testaheic == True:\n        if platform.system() == \"Linux\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do heif-convert $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && mogrify -format jpg *.HEIC && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n\n    if Testajpeg == True:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Windows\" :\n\n            subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f %f.jpg & move *.jpg '+tmpdir+'\\JPG', shell=True)\n            scn.my_tool.path_photo = tmpdir+'\\JPG\\\\' # Se não colocar as duas barras não funciona!\n\n\n    if TestaJPEG == True:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Windows\" :\n\n            subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f %f.jpg & move *.jpg '+tmpdir+'\\JPG', shell=True)\n            scn.my_tool.path_photo = tmpdir+'\\JPG\\\\' # Se não colocar as duas barras não funciona!\n\n\n    '''\n\n    ConverteHEICtoJPG()\n\n    # REDUZ FOTOS ------------------------------------------------------------\n\n    if bpy.context.scene.my_tool.imagem_bool == True:\n\n\n        print(\"REDUZ FOTOS\")\n        print(\"bpy.context.scene.my_tool.path_photo\", bpy.context.scene.my_tool.path_photo)\n\n        tmpdirFotos = tempfile.mkdtemp()\n\n        Origem = bpy.context.scene.my_tool.path_photo\n\n        # Copia imagens para temporário\n        ListaImagens = sorted(os.listdir(Origem))\n\n        ImagContador = 0\n\n        for ImagemAtual in ListaImagens:\n            shutil.copyfile(Origem+ImagemAtual, tmpdirFotos+\"/\"+str(ImagContador)+\".jpg\")\n            ImagContador += 1\n\n\n            print(\"Copiando:\", Origem+ImagemAtual, \"para:\", tmpdirFotos+\"/\"+str(ImagContador)+\".jpg\")\n\n        bpy.context.scene.my_tool.path_photo = Origem\n\n        # Reduz imagens\n        ListaArquivos = sorted(os.listdir(tmpdirFotos))\n\n    #    print(\"ORIGEM:\", Origem)\n\n        print(\"FOOOOOOOOOOOOOOOOI\")\n\n        tmpdirIMagemgick = tempfile.mkdtemp()\n\n\n        for ArquivoAtual in ListaArquivos:\n\n            print(\"Reduzindo\",ArquivoAtual)\n\n            bpy.ops.image.open(filepath=tmpdirFotos+ArquivoAtual, directory=tmpdirFotos, files=[{\"name\":ArquivoAtual, \"name\":ArquivoAtual}], relative_path=False, show_multiview=False)\n\n            ImgDim0 = bpy.data.images[ArquivoAtual].size[0]\n            ImgDim1 = bpy.data.images[ArquivoAtual].size[1]\n\n            LadoMaior = max(ImgDim0, ImgDim1)\n\n\n            CpuNum = multiprocessing.cpu_count()\n\n            if CpuNum >= 8:\n                FatorPixel = 2536\n\n            if CpuNum == 6:\n                FatorPixel = 2536\n\n            if CpuNum == 4:\n                FatorPixel = 2536\n\n            if CpuNum == 2:\n                FatorPixel = 2200\n\n            if CpuNum == 1:\n                FatorPixel = 2200\n\n            if LadoMaior > FatorPixel:\n                print(\"Maior que \"+str(FatorPixel)+\"!\")\n                FatorDivisao = LadoMaior/FatorPixel\n    #            bpy.data.images[ArquivoAtual].scale( int(ImgDim0/FatorDivisao), int(ImgDim1/FatorDivisao) )\n\n                if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n                        subprocess.call('convert -resize '+str(100/FatorDivisao)+'% '+tmpdirFotos+\"/\"+ArquivoAtual+' '+tmpdirIMagemgick+\"/\"+ArquivoAtual, shell=True)\n\n            #bpy.data.images[ArquivoAtual].save()\n\n                bpy.context.scene.my_tool.path_photo = tmpdirIMagemgick+\"/\"\n\n\n                if platform.system() == \"Windows\":\n                        subprocess.call('C:\\OrtogOnBlender\\ImageMagick\\convert -resize '+str(100/FatorDivisao)+'% '+tmpdirFotos+'\\\\'+ArquivoAtual+' '+tmpdirIMagemgick+'\\\\'+ArquivoAtual, shell=True) # O convert zoa os dados do EXIF no Windows!\n\n            #bpy.data.images[ArquivoAtual].save()\n\n                bpy.context.scene.my_tool.path_photo = tmpdirIMagemgick+\"/\"\n\n\n    # TESTA CAMERA\n\n\n#    if platform.system() == \"Windows\":\n    if bpy.context.scene.my_tool.path_photo == \"\":\n        bpy.ops.object.dialog_operator_falta_foto('INVOKE_DEFAULT')\n\n\n    else:\n\n\n        mypath = scn.my_tool.path_photo  # Tem que ter o / no final\n #       mypathFotos = mypath+'*'\n #       print(\"Caminho:\"+mypathFotos)\n\n        onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n\n        FotoTeste = onlyfiles[1]\n        try:\n            with open(mypath + FotoTeste, 'rb') as f_jpg:\n                tags = exifread.process_file(f_jpg, details=True)\n                print (tags['Image Model'])\n                CamModel = str(tags['Image Model'])\n            #print(\"CamModel:\", CamModel)\n        except:\n            print(\"Não rolou!\")\n#                subprocess.call([os.system('cd'+mypath), '&&', homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh'])\n            if platform.system() == \"Linux\":\n                os.system('cd '+mypath+' && '+homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh')\n\n            if platform.system() == \"Darwin\":\n                os.system('cd '+mypath+' && '+homeall+'/Programs/OrtogOnBlender/openMVGMACelcap/ExifTool.sh')\n\n            if platform.system() == \"Windows\":\n                print(mypath)\n\n                subprocess.call(['C:\\OrtogOnBlender\\ExitTool\\exiftool.exe', '-all=', mypath]) # Necessário pq o convert zoa os dados do EXIF no Windows!\n                print(\"Exif apagado tudo!\")\n                subprocess.call(['C:\\OrtogOnBlender\\ExitTool\\exiftool.exe', '-overwrite_original', '-Model=Z00AD', '-FocalLength=4', mypath+'*']) # Solução colocando o 4 sem as aspas duplas!\n\n            print(\"Resolvido!\")\n\n        try:\n            with open(mypath + FotoTeste, 'rb') as f_jpg:\n                tags = exifread.process_file(f_jpg, details=True)\n                print (tags['Image Model'])\n                CamModel = str(tags['Image Model'])+\";\"\n\n\n            # TESTA MODELO CAMERA\n\n            if platform.system() == \"Linux\":\n                camDatabase = homeall+\"/Programs/OrtogOnBlender/openMVG/sensor_width_camera_database.txt\"\n\n            if platform.system() == \"Darwin\":\n                camDatabase = homeall+\"/Programs/OrtogOnBlender/openMVGMACelcap/sensor_width_camera_database.txt\"\n\n\n            if platform.system() == \"Windows\":\n                camDatabase = \"C:/OrtogOnBlender/openMVGWIN/sensor_width_camera_database.txt\"\n\n\n\n            infile = open(camDatabase, \"r\")\n\n            numlines = 0\n            found = 0\n            for line in infile:\n                numlines += 1\n                while 1:\n                    str_found_at = line.find(CamModel)\n                    if str_found_at == -1:\n                        # string not found in line ...\n                        # go to next (ie break out of the while loop)\n                        break\n                    else:\n                        # string found in line\n                        found += 1\n                        # more than once in this line?\n                        # lets strip string and anything prior from line and\n                        # then go through the testing loop again\n                        line = line[str_found_at + len(CamModel):]\n            infile.close()\n\n            print(CamModel, \"was found\", found, \"times in\", numlines, \"lines\")\n\n            if found == 0:\n                print(\"Nao apareceu!\")\n\n                with open(camDatabase, 'a') as file:\n                    inputCam = CamModel, \" 3.80\"\n                    print(inputCam)\n         #           if platform.system() == \"Darwin\" or platform.system() == \"Windows\":\n         #              file.write(\"\\n\")\n                    file.write(\"\\n\")\n                    file.writelines(inputCam) # Escreve o modelo de camera no arquivo\n        except:\n            print(\"Algum problema com o Modelo de Câmera!\")\n\n\n        # GERA FOTOGRAMETRIA\n\n    #    try:\n\n    #    if scn.my_tool.path_photo == \"\":\n    #        ERROTermFoto()\n    #        bpy.context.window_manager.popup_menu(ERROruntimeFotosDef, title=\"Attention!\", icon='INFO')\n\n    #    else:\n\n\n        OpenMVGtmpDir = tmpdir+'/OpenMVG'\n        tmpOBJface = tmpdir+'/MVS/scene_dense_mesh_texture.obj'\n\n\n        if platform.system() == \"Linux\":\n            OpenMVGPath = homeall+'/Programs/OrtogOnBlender/openMVG/software/SfM/SfM_SequentialPipeline.py'\n            OpenMVSPath = homeall+'/Programs/OrtogOnBlender/openMVS/OpenMVS'\n            print(\"É Linux\")\n\n        if platform.system() == \"Windows\":\n            OpenMVGPath = 'C:/OrtogOnBlender/openMVGWin/software/SfM/SfM_SequentialPipeline.py'\n            OpenMVSPath = 'C:/OrtogOnBlender/openMVSWin/OpenMVS.bat'\n\n        if platform.system() == \"Darwin\":\n           #         if platform.release() == '15.6.0':\n        #                OpenMVGPath = '/OrtogOnBlender/openMVGMACelcap/SfM_SequentialPipeline.py'\n        #                OpenMVSPath = '/OrtogOnBlender/openMVSMACelcap/openMVSMAC.sh'\n        #            if platform.release() == '17.5.0':\n        #                OpenMVGPath = '/OrtogOnBlender/openMVGMACelcap/SfM_SequentialPipeline.py'\n        #                OpenMVSPath = '/OrtogOnBlender/openMVSMACelcap/openMVSMAC.sh'\n        #            else:\n        #                OpenMVGPath = '/OrtogOnBlender/openMVGMAC/SfM_SequentialPipeline.py'\n        #                OpenMVSPath = '/OrtogOnBlender/openMVSMAC/openMVSMAC.sh'\n            OpenMVGPath = homeall+'/Programs/OrtogOnBlender/openMVGMACelcap/SfM_SequentialPipeline.py'\n            OpenMVSPath = homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/openMVSMAC.sh'\n\n            shutil.rmtree(tmpdir+'/OpenMVG', ignore_errors=True)\n            shutil.rmtree(tmpdir+'/MVS', ignore_errors=True)\n\n            #    if os.name=='posix':\n            #    \tshutil.rmtree(tmpdir+'/OpenMVG')\n            #    \tshutil.rmtree(tmpdir+'/MVS')\n\n            #    if os.name=='nt':\n            #    \tsubprocess.call(['rmdir', '/Q', '/S', tmpdir+'/OpenMVG'])\n            #    \tsubprocess.call(['rmdir', '/Q', '/S', tmpdir+'/MVS'])\n\n\n        if platform.system() == \"Linux\":\n\n            with open(\"/etc/issue\") as f:\n             Versao = str(f.read().lower().split()[1])\n\n            if Versao == \"18.04\":\n                subprocess.call(['python', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n            if Versao == \"20.04.1\" or Versao == \"20.04\":\n                subprocess.call(['python2', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n        if platform.system() == \"Windows\":\n            subprocess.call(['C:/OrtogOnBlender/Python27/python', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n        if platform.system() == \"Darwin\":\n            subprocess.call(['python', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n\n        #subprocess.call(OpenMVSPath ,  shell=True)\n\n        if platform.system() == \"Linux\":\n\n            with open(\"/etc/issue\") as f:\n             Versao = str(f.read().lower().split()[1])\n\n            if Versao == \"18.04\":\n\n                subprocess.call('cd '+tmpdir+' && mkdir MVS && ~/Programs/OrtogOnBlender/openMVG/./openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && ~/Programs/OrtogOnBlender/openMVS/./DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && ~/Programs/OrtogOnBlender/openMVS/./ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && ~/Programs/OrtogOnBlender/openMVS/./TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n            if Versao == \"20.04\":\n\n                subprocess.call('cd '+tmpdir+' && mkdir MVS && ~/Programs/OrtogOnBlender/openMVG/./openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && ~/Programs/OrtogOnBlender/openMVS_ubuntu_2004/./DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && ~/Programs/OrtogOnBlender/openMVS_ubuntu_2004/./ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && ~/Programs/OrtogOnBlender/openMVS_ubuntu_2004/./TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n        if platform.system() == \"Darwin\":\n\n            subprocess.call('cd '+tmpdir+' && mkdir MVS && '+homeall+'/Programs/OrtogOnBlender/openMVGMACelcap/openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && '+homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/./DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && '+homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/./ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && '+homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/./TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n        if platform.system() == \"Windows\":\n\n            subprocess.call('cd '+tmpdir+' && mkdir MVS && C:\\OrtogOnBlender\\openMVGWin\\openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && C:\\OrtogOnBlender\\openMVSWin\\DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && C:\\OrtogOnBlender\\openMVSWin\\ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && C:\\OrtogOnBlender\\openMVSWin\\TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n#        else:\n#            subprocess.call(OpenMVSPath ,  shell=True)\n            #subprocess.call([ 'meshlabserver', '-i', tmpdir+'scene_dense_mesh_texture.ply', '-o', tmpdir+'scene_dense_mesh_texture.obj', '-om', 'vn', 'wt' ])\n\n\n\n        bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n\n        scene_dense_mesh_texture = bpy.data.objects['scene_dense_mesh_texture']\n\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.context.view_layer.objects.active = scene_dense_mesh_texture\n        bpy.data.objects['scene_dense_mesh_texture'].select_set(True)\n\n\n        bpy.context.object.data.use_auto_smooth = False\n#        bpy.context.object.active_material.specular_hardness = 60\n#        bpy.context.object.active_material.diffuse_intensity = 0.6\n#        bpy.context.object.active_material.specular_intensity = 0.3\n        bpy.context.object.active_material.specular_color = (0.233015, 0.233015, 0.233015)\n            #    bpy.ops.object.modifier_add(type='SMOOTH')\n            #    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n            #    bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n            #    bpy.ops.object.convert(target='MESH')\n            #    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Smooth\")\n\n        bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')\n        #bpy.ops.view3d.view_all(center=False)\n\n        # Centraliza zoom\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                for region in area.regions:\n                    if region.type == 'WINDOW':\n                        override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                        bpy.ops.view3d.view_all(override)\n\n\n        bpy.ops.file.pack_all()\n\n        bpy.ops.object.modifier_add(type='SMOOTH')\n        bpy.context.object.modifiers[\"Smooth\"].factor = 2\n        bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n        bpy.context.object.modifiers[\"Smooth\"].show_viewport = False\n\n                #bpy.ops.object.convert(target='MESH')\n\n                # MultRes\n        bpy.ops.object.modifier_add(type='MULTIRES')\n        bpy.context.object.modifiers[\"Multires\"].show_viewport = False\n        bpy.ops.object.multires_subdivide(modifier=\"Multires\")\n\n        context = bpy.context\n        obj = context.active_object\n\n        heightTex = bpy.data.textures.new('Texture name', type='IMAGE')\n       # heightTex.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n        heightTex.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n        dispMod = obj.modifiers.new(\"Displace\", type='DISPLACE')\n        dispMod.texture = heightTex\n        bpy.context.object.modifiers[\"Displace\"].texture_coords = 'UV'\n        bpy.context.object.modifiers[\"Displace\"].strength = 3.2\n        bpy.context.object.modifiers[\"Displace\"].mid_level = 0.5\n        bpy.context.object.modifiers[\"Displace\"].show_viewport = False\n\n                #Comprime modificadores\n        bpy.context.object.modifiers[\"Smooth\"].show_expanded = False\n        bpy.context.object.modifiers[\"Multires\"].show_expanded = False\n        bpy.context.object.modifiers[\"Displace\"].show_expanded = False\n\n        bpy.ops.object.shade_smooth()\n\n        bpy.context.space_data.shading.type = 'SOLID'\n        bpy.context.space_data.shading.color_type = 'TEXTURE'\n\n\n\nclass GeraModeloFoto(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelo_foto\"\n    bl_label = \"Gera Modelos Foto\"\n\n    def execute(self, context):\n        GeraModeloFotoDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModeloFoto)\n"
  },
  {
    "path": "FotogrametriaOpenMVGWinWSL.py",
    "content": "import bpy\nimport subprocess\nimport platform\nfrom os.path import expanduser\nimport shutil\nimport tempfile\nfrom os import listdir\nfrom os.path import isfile, join\nimport multiprocessing\nimport exifread\nimport re\nimport os\n\n\n# MENSAGENS\n\nclass MessageFaltaFotos(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_falta_foto\"\n    bl_label = \"Doesn't have photo path!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have photo path!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageFaltaFotos)\n\n'''\n# ERROS\n\ndef ERROruntimeFotosDef(self, context):\n    self.layout.label(\"Doesn't have photo path!\")\n\ndef ERROTermFoto():\n     CRED = '\\033[91m'\n     CEND = '\\033[0m'\n     print(CRED + \"Doesn't have photo path!\" + CEND)\n'''\n\n# PREPARA CENA\n\ndef PreparaCenaFotogramDef(self, context):\n    try:\n        bpy.ops.object.select_all(action='SELECT')\n\n        objetos_selecionados = [ o for o in bpy.context.scene.objects if o.select_get() == True ]\n\n        for i in objetos_selecionados:\n            i.hide_viewport = True\n    except:\n        print(\"Cena já preparada.\")\n\nclass PreparaCenaFotogram(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.prepara_cena_fotogram\"\n    bl_label = \"Photogrammetry Scene Setup\"\n\n    def execute(self, context):\n        PreparaCenaFotogramDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(PreparaCenaFotogram)\n\n# MODELOS\n\ndef GeraModeloFotoDef(self, context):\n\n    scn = context.scene\n\n\n    #CRIA OU SETA DIRETÓRIO TEMPORÁRIO\n#    if platform.system() == \"Linux\":\n    tmpdir = tempfile.mkdtemp()\n#    else:\n#        tmpdir = tempfile.gettempdir()\n\n    dFactor = scn.d_factor\n    smoothFactor = scn.smooth_factor\n\n    homeall = expanduser(\"~\")\n\n\t# TESTA ARQUIVOS\n    mypath = scn.my_tool.path_photo\n    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n    FotoTeste = onlyfiles[1]\n\n    TestaHEIC = \".HEIC\" in FotoTeste\n\n    if TestaHEIC == True:\n        if platform.system() == \"Linux\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do heif-convert $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && mogrify -format jpg *.HEIC && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n    Testajpeg = \".jpeg\" in FotoTeste\n\n    if Testajpeg == True:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Windows\" :\n\n            subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f %f.jpg & move *.jpg '+tmpdir+'\\JPG', shell=True)\n            scn.my_tool.path_photo = tmpdir+'\\JPG\\\\' # Se não colocar as duas barras não funciona!\n\n\n    TestaJPEG = \".JPEG\" in FotoTeste\n\n    if TestaJPEG == True:\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            subprocess.call('mkdir '+tmpdir+'/JPG && cd '+mypath+' && for i in *; do cp $i $i.jpg; done && mv *.jpg '+tmpdir+'/JPG/', shell=True)\n            scn.my_tool.path_photo = tmpdir+'/JPG/'\n\n        if platform.system() == \"Windows\" :\n\n            subprocess.call('mkdir '+tmpdir+'\\JPG & cd '+mypath+' & for %f in (*) do copy %f %f.jpg & move *.jpg '+tmpdir+'\\JPG', shell=True)\n            scn.my_tool.path_photo = tmpdir+'\\JPG\\\\' # Se não colocar as duas barras não funciona!\n\n    # REDUZ FOTOS\n\n    print(\"REDUZ FOTOS\")\n    print(\"bpy.context.scene.my_tool.path_photo\", bpy.context.scene.my_tool.path_photo)\n\n    tmpdirFotos = tempfile.mkdtemp()\n\n    Origem = bpy.context.scene.my_tool.path_photo\n\n    # Copia imagens para temporário\n    ListaImagens = sorted(os.listdir(Origem))\n\n    ImagContador = 0\n\n    for ImagemAtual in ListaImagens:\n        shutil.copyfile(Origem+ImagemAtual, tmpdirFotos+\"/\"+str(ImagContador)+\".jpg\")\n        ImagContador += 1\n\n\n        print(\"Copiando:\", Origem+ImagemAtual, \"para:\", tmpdirFotos+\"/\"+str(ImagContador)+\".jpg\")\n\n    bpy.context.scene.my_tool.path_photo = Origem\n\n    # Reduz imagens\n    ListaArquivos = sorted(os.listdir(tmpdirFotos))\n\n#    print(\"ORIGEM:\", Origem)\n\n    print(\"FOOOOOOOOOOOOOOOOI\")\n\n    tmpdirIMagemgick = tempfile.mkdtemp()\n\n\n    for ArquivoAtual in ListaArquivos:\n\n        print(\"Reduzindo\",ArquivoAtual)\n\n        bpy.ops.image.open(filepath=tmpdirFotos+ArquivoAtual, directory=tmpdirFotos, files=[{\"name\":ArquivoAtual, \"name\":ArquivoAtual}], relative_path=False, show_multiview=False)\n\n        ImgDim0 = bpy.data.images[ArquivoAtual].size[0]\n        ImgDim1 = bpy.data.images[ArquivoAtual].size[1]\n\n        LadoMaior = max(ImgDim0, ImgDim1)\n\n\n        CpuNum = multiprocessing.cpu_count()\n\n        if CpuNum >= 8:\n            FatorPixel = 2536\n\n        if CpuNum == 6:\n            FatorPixel = 2536\n\n        if CpuNum == 4:\n            FatorPixel = 2536\n\n        if CpuNum == 2:\n            FatorPixel = 2200\n\n        if CpuNum == 1:\n            FatorPixel = 2200\n\n        if LadoMaior > FatorPixel:\n            print(\"Maior que \"+str(FatorPixel)+\"!\")\n            FatorDivisao = LadoMaior/FatorPixel\n#            bpy.data.images[ArquivoAtual].scale( int(ImgDim0/FatorDivisao), int(ImgDim1/FatorDivisao) )\n\n            if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n                    subprocess.call('convert -resize '+str(100/FatorDivisao)+'% '+tmpdirFotos+\"/\"+ArquivoAtual+' '+tmpdirIMagemgick+\"/\"+ArquivoAtual, shell=True)\n\n        #bpy.data.images[ArquivoAtual].save()\n\n            bpy.context.scene.my_tool.path_photo = tmpdirIMagemgick+\"/\"\n\n\n            if platform.system() == \"Windows\":\n                    #subprocess.call('C:\\OrtogOnBlender\\ImageMagick\\convert -resize '+str(100/FatorDivisao)+'% '+tmpdirFotos+'\\\\'+ArquivoAtual+' '+tmpdirIMagemgick+'\\\\'+ArquivoAtual, shell=True) # O convert zoa os dados do EXIF no Windows!\n\n                    FotosAtual = str(tmpdirFotos+\"/\"+ArquivoAtual).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n                    MagickAtual = str(tmpdirIMagemgick+\"/\"+ArquivoAtual).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n                    subprocess.call(\"wsl \\\"convert\\\" -resize \\\"\"+str(100/FatorDivisao)+\"%\\\" \\\"\"+FotosAtual+\"\\\" \\\"\"+MagickAtual+\"\\\"\", shell=True)\n                    print(\"Reduzido com convert\")\n\n        #bpy.data.images[ArquivoAtual].save()\n\n            bpy.context.scene.my_tool.path_photo = tmpdirIMagemgick+\"/\"\n\n\n    # TESTA CAMERA\n\n\n#    if platform.system() == \"Windows\":\n    if bpy.context.scene.my_tool.path_photo == \"\":\n        bpy.ops.object.dialog_operator_falta_foto('INVOKE_DEFAULT')\n\n\n    else:\n\n\n        mypath = scn.my_tool.path_photo  # Tem que ter o / no final\n #       mypathFotos = mypath+'*'\n #       print(\"Caminho:\"+mypathFotos)\n\n        onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n\n        FotoTeste = onlyfiles[1]\n        try:\n            with open(mypath + FotoTeste, 'rb') as f_jpg:\n                tags = exifread.process_file(f_jpg, details=True)\n                print (tags['Image Model'])\n                CamModel = str(tags['Image Model'])\n            #print(\"CamModel:\", CamModel)\n        except:\n            print(\"Não rolou!\")\n#                subprocess.call([os.system('cd'+mypath), '&&', homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh'])\n            if platform.system() == \"Linux\":\n                os.system('cd '+mypath+' && '+homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh')\n\n            if platform.system() == \"Darwin\":\n                os.system('cd '+mypath+' && '+homeall+'/Programs/OrtogOnBlender/openMVGMACelcap/ExifTool.sh')\n\n            if platform.system() == \"Windows\":\n                print(mypath)\n\n                #subprocess.call(['C:\\OrtogOnBlender\\ExitTool\\exiftool.exe', '-all=', mypath]) # Necessário pq o convert zoa os dados do EXIF no Windows!\n                #print(\"Exif apagado tudo!\")\n                subprocess.call(['C:\\OrtogOnBlender\\ExitTool\\exiftool.exe', '-overwrite_original', '-Model=Z00AD', '-FocalLength=4', mypath+'*']) # Solução colocando o 4 sem as aspas duplas!\n\n\n                # CASO SEJA NECESSARIO EXIFTOOL WINDOWS\n\n                tmpdirNovo = str(tmpdir).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n                print(\"COMANDO EXIFTOOL\")\n                print(\"wsl \\\"exiftool \\\" -overwrite_original -Model=\\\"Z00AD\\\" -FocalLength=\\\"3.8 mm\\\" \\\"\"+tmpdirNovo+\"/*\\\"\")\n\n                subprocess.call(\"wsl \\\"exiftool \\\" -overwrite_original -Model=\\\"Z00AD\\\" -FocalLength=\\\"3.8 mm\\\" \\\"\"+tmpdirNovo+\"/*\\\"\" , shell=True)\n\n\n            print(\"Resolvido!\")\n\n        with open(mypath + FotoTeste, 'rb') as f_jpg:\n            tags = exifread.process_file(f_jpg, details=True)\n            print (tags['Image Model'])\n            CamModel = str(tags['Image Model'])+\";\"\n\n\n        # TESTA MODELO CAMERA\n\n        if platform.system() == \"Linux\":\n            camDatabase = homeall+\"/Programs/OrtogOnBlender/openMVG/sensor_width_camera_database.txt\"\n\n        if platform.system() == \"Darwin\":\n            camDatabase = homeall+\"/Programs/OrtogOnBlender/openMVGMACelcap/sensor_width_camera_database.txt\"\n\n\n        if platform.system() == \"Windows\":\n            camDatabase = \"C:/OrtogOnBlender/openMVGWIN/sensor_width_camera_database.txt\"\n\n\n\n        infile = open(camDatabase, \"r\")\n\n        numlines = 0\n        found = 0\n        for line in infile:\n            numlines += 1\n            while 1:\n                str_found_at = line.find(CamModel)\n                if str_found_at == -1:\n                    # string not found in line ...\n                    # go to next (ie break out of the while loop)\n                    break\n                else:\n                    # string found in line\n                    found += 1\n                    # more than once in this line?\n                    # lets strip string and anything prior from line and\n                    # then go through the testing loop again\n                    line = line[str_found_at + len(CamModel):]\n        infile.close()\n\n        print(CamModel, \"was found\", found, \"times in\", numlines, \"lines\")\n\n        if found == 0:\n            print(\"Nao apareceu!\")\n\n            with open(camDatabase, 'a') as file:\n                inputCam = CamModel, \" 3.80\"\n                print(inputCam)\n     #           if platform.system() == \"Darwin\" or platform.system() == \"Windows\":\n     #              file.write(\"\\n\")\n                file.write(\"\\n\")\n                file.writelines(inputCam) # Escreve o modelo de camera no arquivo\n\n\n\n        # GERA FOTOGRAMETRIA\n\n    #    try:\n\n    #    if scn.my_tool.path_photo == \"\":\n    #        ERROTermFoto()\n    #        bpy.context.window_manager.popup_menu(ERROruntimeFotosDef, title=\"Attention!\", icon='INFO')\n\n    #    else:\n\n\n        OpenMVGtmpDir = tmpdir+'/OpenMVG'\n        tmpOBJface = tmpdir+'/MVS/scene_dense_mesh_texture.obj'\n\n\n        if platform.system() == \"Linux\":\n            OpenMVGPath = homeall+'/Programs/OrtogOnBlender/openMVG/software/SfM/SfM_SequentialPipeline.py'\n            OpenMVSPath = homeall+'/Programs/OrtogOnBlender/openMVS/OpenMVS'\n            print(\"É Linux\")\n\n        if platform.system() == \"Windows\":\n            OpenMVGPath = 'C:/OrtogOnBlender/openMVGWin/software/SfM/SfM_SequentialPipeline.py'\n            OpenMVSPath = 'C:/OrtogOnBlender/openMVSWin/OpenMVS.bat'\n\n        if platform.system() == \"Darwin\":\n           #         if platform.release() == '15.6.0':\n        #                OpenMVGPath = '/OrtogOnBlender/openMVGMACelcap/SfM_SequentialPipeline.py'\n        #                OpenMVSPath = '/OrtogOnBlender/openMVSMACelcap/openMVSMAC.sh'\n        #            if platform.release() == '17.5.0':\n        #                OpenMVGPath = '/OrtogOnBlender/openMVGMACelcap/SfM_SequentialPipeline.py'\n        #                OpenMVSPath = '/OrtogOnBlender/openMVSMACelcap/openMVSMAC.sh'\n        #            else:\n        #                OpenMVGPath = '/OrtogOnBlender/openMVGMAC/SfM_SequentialPipeline.py'\n        #                OpenMVSPath = '/OrtogOnBlender/openMVSMAC/openMVSMAC.sh'\n            OpenMVGPath = homeall+'/Programs/OrtogOnBlender/openMVGMACelcap/SfM_SequentialPipeline.py'\n            OpenMVSPath = homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/openMVSMAC.sh'\n\n            shutil.rmtree(tmpdir+'/OpenMVG', ignore_errors=True)\n            shutil.rmtree(tmpdir+'/MVS', ignore_errors=True)\n\n            #    if os.name=='posix':\n            #    \tshutil.rmtree(tmpdir+'/OpenMVG')\n            #    \tshutil.rmtree(tmpdir+'/MVS')\n\n            #    if os.name=='nt':\n            #    \tsubprocess.call(['rmdir', '/Q', '/S', tmpdir+'/OpenMVG'])\n            #    \tsubprocess.call(['rmdir', '/Q', '/S', tmpdir+'/MVS'])\n\n\n        if platform.system() == \"Linux\":\n            subprocess.call(['python', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n\n        if platform.system() == \"Windows\":\n            OpenMVGtmpDir = tmpdir+'/OpenMVG/'\n            Fotos = str(scn.my_tool.path_photo).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n            Saida = str(OpenMVGtmpDir).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n            subprocess.call(\"wsl \\\"python\\\" \\\"/mnt/c/OrtogOnBlender/OpenMVGLinux/openMVG/software/SfM/SfM_SequentialPipeline.py\\\" \\\"\"+Fotos+\"\\\" \\\"\"+Saida+\"\\\"\" , shell=True)\n\n            #subprocess.call(['C:/OrtogOnBlender/Python27/python', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n\n        if platform.system() == \"Darwin\":\n            subprocess.call(['python', OpenMVGPath , scn.my_tool.path_photo ,  OpenMVGtmpDir])\n\n\n        #subprocess.call(OpenMVSPath ,  shell=True)\n\n        if platform.system() == \"Linux\":\n\n            subprocess.call('cd '+tmpdir+' && mkdir MVS && ~/Programs/OrtogOnBlender/openMVG/./openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && ~/Programs/OrtogOnBlender/openMVS/./DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && ~/Programs/OrtogOnBlender/openMVS/./ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && ~/Programs/OrtogOnBlender/openMVS/./TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n        if platform.system() == \"Darwin\":\n\n            subprocess.call('cd '+tmpdir+' && mkdir MVS && '+homeall+'/Programs/OrtogOnBlender/openMVGMACelcap/openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && '+homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/./DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && '+homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/./ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && '+homeall+'/Programs/OrtogOnBlender/openMVSMACelcap/./TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n        if platform.system() == \"Windows\":\n\n            #subprocess.call('cd '+tmpdir+' && mkdir MVS && C:\\OrtogOnBlender\\openMVGWin\\openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs && C:\\OrtogOnBlender\\openMVSWin\\DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs && C:\\OrtogOnBlender\\openMVSWin\\ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs && C:\\OrtogOnBlender\\openMVSWin\\TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n            #print(\"CONVERTE WINDOWS!!!\")\n            #subprocess.call('cd '+tmpdir+' && mkdir MVS && C:\\OrtogOnBlender\\openMVGWin\\openMVG_main_openMVG2openMVS -i '+tmpdir+'/OpenMVG/reconstruction_sequential/sfm_data.bin -o '+tmpdir+'/MVS/scene.mvs', shell = True)\n\n            tmpdirNovo = str(tmpdir).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n            subprocess.call(\"wsl \\\"mkdir\\\" \"+tmpdirNovo+\"\\\"/MVS\\\"\", shell=True)\n\n            os.chdir(tmpdir) # Se não trocar o diretóri ele gera os distrts e demais dentro do dir do Blender e dá erro!\n\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/OpenMVGLinux/openMVG/./openMVG_main_openMVG2openMVS\\\" -i \\\"\"+tmpdirNovo+\"/OpenMVG/reconstruction_sequential/sfm_data.bin\\\" -o \\\"\"+tmpdirNovo+\"/MVS/scene.mvs\\\"\", shell=True)\n\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/OpenMVGLinux/openMVS/./DensifyPointCloud\\\" --estimate-normals \\\"1\\\" \\\"\"+tmpdirNovo+\"/MVS/scene.mvs\\\"\", shell=True)\n\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/OpenMVGLinux/openMVS/./ReconstructMesh\\\" -d  \\\"\"+dFactor+\"\\\" --smooth \"+smoothFactor+\" \"+tmpdirNovo+\"/MVS/scene_dense.mvs\", shell=True)\n\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/OpenMVGLinux/openMVS/./TextureMesh\\\" --export-type \\\"obj\\\"  \\\"\"+tmpdirNovo+\"/MVS/scene_dense_mesh.mvs\\\"\" , shell=True)\n\n            #print(\"MVS WINDOWS!!!\")\n            #print(\"DENSIFY\")\n            #subprocess.call('C:\\OrtogOnBlender\\openMVSWin\\DensifyPointCloud --estimate-normals 1 '+tmpdir+'/MVS/scene.mvs', shell=True)\n            #print(\"RECONMESH\")\n            #subprocess.call('C:\\OrtogOnBlender\\openMVSWin\\ReconstructMesh -d '+dFactor+' --smooth '+smoothFactor+' '+tmpdir+'/MVS/scene_dense.mvs', shell=True)\n            #print(\"TEXTURING\")\n            #subprocess.call('C:\\OrtogOnBlender\\openMVSWin\\TextureMesh --export-type obj '+tmpdir+'/MVS/scene_dense_mesh.mvs', shell=True)\n\n\n#            subprocess.call(\"wsl \\\"cd \"+tmpdirNovo+\" && mkdir MVS && /mnt/c/OrtogOnBlender/OpenMVGLinux/openMVG/./openMVG_main_openMVG2openMVS -i \"+tmpdirNovo+\"/OpenMVG/reconstruction_sequential/sfm_data.bin -o \"+tmpdirNovo+\"/MVS/scene.mvs && /mnt/c/OrtogOnBlender/OpenMVGLinux/openMVS/./DensifyPointCloud --estimate-normals 1 \"+tmpdirNovo+\"/MVS/scene.mvs && /mnt/c/OrtogOnBlender/OpenMVGLinux/openMVS/./ReconstructMesh -d  \"+dFactor+\" --smooth \"+smoothFactor+\" \"+tmpdirNovo+\"/MVS/scene_dense.mvs && /mnt/c/OrtogOnBlender/OpenMVGLinux/openMVS/./TextureMesh --export-type obj  \"+tmpdirNovo+\"/MVS/scene_dense_mesh.mvs\\\"\" , shell=True)\n\n#        else:\n#            subprocess.call(OpenMVSPath ,  shell=True)\n            #subprocess.call([ 'meshlabserver', '-i', tmpdir+'scene_dense_mesh_texture.ply', '-o', tmpdir+'scene_dense_mesh_texture.obj', '-om', 'vn', 'wt' ])\n\n\n\n        bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n\n        scene_dense_mesh_texture = bpy.data.objects['scene_dense_mesh_texture']\n\n        bpy.ops.object.select_all(action='DESELECT')\n        bpy.context.view_layer.objects.active = scene_dense_mesh_texture\n        bpy.data.objects['scene_dense_mesh_texture'].select_set(True)\n\n\n        bpy.context.object.data.use_auto_smooth = False\n#        bpy.context.object.active_material.specular_hardness = 60\n#        bpy.context.object.active_material.diffuse_intensity = 0.6\n#        bpy.context.object.active_material.specular_intensity = 0.3\n        bpy.context.object.active_material.specular_color = (0.233015, 0.233015, 0.233015)\n            #    bpy.ops.object.modifier_add(type='SMOOTH')\n            #    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n            #    bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n            #    bpy.ops.object.convert(target='MESH')\n            #    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Smooth\")\n\n        bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')\n        #bpy.ops.view3d.view_all(center=False)\n\n        # Centraliza zoom\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                for region in area.regions:\n                    if region.type == 'WINDOW':\n                        override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}\n                        bpy.ops.view3d.view_all(override)\n\n\n        bpy.ops.file.pack_all()\n\n        bpy.ops.object.modifier_add(type='SMOOTH')\n        bpy.context.object.modifiers[\"Smooth\"].factor = 2\n        bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n        bpy.context.object.modifiers[\"Smooth\"].show_viewport = False\n\n                #bpy.ops.object.convert(target='MESH')\n\n                # MultRes\n        bpy.ops.object.modifier_add(type='MULTIRES')\n        bpy.context.object.modifiers[\"Multires\"].show_viewport = False\n        bpy.ops.object.multires_subdivide(modifier=\"Multires\")\n\n        context = bpy.context\n        obj = context.active_object\n\n        heightTex = bpy.data.textures.new('Texture name', type='IMAGE')\n       # heightTex.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n        heightTex.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n        dispMod = obj.modifiers.new(\"Displace\", type='DISPLACE')\n        dispMod.texture = heightTex\n        bpy.context.object.modifiers[\"Displace\"].texture_coords = 'UV'\n        bpy.context.object.modifiers[\"Displace\"].strength = 3.2\n        bpy.context.object.modifiers[\"Displace\"].mid_level = 0.5\n        bpy.context.object.modifiers[\"Displace\"].show_viewport = False\n\n                #Comprime modificadores\n        bpy.context.object.modifiers[\"Smooth\"].show_expanded = False\n        bpy.context.object.modifiers[\"Multires\"].show_expanded = False\n        bpy.context.object.modifiers[\"Displace\"].show_expanded = False\n\n        bpy.ops.object.shade_smooth()\n\n        bpy.context.space_data.shading.type = 'SOLID'\n        bpy.context.space_data.shading.color_type = 'TEXTURE'\n\n\n\nclass GeraModeloFoto(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelo_foto_win\"\n    bl_label = \"Gera Modelos Foto Win\"\n\n    def execute(self, context):\n        GeraModeloFotoDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModeloFoto)\n"
  },
  {
    "path": "FotogrametriaSMVS.py",
    "content": "import bpy\nimport subprocess\nimport platform\nfrom os.path import expanduser\nimport shutil\nimport tempfile\nimport bmesh\nfrom os import listdir\nfrom os.path import isfile, join\n\nfrom .FerrImgTomo import *\nfrom .FotogrametriaOpenMVG import *\n\n# ERROS\n\ndef ERROruntimeFotosDef(self, context):\n    self.layout.label(\"Doesn't have photo path!\")\n\ndef ERROTermFoto():\n     CRED = '\\033[91m'\n     CEND = '\\033[0m'\n     print(CRED + \"Doesn't have photo path!\" + CEND)\n\ndef GeraModeloFotoSMVSDef(self, context):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n    tmpOBJface = tmpdir+'/scene/scene_dense_mesh_texture2.obj'\n#    subprocess.call(['rm /tmp/DIRETORIO_FOTOS.txt'],  shell=True)\n\n    homeall = expanduser(\"~\")\n\n    ConverteHEICtoJPG()\n\n    # Inicia os trabalhos\n\n    if scn.my_tool.path_photo == \"\":\n        ERROTermFoto()\n        bpy.context.window_manager.popup_menu(ERROruntimeFotosDef, title=\"Attention!\", icon='INFO')\n\n    else:\n        if platform.system() == \"Linux\":\n\n            with open(\"/etc/issue\") as f:\n             Versao = str(f.read().lower().split()[1])\n\n            if Versao == \"18.04\":\n\n                SMVSPath = homeall+\"/Programs/OrtogOnBlender/SMVS/\"\n                subprocess.call(['rm', '-rf', tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./makescene', '-i', scn.my_tool.path_photo, tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./sfmrecon', tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./smvsrecon', '-s2', tmpdir+'/scene'])\n                subprocess.call(['meshlabserver', '-i', tmpdir+'/scene/smvs-B2.ply', '-o', tmpdir+'/scene/meshlab.ply', '-s', SMVSPath+'SMVSmeshlab.mlx', '-om'])\n                subprocess.call([SMVSPath+'./texrecon', '--data_term=area', '--skip_global_seam_leveling', '--outlier_removal=gauss_damping', tmpdir+'/scene::undistorted', tmpdir+'/scene/meshlab.ply', tmpdir+'/scene/scene_dense_mesh_texture2'])\n                bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n                scene_dense_mesh_texture2 = bpy.data.objects['scene_dense_mesh_texture2']\n                bpy.ops.object.select_all(action='DESELECT')\n                bpy.context.view_layer.objects.active = scene_dense_mesh_texture2\n                bpy.data.objects['scene_dense_mesh_texture2'].select_set(True)\n                bpy.ops.view3d.view_all(center=False)\n                bpy.ops.file.pack_all()\n\n\n            if Versao == \"20.04.1\" or Versao == \"20.04\":\n\n                SMVSPath = homeall+\"/Programs/OrtogOnBlender/SMVS/\"\n                subprocess.call(['rm', '-rf', tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./makescene', '-i', scn.my_tool.path_photo, tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./sfmrecon', tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./smvsrecon', '-s2', tmpdir+'/scene'])\n                subprocess.call([SMVSPath+'./fssrecon', tmpdir+'/scene/smvs-B2.ply', tmpdir+'/scene/smvs-surface.ply'])\n                subprocess.call([SMVSPath+'./meshclean', '-p10', tmpdir+'/scene/smvs-surface.ply', tmpdir+'/scene/smvs-surface-clean.ply'])\n                subprocess.call([SMVSPath+'./texrecon', '--data_term=area', '--skip_global_seam_leveling', '--outlier_removal=gauss_damping', tmpdir+'/scene::undistorted', tmpdir+'/scene/smvs-surface-clean.ply', tmpdir+'/scene/scene_dense_mesh_texture2'])\n                bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n                scene_dense_mesh_texture2 = bpy.data.objects['scene_dense_mesh_texture2']\n                bpy.ops.object.select_all(action='DESELECT')\n                bpy.context.view_layer.objects.active = scene_dense_mesh_texture2\n                bpy.data.objects['scene_dense_mesh_texture2'].select_set(True)\n                bpy.ops.view3d.view_all(center=False)\n                bpy.ops.file.pack_all()\n\n\n        if platform.system() == \"Windows\":\n            SMVSPath = 'C:/OrtogOnBlender/SMVS/'\n#            shutil.rmtree(tmpdir+'/scene')\n\n            SMVSPathLinux = 'C:/OrtogOnBlender/SMVSlinux/'\n\n            Fotos = str(scn.my_tool.path_photo).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n            print(\"FOTOS: \", Fotos)\n\n            Saida = str(tmpdir).replace(\"\\\\\", \"/\").replace('\\\\', \"/\").replace(\"C:\", \"/mnt/c\")\n\n            # subprocess.call([SMVSPath+'./makescene', '-i', scn.my_tool.path_photo, tmpdir+'/scene'])\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/SMVSlinux/makescene\\\" -i \\\"\"+Fotos+\"\\\" \\\"\"+Saida+\"/scene\\\"\", shell=True)\n\n            #subprocess.call([SMVSPath+'./sfmrecon', tmpdir+'/scene'])\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/SMVSlinux/sfmrecon\\\" \\\"\"+Saida+\"/scene\\\"\", shell=True)\n\n            #subprocess.call([SMVSPath+'./smvsrecon', '-s2', tmpdir+'/scene'])\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/SMVSlinux/smvsrecon\\\" -s2 \\\"\"+Saida+\"/scene\\\"\", shell=True)\n\n            subprocess.call([SMVSPath+'./fssrecon', tmpdir+'/scene/smvs-B2.ply', tmpdir+'/scene/smvs-surface.ply'])\n            subprocess.call([SMVSPath+'./meshclean', '-p10', tmpdir+'/scene/smvs-surface.ply', tmpdir+'/scene/smvs-surface-clean.ply'])\n\n            #subprocess.call('C:\\OrtogOnBlender\\MeshLab\\meshlabserver -i '+tmpdir+'/scene/smvs-B2.ply -o '+tmpdir+'/scene/meshlab.ply -s '+SMVSPathLinux+'SMVSmeshlab.mlx', shell=True)\n\n\n            subprocess.call(\"wsl \\\"/mnt/c/OrtogOnBlender/SMVSlinux/texrecon\\\" \\\"--data_term=area\\\" \\\"--skip_global_seam_leveling\\\" \\\"--outlier_removal=gauss_damping\\\" \\\"\"+Saida+\"/scene::undistorted\\\" \\\"\"+Saida+\"/scene/smvs-surface-clean.ply\\\" \\\"\"+Saida+\"/scene/scene_dense_mesh_texture2\\\"\", shell=True)\n\n            bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n            scene_dense_mesh_texture2 = bpy.data.objects['scene_dense_mesh_texture2']\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.context.view_layer.objects.active = scene_dense_mesh_texture2\n            bpy.data.objects['scene_dense_mesh_texture2'].select_set(True)\n            bpy.ops.view3d.view_all(center=False)\n            bpy.ops.file.pack_all()\n\n            '''\n            tmpPLYface = tmpdir+'/scene/smvs-surface-clean.ply'\n            bpy.ops.import_mesh.ply(filepath=tmpPLYface, filter_glob=\"*.ply\")\n            smvs_surface_clean = bpy.data.objects['smvs-surface-clean']\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.context.view_layer.objects.active = smvs_surface_clean\n            bpy.data.objects['smvs-surface-clean'].select_set(True)\n            bpy.ops.view3d.view_all(center=False)\n            bpy.ops.file.pack_all()\n            '''\n\n        if platform.system() == \"Darwin\":\n            homemac = expanduser(\"~\")\n            SMVSPath = homemac+'/Programs/OrtogOnBlender/SMVSMAC/'\n\n            subprocess.call(['rm', '-Rf', tmpdir+'/scene'])\n            subprocess.call([SMVSPath+'./makescene', '-i', scn.my_tool.path_photo, tmpdir+'/scene'])\n            subprocess.call([SMVSPath+'./sfmrecon', tmpdir+'/scene'])\n            subprocess.call([SMVSPath+'./smvsrecon', '-s2', tmpdir+'/scene'])\n            subprocess.call([SMVSPath+'./fssrecon', '-s4', tmpdir+'/scene/smvs-B2.ply', tmpdir+'/scene/smvs-surface.ply'])\n            subprocess.call([SMVSPath+'./meshclean', '-p10', tmpdir+'/scene/smvs-surface.ply', tmpdir+'/scene/smvs-clean.ply'])\n            subprocess.call(['rm', '-Rf', tmpdir+'/scene/tmp'])\n            subprocess.call([SMVSPath+'./texrecon', '--data_term=area', '--skip_global_seam_leveling', '--outlier_removal=gauss_damping', tmpdir+'/scene::undistorted', tmpdir+'/scene/smvs-clean.ply', tmpdir+'/scene/scene_dense_mesh_texture2'])\n\n            bpy.ops.import_scene.obj(filepath=tmpOBJface, filter_glob=\"*.obj;*.mtl\")\n            scene_dense_mesh_texture2 = bpy.data.objects['scene_dense_mesh_texture2']\n            bpy.ops.object.select_all(action='DESELECT')\n            bpy.context.view_layer.objects.active = scene_dense_mesh_texture2\n            bpy.data.objects['scene_dense_mesh_texture2'].select_set(True)\n            bpy.ops.view3d.view_all(center=False)\n            bpy.ops.file.pack_all()\n\n    bpy.ops.object.modifier_add(type='DECIMATE')\n    #bpy.context.object.modifiers[\"Decimate\"].ratio = 0.25\n    bpy.context.object.modifiers[\"Decimate\"].ratio = 0.35\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Decimate\")\n\n\n    print(\"FIX SMVS SURFACE AND MAP\")\n\n    photogrammetry_original = bpy.context.active_object\n\n    #bpy.ops.object.duplicate()\n\n    bpy.ops.object.duplicate_move()\n\n    photogrammetry_original.select_set(False)\n    photogrammetry_copy = bpy.context.active_object\n\n    print(photogrammetry_original)\n    print(photogrammetry_copy)\n\n\n    # Entra em modo de edição e seleciona todos os vértices\n    ob   = bpy.context.active_object\n\n    #Apaga todos os materiais\n    for i in range(len(ob.material_slots)):\n        bpy.ops.object.material_slot_remove({'object': ob})\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    mesh = bmesh.from_edit_mesh(ob.data)\n    for v in mesh.verts:\n        v.select = True\n\n    # Cria UV map com espaço entre os grupos\n    bpy.ops.uv.smart_project(island_margin=0.03)\n#    bpy.ops.uv.smart_project(island_margin=0.3)\n\n    bpy.ops.object.mode_set(mode='OBJECT')\n\n\n    #Cria imagem\n    bpy.ops.image.new(name='UV_FACE', width=2048, height=2048, color=(0.5, 0.5, 0.5, 1), alpha=True, generated_type='BLANK', float=False, use_stereo_3d=False)\n\n    #Cria material\n\n\n    m = Material()\n    m.set_cycles()\n    # from chapter 1 of [DRM protected book, could not copy author/title]\n    m.make_material(\"FaceUVunic\")\n\n    ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n    ImageTexture.image = bpy.data.images['UV_FACE']\n\n    diffuseBSDF = m.nodes['Principled BSDF']\n    diffuseBSDF.inputs[5].default_value = 0\n\n    m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n\n    bpy.ops.object.material_slot_remove()\n    bpy.ops.object.material_slot_add()\n\n    bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"FaceUVunic\"]\n\n\n    # BAKE\n\n    ob.data.uv_layers['UVMap'].active = True\n\n\n#    bpy.data.scenes[\"Scene\"].cycles.bake_type = 'UV'\n    bpy.context.scene.cycles.bake_type = 'DIFFUSE'\n    bpy.context.scene.render.bake.use_pass_direct = False\n    bpy.context.scene.render.bake.use_pass_indirect = False\n\n    bpy.context.scene.render.bake.use_selected_to_active = True\n    bpy.context.scene.render.bake.margin = 2\n    bpy.context.scene.render.bake.cage_extrusion = 0.32\n\n    photogrammetry_original.select_set(True)\n\n    bpy.ops.object.bake(type='DIFFUSE')\n\n    # Oculta original\n    photogrammetry_original.hide_viewport=True\n\n\n\n    # MODIFICADORES\n\n    # Smooth\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 3\n    bpy.context.object.modifiers[\"Smooth\"].show_viewport = False\n\n    # MultRes\n    bpy.ops.object.modifier_add(type='MULTIRES')\n    bpy.context.object.modifiers[\"Multires\"].show_viewport = False\n    bpy.ops.object.multires_subdivide(modifier=\"Multires\")\n\n    context = bpy.context\n    obj = context.active_object\n\n    heightTex = bpy.data.textures.new('Texture name', type='IMAGE')\n    heightTex.image = bpy.data.images['UV_FACE']\n#    heightTex.image = bpy.data.images['scene_dense_mesh_texture2_material0000_map_Kd.png']\n    dispMod = obj.modifiers.new(\"Displace\", type='DISPLACE')\n    dispMod.texture = heightTex\n    bpy.context.object.modifiers[\"Displace\"].texture_coords = 'UV'\n    bpy.context.object.modifiers[\"Displace\"].strength = 2.2\n    bpy.context.object.modifiers[\"Displace\"].mid_level = 0.5\n    bpy.context.object.modifiers[\"Displace\"].show_viewport = False\n\n    #Comprime modificadores\n    bpy.context.object.modifiers[\"Smooth\"].show_expanded = False\n    bpy.context.object.modifiers[\"Multires\"].show_expanded = False\n    bpy.context.object.modifiers[\"Displace\"].show_expanded = False\n\n    bpy.ops.object.shade_flat()\n\n    bpy.context.space_data.shading.type = 'MATERIAL'\n\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        bpy.data.images['UV_FACE'].pack()\n        print(\"Empacotou as imagens!\")\n\n    if platform.system() == \"Windows\":\n        bpy.data.images['UV_FACE'].pack(as_png=True)\n        print(\"Empacotou as imagens!\")\n\n\n    bpy.ops.file.pack_all()\n\n\n\nclass GeraModeloFotoSMVS(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelo_foto_smvs\"\n    bl_label = \"Gera Modelos Foto\"\n\n    def execute(self, context):\n        GeraModeloFotoSMVSDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModeloFotoSMVS)\n\nclass DisplaceSMVS(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.displace_smvs\"\n    bl_label = \"Displace SMVS\"\n\n    def execute(self, context):\n        DisplaceSMVSDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(DisplaceSMVS)\n"
  },
  {
    "path": "GeraModelosTomo.py",
    "content": "import bpy\nimport platform\nimport tempfile\nimport subprocess\nimport multiprocessing\nimport os\nimport pydicom\nimport shutil\nimport numpy as np\nfrom os.path import expanduser\nfrom random import randint\n\nfrom .ImportaObjMat import *\nfrom .AjustaTomo import *\nfrom .ConfOsteotomiaAuto import *\n\n# MENSAGENS\n\ndef GeraModeloTomoAutoMoleDef():\n\n    context = bpy.context\n    #obj = context.object\n    scn = context.scene\n\n    # Organiza a tomografia e fornece os dados pelas variáveis globais\n    bpy.ops.object.ajusta_tomo()\n\n    # Puxa as variáveis globais do ajusta_tomo para fornecer o endereço das fatias do mole\n    arquivo = open(scn.my_tool.path+'/AUTOEXPDIR.txt', 'r')\n    endereco = arquivo.readline()\n\n    scn.my_tool.path = endereco\n\n    bpy.ops.object.gera_modelo_tomo_manual()\n\n\nclass GeraModeloTomoAutoMole(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelotomo_auto_mole\"\n    bl_label = \"CT-Scan reconstruction automatic SoftTissue\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        try:\n            GeraModeloTomoAutoMoleDef()\n        except:\n            bpy.ops.object.corrige_dicom()\n            GeraModeloTomoAutoMoleDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModeloTomoAutoMole)\n\n\nclass MessageFaltaDICOM(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_informe_dicom\"\n    bl_label = \"Doesn't have DICOM path!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have DICOM path!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageFaltaDICOM)\n\n\nclass MessageFaltaObjeto(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_falta_objeto\"\n    bl_label = \"Doesn't have one or more objects!\"\n\n    def execute(self, context):\n        message = (\"Doesn't have one or more objects!\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(MessageFaltaObjeto)\n\n\n\n'''\ndef ERROruntimeDICOMDef(self, context):\n    self.UILayout.label(\"Doesn't have DICOM path!\")\n#    self.layout.label(\"Doesn't have DICOM path!\")\n\ndef ERROTermDICOM():\n     CRED = '\\033[91m'\n     CEND = '\\033[0m'\n     print(CRED + \"Doesn't have DICOM path!\" + CEND)\n'''\n\n# GERA MODELOS TOMO\n\ndef GeraModelosTomoDef(self, context):\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n    if scn.my_tool.path == \"\":\n            bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n            return {'FINISHED'}\n\n#    scene = context.scene\n#    rd = scene.render\n\n    else:\n        interesseOssos = bpy.context.scene.interesse_ossos\n        interesseMole = bpy.context.scene.interesse_mole\n        interesseDentes = bpy.context.scene.interesse_dentes\n\n        # Calcula número de CPUs\n\n        CpuNum = multiprocessing.cpu_count()\n\n        if CpuNum >= 8:\n            DecimFactor = '0.90'\n\n        if CpuNum == 6:\n            DecimFactor = '0.90'\n\n        if CpuNum == 4:\n            DecimFactor = '0.95'\n\n        if CpuNum == 2:\n            DecimFactor = '0.98'\n\n        if CpuNum == 1:\n            DecimFactor = '0.99'\n\n        try:\n            print(\"Processadores\", CpuNum)\n        except:\n            print(\"Erro na contagem de processadores!\")\n            DecimFactor = '0.95'\n\n        ReconTomo(scn.my_tool.path, interesseOssos, 'Bones', DecimFactor)\n        ReconTomo(scn.my_tool.path, interesseMole, 'SoftTissue', DecimFactor)\n        ReconTomo(scn.my_tool.path, interesseDentes, 'Teeth', DecimFactor)\n\n\n        a = bpy.data.objects['Bones']\n        b = bpy.data.objects['SoftTissue']\n        c = bpy.data.objects['Teeth']\n\n\n        bpy.ops.object.select_all(action='DESELECT')\n        a.select_set(True)\n        context.view_layer.objects.active = a\n        #bpy.context.scene.objects.active = a\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n    #    bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')\n    #    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n\n\n        bpy.ops.object.select_all(action='DESELECT')\n        b.select_set(True)\n    #    bpy.context.scene.objects.active = b\n        context.view_layer.objects.active = b\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n\n        bpy.ops.object.select_all(action='DESELECT')\n        c.select_set(True)\n    #    bpy.context.scene.objects.active = c\n        context.view_layer.objects.active = c\n        bpy.ops.object.shade_smooth()\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')\n\n        bpy.ops.object.select_all(action='DESELECT')\n        a.select_set(True)\n        b.select_set(True)\n        c.select_set(True)\n    #    bpy.context.scene.objects.active = a\n        context.view_layer.objects.active = a\n        bpy.ops.object.parent_set()\n\n        #bpy.ops.transform.rotate(value=3.14159)\n\n        bpy.ops.transform.rotate(value=3.14159, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\n\n        a.location[0] = 0\n        a.location[1] = 0\n        a.location[2] = 0\n\n        bpy.ops.view3d.view_all(center=False)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        reconst = bpy.data.objects['Bones']\n        reconst.select_set(True)\n        context.view_layer.objects.active = reconst\n        CriaMaterialOsteotomia(\"SCATTER_bone\", 0.8, 0.7, 0.5)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        reconst = bpy.data.objects['SoftTissue']\n        reconst.select_set(True)\n        context.view_layer.objects.active = reconst\n        CriaMaterialOsteotomia(\"SCATTER_skin\", 0.8, 0.3, 0.15)\n\n        bpy.ops.object.select_all(action='DESELECT')\n        reconst = bpy.data.objects['Teeth']\n        reconst.select_set(True)\n        context.view_layer.objects.active = reconst\n        CriaMaterialOsteotomia(\"SCATTER_teeth\", 0.5, 0.6, 1)\n\n        '''\n        impMaterial = 'SCATTER_bone'\n        SelObj = 'Bones'\n        ImportaMaterial(impMaterial, SelObj)\n\n        impMaterial = 'SCATTER_skin'\n        SelObj = 'SoftTissue'\n        ImportaMaterial(impMaterial, SelObj)\n\n        impMaterial = 'SCATTER_teeth'\n        SelObj = 'Teeth'\n        ImportaMaterial(impMaterial, SelObj)\n        '''\n\n        bpy.ops.object.select_all(action='DESELECT')\n        a.select_set(True)\n     #   bpy.context.scene.objects.active = a\n        context.view_layer.objects.active = a\n\n\n\nclass GeraModelosTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelos_tomo\"\n    bl_label = \"Prepara Impressao\"\n\n    def execute(self, context):\n        GeraModelosTomoDef(self, context)\n        return {'FINISHED'}\n\n# GERA MODELO ARCADA\n\ndef GeraModelosTomoArcDef(self, context):\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    if scn.my_tool.path == \"\":\n            bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n            return {'FINISHED'}\n\n    else:\n    #    scene = context.scene\n    #    rd = scene.render\n\n        interesseArco = bpy.context.scene.interesse_arco\n\n        ReconTomo(scn.my_tool.path, interesseArco, 'Arch','0.70')\n\n        obj = context.object\n\n        bpy.ops.object.select_all(action='DESELECT')\n        obj.select_set(True)\n        context.view_layer.objects.active = obj\n        bpy.ops.object.shade_smooth()\n        bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')\n\n\ndef ReconTomo(pathdir, interes, saida, simplif):\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n#    scene = context.scene\n#    rd = scene.render\n\n    tmpdir = tempfile.mkdtemp()\n    tmpSTL = tmpdir+'/'+saida+'.stl'\n\n    homeall = expanduser(\"~\")\n\n#    capturaEndereco = bpy.data.scenes['Scene'].my_tool['path']\n#    dirAtual = os.getcwd()\n#    print(\"DIRETÓRIO ATUAL:\", dirAtual)\n#    os.chdir(dirAtual)\n\n\n    if scn.my_tool.path == \"\":\n            bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n            return {'FINISHED'}\n\n    else:\n\n\n        if platform.system() == \"Linux\":\n\n\n            dicom2DtlPath = homeall+'/Programs/OrtogOnBlender/Dicom2Mesh/dicom2mesh'\n\n\n\n        if platform.system() == \"Windows\":\n\n            dicom2DtlPath = 'C:/OrtogOnBlender/DicomToMeshWin/dicom2mesh.exe'\n\n\n\n        if platform.system() == \"Darwin\":\n\n            dicom2DtlPath = homeall+'/Programs/OrtogOnBlender/DicomToMeshMAC/dicom2mesh'\n\n\n        subprocess.call([dicom2DtlPath, '-i',  pathdir, '-r', simplif, '-s', '-t', interes, '-o', tmpSTL])\n        bpy.ops.import_mesh.stl(filepath=tmpSTL, filter_glob=\"*.stl\",  files=[{\"name\":saida+\".stl\", \"name\":saida+\".stl\"}], directory=tmpdir)\n\n\n#        bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')\n#        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n#        bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN', center='MEDIAN')\n        bpy.ops.view3d.view_all(center=False)\n\n\ndef CopiaTomoDir(Origem):\n\n    context = bpy.context\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    NomePacienteDir = homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente\n\n#        if found == False:\n    if not os.path.exists(NomePacienteDir):\n        print(\"Patience Dir does not exist!\")\n    else:\n        if os.path.exists(NomePacienteDir):\n            shutil.copytree(Origem, NomePacienteDir+\"/CT-Scan\")\n\n\ndef ReduzDimDICOMDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    print(\"FATIAAAAAAAAA222\")\n\n    ListaArquivos = sorted(os.listdir(scn.my_tool.path))\n\n    os.chdir(scn.my_tool.path)\n\n    for fatia in range(len(ListaArquivos)):\n        ds = pydicom.dcmread(str(ListaArquivos[fatia]), force=True)\n        ArquivoAtual = str(ListaArquivos[fatia])\n        DimPixelsX = ds.Rows\n        DimPixelsY = ds.Columns\n\n        print(\"FATIAAAAAAAAA222\")\n        print(\"DimPixelsX\", DimPixelsX)\n        print(\"DimPixelsY\", DimPixelsY)\n\n        if DimPixelsX > 512 or DimPixelsY > 512:\n\n            ListaDim = [ DimPixelsX, DimPixelsY ]\n            ElementoFator = float(max(ListaDim))\n\n            Fator = str( 512 / ElementoFator )\n\n#            DimPixelsXFinal = str(int(DimPixelsX * Fator))\n#            DimPixelsYFinal = str(int(DimPixelsY * Fator))\n\n#            print(\"DimPixelsX\", DimPixelsX)\n#            print(\"DimPixelsY\", DimPixelsY)\n#            print(\"Fator:\", Fator)\n#            print(\"DimPixelsXFinal\", DimPixelsXFinal)\n#            print(\"DimPixelsYFinal\", DimPixelsYFinal)\n\n\n            if not os.path.exists(\"REDUC\"):\n                os.mkdir(\"REDUC\")\n                print(\"Diretorio REDUC criado\")\n\n            if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n                    subprocess.call('dcmscale -v +Sxf '+Fator+' +Syf '+Fator+' '+ArquivoAtual+' REDUC/'+ArquivoAtual, shell=True)\n\n            if platform.system() == \"Windows\":\n                    subprocess.call('C:/OrtogOnBlender/dcmtk/dcmscale.exe -v +Sxf '+Fator+' +Syf '+Fator+' '+ArquivoAtual+' REDUC/'+ArquivoAtual, shell=True)\n\n    scn.my_tool.path = os.getcwd()+\"/REDUC/\"\n\nclass ReduzDimDICOM(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.reduz_dimensao_dicom\"\n    bl_label = \"Reduz Dimensao DICOM\"\n\n    def execute(self, context):\n        ReduzDimDICOMDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ReduzDimDICOM)\n\n\ndef IdentificaTomografo(Arquivo):\n\n    context = bpy.context\n    scn = context.scene\n\n    # Lê arquivo DICOM\n    ds = pydicom.dcmread(Arquivo)\n\n    # Separa Manufacturer\n    ManufacturerComplete = ds.data_element(\"Manufacturer\")\n    ManufacturerLimpa1 = str(ManufacturerComplete).split('LO: ')\n    ManufacturerLimpo = str(ManufacturerLimpa1[1]).strip('\"')\n\n    print(\"ManufacturerComplete:\", ManufacturerComplete)\n    print(\"ManufacturerLimpa1:\", ManufacturerLimpa1)\n    print(\"ManufacturerLimpo:\", ManufacturerLimpo)\n\n\n    try:\n        # Separa StationName\n        StationNameComplete = ds.data_element(\"StationName\")\n        StationNameLimpa1 = str(StationNameComplete).split('SH: ')\n        StationNameLimpo = str(StationNameLimpa1[1]).strip('\"')\n\n        print(\"StationNameComplete:\", StationNameComplete)\n        print(\"StationNameLimpa1:\", StationNameLimpa1)\n        print(\"StationNameLimpo:\", StationNameLimpo)\n    except:\n        print(\"Sem StationNam\")\n\n\n\n    try:\n        # Separa ManufacturerModelName\n        ManufacturerModelNameComplete = ds.data_element(\"ManufacturerModelName\")\n        ManufacturerModelNameLimpa1 = str(ManufacturerModelNameComplete).split('LO: ')\n        ManufacturerModelNameLimpo = str(ManufacturerModelNameLimpa1[1]).strip('\"')\n\n        print(\"ManufacturerModelName:\", ManufacturerModelNameComplete)\n        print(\"ManufacturerModelNameLimpa1:\", ManufacturerModelNameLimpa1)\n        print(\"ManufacturerModelNameLimpo:\", ManufacturerModelNameLimpo)\n        return ManufacturerModelName\n    except:\n        print(\"Sem ManufacturerModelName\")\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and StationNameLimpo == \"'ACTIVION_16'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        try:\n        # Seleciona diretório e corrige biblio\n            os.chdir(scn.my_tool.path+\"/3\")\n        except:\n            os.chdir(scn.my_tool.path+\"/1005\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        #bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    # TOMO FAKE\n\n    if ManufacturerLimpo == \"'Unknown manufacturer'\" and ManufacturerModelNameLimpo == \"'Unknown model'\":\n        print(\"FAKE CT-SCAN\")\n\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"100\"\n        bpy.context.scene.interesse_mole = \"65\"\n        bpy.context.scene.interesse_dentes = \"200\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n        # ROTACIONA\n\n        bpy.ops.transform.rotate(value=3.14159, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'TC01'\" and ManufacturerModelNameLimpo == \"'BrightSpeed'\":\n\n        os.chdir(scn.my_tool.path+\"/3\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and StationNameLimpo == \"'ID_STATION'\" and ManufacturerModelNameLimpo == \"'Aquilion Lightning'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 250\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # Seleciona diretório e corrige biblio\n        os.chdir(scn.my_tool.path+\"/3\")\n\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        #bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"250\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'J.Morita.Mfg.Corp.'\":\n\n        os.chdir(scn.my_tool.path+\"/1007002\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"245\"\n        bpy.context.scene.interesse_mole = \"-315\"\n        bpy.context.scene.interesse_dentes = \"585\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and StationNameLimpo == \"'ID_STATION'\" and ManufacturerModelNameLimpo == \"'Activion16'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 5\") # ou 6\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # Seleciona diretório e corrige biblio\n        #os.chdir(scn.my_tool.path+\"/6\") # outra configuração\n        os.chdir(scn.my_tool.path+\"/5\")\n\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        #bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'MyRay'\" and StationNameLimpo == \"'NT'\":\n\n        if ManufacturerModelNameLimpo == \"'HYB'\":\n\n            print(\"SÉRIE 1\")\n            print(\"Bone: 850\")\n            print(\"SoftTissue: -360\")\n            print(\"Teeth: 1735\")\n\n            os.chdir(scn.my_tool.path+\"/1\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"850\"\n            bpy.context.scene.interesse_mole = \"-360\"\n            bpy.context.scene.interesse_dentes = \"1735\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'IMAGING-F708FEC'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n\n        os.chdir(scn.my_tool.path+\"/0\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-565\"\n        bpy.context.scene.interesse_dentes = \"530\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICATSERVER'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 400\")\n        print(\"SoftTissue: -700\")\n        print(\"Teeth: 820\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"400\"\n        bpy.context.scene.interesse_mole = \"-700\"\n        bpy.context.scene.interesse_dentes = \"820\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'TOMO'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n\n        os.chdir(scn.my_tool.path+\"/0\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        bpy.context.scene.interesse_ossos = \"320\"\n        bpy.context.scene.interesse_mole = \"-545\"\n        bpy.context.scene.interesse_dentes = \"890\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'IMAGINGS-915FE2'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 205\")\n        print(\"SoftTissue: -770\")\n        print(\"Teeth: 1295\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"205\"\n        bpy.context.scene.interesse_mole = \"-770\"\n        bpy.context.scene.interesse_dentes = \"1295\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'IMAGING-53246DF'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 800\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        #bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-600\"\n        bpy.context.scene.interesse_dentes = \"800\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICAT-1A73805376'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 480\")\n        print(\"SoftTissue: -550\")\n        print(\"Teeth: 1060\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"480\"\n        bpy.context.scene.interesse_mole = \"-550\"\n        bpy.context.scene.interesse_dentes = \"1060\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICAT-8D9DCF422B'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 0\")\n        print(\"Bone: 345\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 972\")\n        print(\"Condylus: 655\")\n\n        try:\n            os.chdir(scn.my_tool.path+\"/0\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"345\"\n            bpy.context.scene.interesse_mole = \"-600\"\n            bpy.context.scene.interesse_dentes = \"972\"\n\n            bpy.ops.object.gera_modelos_tomo()\n        except:\n            try:\n                os.chdir(scn.my_tool.path+\"/2000\")\n                scn.my_tool.path = os.getcwd()\n    #            bpy.ops.object.corrige_dicom()\n\n    #            bpy.ops.object.reduz_dimensao_dicom()\n\n                # Copia para o diretório\n                try:\n                    CopiaTomoDir(scn.my_tool.path)\n                except:\n                    print(\"Doesn't have Patient Dir\")\n\n                # Gera o 3D\n                bpy.context.scene.interesse_ossos = \"345\"\n                bpy.context.scene.interesse_mole = \"-600\"\n                bpy.context.scene.interesse_dentes = \"972\"\n\n                bpy.ops.object.gera_modelos_tomo()\n            except:\n                print(\"Sem modelo!\")\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICAT-6BHI1BTQFF'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 0\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 1000\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-600\"\n        bpy.context.scene.interesse_dentes = \"1000\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'CONEPEAM'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 250\")\n        print(\"SoftTissue: -950\")\n        print(\"Teeth: 711\")\n        print(\"Condylus: MODELO LIMITADO\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"250\"\n        bpy.context.scene.interesse_mole = \"-950\"\n        bpy.context.scene.interesse_dentes = \"711\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICAT_TOMO'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 485\")\n        print(\"SoftTissue: -480\")\n        print(\"Teeth: 1030\")\n        print(\"Condylus: MODELO LIMITADO\")\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"485\"\n        bpy.context.scene.interesse_mole = \"-480\"\n        bpy.context.scene.interesse_dentes = \"1030\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'NIM'\" and StationNameLimpo == \"'NT'\":\n        print(\"Modifica o FIXED! Usar o 67821\")\n        print(\"SÉRIE 67821\")\n        print(\"Bone: 1300\")\n        print(\"SoftTissue: -1\")\n        print(\"Teeth: 1260\")\n        print(\"Condylus: 1260\")\n\n        os.chdir(scn.my_tool.path+\"/67821\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"1300\"\n        bpy.context.scene.interesse_mole = \"-1\"\n        bpy.context.scene.interesse_dentes = \"1260\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'PreXion'\" and StationNameLimpo == \"'CT-02'\":\n        print(\"SÉRIE 1000\")\n        print(\"Bone: 287\")\n        print(\"SoftTissue: -724\")\n        print(\"Teeth: 1807\")\n        print(\"Condylus: APENAS DENTES, ÁREA LIMITADA.\")\n\n        os.chdir(scn.my_tool.path+\"/1000\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"287\"\n        bpy.context.scene.interesse_mole = \"-724\"\n        bpy.context.scene.interesse_dentes = \"1807\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'PreXion'\" and StationNameLimpo == \"'CT-01'\" and ManufacturerModelNameLimpo == \"'PreXion3D'\":\n        print(\"SÉRIE 1000\")\n        print(\"Bone: 340\")\n        print(\"SoftTissue: -650\")\n        print(\"Teeth: 1200\")\n        print(\"Condylus: APENAS DENTES, ÁREA LIMITADA.\")\n\n        os.chdir(scn.my_tool.path+\"/1000\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"340\"\n        bpy.context.scene.interesse_mole = \"-650\"\n        bpy.context.scene.interesse_dentes = \"1200\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and StationNameLimpo == \"'Alexion 16'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 593\")\n        print(\"SoftTissue: -562\")\n        print(\"Teeth: 1862\")\n        print(\"Condylus: 655\")\n\n        print(\"----\")\n\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and ManufacturerModelNameLimpo == \"'Aquilion ONE'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 593\")\n        print(\"SoftTissue: -562\")\n        print(\"Teeth: 1862\")\n        print(\"Condylus: 655\")\n\n        print(\"----\")\n\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and ManufacturerModelNameLimpo == \"'Aquilion PRIME'\" and StationNameLimpo == \"'PRIME 160'\":\n\n        '''\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 5\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n        '''\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 6\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/6\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and ManufacturerModelNameLimpo == \"'Aquilion'\" and StationNameLimpo == \"'HCUV_TC_01'\":\n            print(\"SÉRIE 6\")\n            print(\"Bone: 200\")\n            print(\"SoftTissue: -300\")\n            print(\"Teeth: 1430\")\n            print(\"Condylus: 655\")\n\n\n            os.chdir(scn.my_tool.path+\"/6\")\n            scn.my_tool.path = os.getcwd()\n    #        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and ManufacturerModelNameLimpo == \"'Aquilion'\" and StationNameLimpo == \"'ID_STATION'\":\n            print(\"SÉRIE 5\")\n            print(\"Bone: 200\")\n            print(\"SoftTissue: -300\")\n            print(\"Teeth: 1430\")\n            print(\"Condylus: 655\")\n\n\n            os.chdir(scn.my_tool.path+\"/5\")\n            scn.my_tool.path = os.getcwd()\n    #        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'TOSHIBA'\" and ManufacturerModelNameLimpo == \"'Alexion'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 593\")\n        print(\"SoftTissue: -562\")\n        print(\"Teeth: 1862\")\n        print(\"Condylus: 655\")\n\n        print(\"----\")\n\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'inrad_ct3'\" and ManufacturerModelNameLimpo == \"'LightSpeed Ultra'\":\n\n        os.chdir(scn.my_tool.path+\"/3\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'ctbay99'\" and ManufacturerModelNameLimpo == \"'LightSpeed VCT'\":\n\n        os.chdir(scn.my_tool.path+\"/601\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'CTGE'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'CT04'\" and ManufacturerModelNameLimpo == \"'Discovery CT750 HD'\":\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-620\"\n        bpy.context.scene.interesse_dentes = \"550\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'Optima'\" and ManufacturerModelNameLimpo == 'Optima CT660':\n        print(\"SÉRIE 2\")\n        print(\"Bone: 800\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1500\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"800\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1500\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'vct1'\" and ManufacturerModelNameLimpo == \"'LightSpeed VCT'\":\n\n        os.chdir(scn.my_tool.path+\"/303\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    '''\n     if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'Optima'\":\n        print(\"SÉRIE 303\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/303\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n    '''\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'CT99'\" and ManufacturerModelNameLimpo == \"'BrightSpeed'\":\n\n        os.chdir(scn.my_tool.path+\"/900\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"270\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"985\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Hitachi Medical Corporation'\" and StationNameLimpo == \"'HITACHI Scenaria'\": # ManufacturerModelNameLimpo == 'SCENARIA'\n\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        try:\n            os.chdir(scn.my_tool.path+\"/3\")\n            scn.my_tool.path = os.getcwd()\n     #       bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            os.chdir(scn.my_tool.path+\"/5\") # SÓ FUNCIONA NO WINDOWS!!! O CORRIGE DICOM DE LÁ CORRIGE, O DO LINUX NÃO!!!\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"485\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Siemens Healthineers'\" and StationNameLimpo == \"'CT108213'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT80588\" and ManufacturerModelNameLimpo == \"'Emotion 16 (2010)'\":\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"620\"\n        bpy.context.scene.interesse_mole = \"-390\"\n        bpy.context.scene.interesse_dentes = \"980\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'ctawp64127'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition AS+'\":\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT3SQ'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT4SQ'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition Flash'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT80781'\" and ManufacturerModelNameLimpo == \"'Emotion 16 (2010)'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP96599'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition AS+'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 295\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 780\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"295\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"780\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP96809'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition AS+'\":\n\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"450\"\n        bpy.context.scene.interesse_mole = \"-500\"\n        bpy.context.scene.interesse_dentes = \"1600\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT2SQ'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition AS+'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP65987'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition AS'\":\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT80741'\": # ManufacturerModelNameLimpo == 'Emotion 16 (2010)'\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT54551'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE \")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"----\")\n\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT44308'\":\n        print(\"SÉRIE \")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP65910'\":\n        print(\"SÉRIE \")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP96482'\":\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP66507'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'PETCT'\":\n#        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"----\")\n\n#        print(\"USA FIXED!\")\n        print(\"SÉRIE 4\")\n        print(\"Bone: 400\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1665\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        CopiaTomoDir(scn.my_tool.path)\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'ct01'\":\n#        print(\"USA FIXED!\")\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        CopiaTomoDir(scn.my_tool.path)\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP92145'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 710\")\n        print(\"SoftTissue: -460\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"710\"\n        bpy.context.scene.interesse_mole = \"-460\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT70522'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT108213'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP65585'\":\n#        print(\"USA FIXED!\")\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"----\")\n\n#        print(\"USA FIXED!\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 613\")\n        print(\"SoftTissue: -230\")\n        print(\"Teeth: 1320\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        CopiaTomoDir(scn.my_tool.path)\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'FEN-TOMO16'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 180\")\n        print(\"SoftTissue: -545\")\n        print(\"Teeth: 585\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"180\"\n        bpy.context.scene.interesse_mole = \"-545\"\n        bpy.context.scene.interesse_dentes = \"585\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'LAUDO002'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 245\")\n        print(\"SoftTissue: -615\")\n        print(\"Teeth: 580\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"245\"\n        bpy.context.scene.interesse_mole = \"-615\"\n        bpy.context.scene.interesse_dentes = \"580\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'DESKTOP4139'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\":\n\n        os.chdir(scn.my_tool.path+\"/1\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        bpy.context.scene.interesse_ossos = \"420\"\n        bpy.context.scene.interesse_mole = \"-870\"\n        bpy.context.scene.interesse_dentes = \"655\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'EXAME-02'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 250\")\n        print(\"SoftTissue: -965\")\n        print(\"Teeth: 680\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"250\"\n        bpy.context.scene.interesse_mole = \"-965\"\n        bpy.context.scene.interesse_dentes = \"680\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'EXAME-01'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 390\")\n        print(\"SoftTissue: -920\")\n        print(\"Teeth: 703\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"390\"\n        bpy.context.scene.interesse_mole = \"-920\"\n        bpy.context.scene.interesse_dentes = \"703\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'FNL-TOMO08'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -960\")\n        print(\"Teeth: 690\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-960\"\n        bpy.context.scene.interesse_dentes = \"690\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'SUPERVISOR01'\" and ManufacturerModelNameLimpo == \"'17-19'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 350\")\n        print(\"SoftTissue: -705\")\n        print(\"Teeth: 660\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"350\"\n        bpy.context.scene.interesse_mole = \"-705\"\n        bpy.context.scene.interesse_dentes = \"660\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'EVOL01'\" and ManufacturerModelNameLimpo == \"'17-19'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 340\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-600\"\n        bpy.context.scene.interesse_dentes = \"340\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'TOMO-EXAME3'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 230\")\n        print(\"SoftTissue: -965\")\n        print(\"Teeth: 385\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"230\"\n        bpy.context.scene.interesse_mole = \"-965\"\n        bpy.context.scene.interesse_dentes = \"385\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'EXAME-11'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 350\")\n        print(\"SoftTissue: -925\")\n        print(\"Teeth: 710\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"350\"\n        bpy.context.scene.interesse_mole = \"-925\"\n        bpy.context.scene.interesse_dentes = \"710\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'EXAME-10'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 350\")\n        print(\"SoftTissue: -965\")\n        print(\"Teeth: 750\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"350\"\n        bpy.context.scene.interesse_mole = \"-965\"\n        bpy.context.scene.interesse_dentes = \"750\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'TOMO'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 305\")\n        print(\"SoftTissue: -808\")\n        print(\"Teeth: 1085\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"305\"\n        bpy.context.scene.interesse_mole = \"-808\"\n        bpy.context.scene.interesse_dentes = \"1085\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'ICAT-60587E6B77'\" and ManufacturerModelNameLimpo == \"'i-CAT\\\\x99 3D Dental Imaging System'\": # i-CAT\\x99 (Original) --> i-CAT\\\\x99 (Modificado)\n        print(\"SÉRIE 1\")\n        print(\"Bone: 350\")\n        print(\"SoftTissue: -910\")\n        print(\"Teeth: 840\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        #bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"350\"\n        bpy.context.scene.interesse_mole = \"-910\"\n        bpy.context.scene.interesse_dentes = \"840\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'FEN-TOMO08'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 270\")\n        print(\"SoftTissue: -550\")\n        print(\"Teeth: 690\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"270\"\n        bpy.context.scene.interesse_mole = \"-550\"\n        bpy.context.scene.interesse_dentes = \"690\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'ICAT_TOMO2'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 300\")\n        print(\"SoftTissue: -520\")\n        print(\"Teeth: 700\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"300\"\n        bpy.context.scene.interesse_mole = \"-520\"\n        bpy.context.scene.interesse_dentes = \"700\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'FNL-TOMO08'\" and ManufacturerModelNameLimpo == \"'17-19'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 310\")\n        print(\"SoftTissue: -540\")\n        print(\"Teeth: 860\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"310\"\n        bpy.context.scene.interesse_mole = \"-540\"\n        bpy.context.scene.interesse_dentes = \"860\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'IMAGE-1856355FD'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 250\")\n        print(\"SoftTissue: -630\")\n        print(\"Teeth: 977\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"250\"\n        bpy.context.scene.interesse_mole = \"-630\"\n        bpy.context.scene.interesse_dentes = \"977\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'TOMOGRAFIA'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 545\")\n        print(\"SoftTissue: -960\")\n        print(\"Teeth: 1230\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"545\"\n        bpy.context.scene.interesse_mole = \"-960\"\n        bpy.context.scene.interesse_dentes = \"1230\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies'\" and StationNameLimpo == \"'Station'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 438\")\n        print(\"SoftTissue: -975\")\n        print(\"Teeth: 1140\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"438\"\n        bpy.context.scene.interesse_mole = \"-975\"\n        bpy.context.scene.interesse_dentes = \"1140\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'FEN-TOMO07'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 450\")\n        print(\"SoftTissue: -700\")\n        print(\"Teeth: 1440\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"450\"\n        bpy.context.scene.interesse_mole = \"-700\"\n        bpy.context.scene.interesse_dentes = \"1440\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies'\" and StationNameLimpo == \"'WS_ICAT'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 580\")\n        print(\"SoftTissue: -811\")\n        print(\"Teeth: 1235\")\n        print(\"Condylus: 655\")\n\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"580\"\n        bpy.context.scene.interesse_mole = \"-811\"\n        bpy.context.scene.interesse_dentes = \"1235\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'SERVER2'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 320\")\n        print(\"SoftTissue: -680\")\n        print(\"Teeth: 1800\")\n\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"320\"\n        bpy.context.scene.interesse_mole = \"-680\"\n        bpy.context.scene.interesse_dentes = \"1800\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'FEN-TOMO05'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 335\")\n        print(\"SoftTissue: -925\")\n        print(\"Teeth: 1070\")\n        print(\"Condylus: 525\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"335\"\n        bpy.context.scene.interesse_mole = \"-925\"\n        bpy.context.scene.interesse_dentes = \"1070\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Xoran Technologies ®'\" and StationNameLimpo == \"'ISI'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 462\")\n        print(\"SoftTissue: 1688\")\n        print(\"Teeth: 4591\")\n\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"462\"\n        bpy.context.scene.interesse_mole = \"1688\"\n        bpy.context.scene.interesse_dentes = \"4591\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'CT'\" and ManufacturerModelNameLimpo == \"'Access CT'\":\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/35881\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"320\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"860\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'IRIS'\" and ManufacturerModelNameLimpo == \"'Mx8000'\":\n        print(\"SÉRIE 3330\")\n        print(\"Bone: 335\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 750\")\n        print(\"Condylus: 800\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/3330\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"335\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"750\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'HOST-100096'\" and ManufacturerModelNameLimpo == \"'iCT 256'\":\n        print(\"SÉRIE 5\")\n        print(\"Bone: 390\")\n        print(\"SoftTissue: -370\")\n        print(\"Teeth: 510\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/5\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"390\"\n        bpy.context.scene.interesse_mole = \"-370\"\n        bpy.context.scene.interesse_dentes = \"510\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'INGENUITY'\":\n        print(\"SÉRIE 202\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 800\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/202\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'HOST-52084'\" and ManufacturerModelNameLimpo == \"'Ingenuity Core'\":\n        print(\"SÉRIE 201\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 800\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/201\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP71027'\" and ManufacturerModelNameLimpo == \"'Biograph128'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT48679'\" and ManufacturerModelNameLimpo == \"'Biograph 16'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTHSL06'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 250\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"FIX!\")\n\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP75938'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n\n        print(\"SÉRIE 3\")\n        print(\"Bone: 323\")\n        print(\"SoftTissue: -668\")\n        print(\"Teeth: 1850\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'HOST-6163'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n #       bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'SNDS_CT'\":\n        print(\"SÉRIE 4\")\n        print(\"Bone: 260\")\n        print(\"SoftTissue: -400\")\n        print(\"Teeth: 1270\")\n\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 5\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/5\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n    # ATENÇÃO!!!\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'CT01'\" and ManufacturerModelNameLimpo == \"'BrightSpeed'\":\n        print(\"SÉRIE 2\") # 301\n        print(\"Bone: 300\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n\n        os.chdir(scn.my_tool.path+\"/2\") # 301\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"300\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'Ct01'\" and ManufacturerModelNameLimpo == \"'BrightSpeed'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'PT02'\" and ManufacturerModelNameLimpo == \"'Discovery 710'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    \"\"\"\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'ct99'\" and ManufacturerModelNameLimpo == \"'BrightSpeed S'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n    \"\"\"\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'ct99'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"SÉRIE 4\")\n        print(\"Bone: 480\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"SÉRIE 5\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        try:\n            os.chdir(scn.my_tool.path+\"/2\")\n            scn.my_tool.path = os.getcwd()\n    #        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não há o direório 2!\")\n\n        try:\n            os.chdir(scn.my_tool.path+\"/3\")\n            scn.my_tool.path = os.getcwd()\n    #        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não há o direório 3!\")\n\n        #ManufacturerModelNameLimpo == \"'BrightSpeed S'\":\n        try:\n            os.chdir(scn.my_tool.path+\"/4\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não há o direório 4!\")\n\n\n        # ManufacturerModelNameLimpo == 'Optima CT660'\n        try:\n            os.chdir(scn.my_tool.path+\"/5\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não há o direório 5!\")\n\n        try:\n            os.chdir(scn.my_tool.path+\"/700\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não há o direório 700!\")\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT4SQ'\":\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP65950'\" and ManufacturerModelNameLimpo == \"'SOMATOM Definition AS'\":\n        print(\"SÉRIE 3\") # Pode ser o 2\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT29290'\":\n\n\n        if ManufacturerModelNameLimpo == \"'Emotion 6 (2007)'\":\n            print(\"SÉRIE 1\")\n            print(\"Bone: 200\")\n            print(\"SoftTissue: -300\")\n            print(\"Teeth: 1430\")\n            print(\"Condylus: 655\")\n\n            os.chdir(scn.my_tool.path+\"/1\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        else:\n            print(\"SÉRIE 3\")\n            print(\"Bone: 275\")\n            print(\"SoftTissue: -300\")\n            print(\"Teeth: 1430\")\n            print(\"Condylus: 655\")\n            # TAMBÉM FUNCIONA O 201\n            os.chdir(scn.my_tool.path+\"/3\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"275\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'ct32571'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/3\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CTAWP93034'\":\n        print(\"USA FIXED!\")\n        print(\"SÉRIE 6\")\n        print(\"Bone: 370\")\n        print(\"SoftTissue: -360\")\n        print(\"Teeth: 1660\")\n\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/6\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"370\"\n        bpy.context.scene.interesse_mole = \"-360\"\n        bpy.context.scene.interesse_dentes = \"1660\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Sirona'\" and StationNameLimpo == \"'CRISTIANE-PC'\":\n        print(\"SÉRIE 100\")\n        print(\"Bone: 591\")\n        print(\"SoftTissue: -170\")\n        print(\"Teeth: 780\")\n\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/100\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"591\"\n        bpy.context.scene.interesse_mole = \"-170\"\n        bpy.context.scene.interesse_dentes = \"780\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    '''\n    if ManufacturerLimpo == \"'TOSHIBA'\" and StationNameLimpo == \"'ID_STATION'\":\n        print(\"SÉRIE 3\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 976\")\n        print(\"Condylus: 917\")\n\n        print(\"UK\")\n        print(\"SÉRIE 3\")\n        print(\"Bone: 635\")\n        print(\"SoftTissue: -460\")\n        print(\"Teeth: 1865\")\n\n\n        # ManufacturerModelNameLimpo: 'Aquilion ONE'\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"SÉRIE 5\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        print(\"SÉRIE 7\")\n        print(\"Bone: 395\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1140\")\n        print(\"Condylus: 851\")\n\n        # TAMBÉM FUNCIONA O 201\n\n\n        try:\n            os.chdir(scn.my_tool.path+\"/3\")\n            scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n\n        # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n        except:\n\n            try:\n                os.chdir(scn.my_tool.path+\"/4\")\n                scn.my_tool.path = os.getcwd()\n    #        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n\n                try:\n                    CopiaTomoDir(scn.my_tool.path)\n                except:\n                    print(\"Doesn't have Patient Dir\")\n\n                # Gera o 3D\n                bpy.context.scene.interesse_ossos = \"200\"\n                bpy.context.scene.interesse_mole = \"-300\"\n                bpy.context.scene.interesse_dentes = \"1430\"\n\n            except:\n                os.chdir(scn.my_tool.path+\"/7\")\n                scn.my_tool.path = os.getcwd()\n                bpy.ops.object.corrige_dicom()\n\n                try:\n                    CopiaTomoDir(scn.my_tool.path)\n                except:\n                    print(\"Doesn't have Patient Dir\")\n\n                # Gera o 3D\n                bpy.context.scene.interesse_ossos = \"590\"\n                bpy.context.scene.interesse_mole = \"-430\"\n                bpy.context.scene.interesse_dentes = \"1590\"\n\n            bpy.context.scene.interesse_ossos = \"280\"\n            bpy.context.scene.interesse_mole = \"-300\"\n            bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n    '''\n\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'HOST-9121'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 280\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'HOST-10703'\" and ManufacturerModelNameLimpo == \"'Brilliance 64'\":\n\n        os.chdir(scn.my_tool.path+\"/4\")\n\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Philips'\" and StationNameLimpo == \"'HOST-10662'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 280\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'ctbay99'\" and ManufacturerModelNameLimpo == \"'Revolution EVO'\":\n        print(\"SÉRIE 4\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/4\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'TC_100'\" and ManufacturerModelNameLimpo == \"'Revolution EVO'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 275\")\n        print(\"SoftTissue: -815\")\n        print(\"Teeth: 3064\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n    #        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"275\"\n        bpy.context.scene.interesse_mole = \"-815\"\n        bpy.context.scene.interesse_dentes = \"3064\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'GE MEDICAL SYSTEMS'\" and StationNameLimpo == \"'CT'\" and ManufacturerModelNameLimpo == \"'HiSpeed'\":\n        print(\"SÉRIE 5\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/5\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICAT_TOMO2'\" and ManufacturerModelNameLimpo == \"'i-CAT'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 630\")\n        print(\"SoftTissue: -472\")\n        print(\"Teeth: 1040\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"630\"\n        bpy.context.scene.interesse_mole = \"-475\"\n        bpy.context.scene.interesse_dentes = \"1040\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'IMAGE-1856355FD'\" and ManufacturerModelNameLimpo == \"'i-CAT'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 390\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 870\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"390\"\n        bpy.context.scene.interesse_mole = \"-600\"\n        bpy.context.scene.interesse_dentes = \"870\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Imaging Sciences International'\" and StationNameLimpo == \"'ICAT'\":\n        print(\"SÉRIE 0\")\n        print(\"Bone: 360\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 992\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/0\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"360\"\n        bpy.context.scene.interesse_mole = \"-600\"\n        bpy.context.scene.interesse_dentes = \"992\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT79409'\":\n        print(\"SÉRIE 607\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1430\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/607\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1430\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'SIEMENS'\" and StationNameLimpo == \"'CT54945'\":\n        print(\"SÉRIE 2\")\n        print(\"Bone: 400\")\n        print(\"SoftTissue: -300\")\n        print(\"Teeth: 1350\")\n        print(\"Condylus: 655\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/2\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"400\"\n        bpy.context.scene.interesse_mole = \"-300\"\n        bpy.context.scene.interesse_dentes = \"1350\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'NewTom'\" and StationNameLimpo == \"'NT'\" and ManufacturerModelNameLimpo == \"'NTVGiMK4'\":\n\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"670\"\n        bpy.context.scene.interesse_mole = \"-450\"\n        bpy.context.scene.interesse_dentes = \"950\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'NewTom'\" and StationNameLimpo == \"'NT'\" and ManufacturerModelNameLimpo == \"'NT5G'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 520\")\n        print(\"SoftTissue: -440\")\n        print(\"Teeth: 950\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"520\"\n        bpy.context.scene.interesse_mole = \"-440\"\n        bpy.context.scene.interesse_dentes = \"950\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'NewTom'\" and ManufacturerModelNameLimpo == \"'NT5GXL'\":\n        print(\"SÉRIE 81\")\n        print(\"Bone: 650\")\n        print(\"SoftTissue: -610\")\n        print(\"Teeth: 1240\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/81\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"650\"\n        bpy.context.scene.interesse_mole = \"-610\"\n        bpy.context.scene.interesse_dentes = \"1240\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'NewTom'\" and ManufacturerModelNameLimpo == \"'NTVGiEVO'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 570\")\n        print(\"SoftTissue: -600\")\n        print(\"Teeth: 1105\")\n\n        # TAMBÉM FUNCIONA O 201\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"570\"\n        bpy.context.scene.interesse_mole = \"-600\"\n        bpy.context.scene.interesse_dentes = \"1105\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Planmeca'\" and ManufacturerModelNameLimpo == \"'ProMax'\":\n        print(\"SÉRIE 347885\")\n        print(\"Bone: 600\")\n        print(\"SoftTissue: -550\")\n        print(\"Teeth: 1100\")\n        print(\"Condylus: 145\")\n\n        # TAMBÉM FUNCIONA O 201\n        try:\n            os.chdir(scn.my_tool.path+\"/347885\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"600\"\n            bpy.context.scene.interesse_mole = \"-550\"\n            bpy.context.scene.interesse_dentes = \"1100\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não conta com diretório 347885\")\n\n    if ManufacturerLimpo == \"'Planmeca'\" and ManufacturerModelNameLimpo == \"'ProMax'\":\n        print(\"SÉRIE 453970\")\n        print(\"Bone: 200\")\n        print(\"SoftTissue: -580\")\n        print(\"Teeth: 460\")\n        print(\"Condylus: 145\")\n\n        # TAMBÉM FUNCIONA O 201\n        try:\n            os.chdir(scn.my_tool.path+\"/453970\")\n            scn.my_tool.path = os.getcwd()\n#           bpy.ops.object.corrige_dicom()\n\n            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-580\"\n            bpy.context.scene.interesse_dentes = \"460\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não conta com diretório 453970\")\n\n        try:\n            os.chdir(scn.my_tool.path+\"/454156\")\n            scn.my_tool.path = os.getcwd()\n            bpy.ops.object.corrige_dicom()\n\n#            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"450\"\n            bpy.context.scene.interesse_mole = \"-450\"\n            bpy.context.scene.interesse_dentes = \"1300\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não conta com diretório 454156\")\n\n        try:\n            os.chdir(scn.my_tool.path+\"/456750\")\n            scn.my_tool.path = os.getcwd()\n#           bpy.ops.object.corrige_dicom()\n\n            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-580\"\n            bpy.context.scene.interesse_dentes = \"460\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n        except:\n            print(\"Não conta com diretório 456750\")\n\n\n        try:\n            os.chdir(scn.my_tool.path+\"/134149\")\n            scn.my_tool.path = os.getcwd()\n#           bpy.ops.object.corrige_dicom()\n\n            bpy.ops.object.reduz_dimensao_dicom()\n\n            # Copia para o diretório\n            try:\n                CopiaTomoDir(scn.my_tool.path)\n            except:\n                print(\"Doesn't have Patient Dir\")\n\n            # Gera o 3D\n            bpy.context.scene.interesse_ossos = \"200\"\n            bpy.context.scene.interesse_mole = \"-580\"\n            bpy.context.scene.interesse_dentes = \"460\"\n\n            bpy.ops.object.gera_modelos_tomo()\n\n\n        except:\n            print(\"Não conta com diretório 134149\")\n\n\n    if ManufacturerLimpo == \"'Carestream Health'\" and ManufacturerModelNameLimpo == \"'CS 9300'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 452\")\n        print(\"SoftTissue: -580\")\n        print(\"Teeth: 1080\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"200\"\n        bpy.context.scene.interesse_mole = \"-580\"\n        bpy.context.scene.interesse_dentes = \"1080\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Dabi Atlante'\" and ManufacturerModelNameLimpo == \"'Eagle 3D'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 575\")\n        print(\"SoftTissue: -377\")\n        print(\"Teeth: 1080\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n#        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"575\"\n        bpy.context.scene.interesse_mole = \"-377\"\n        bpy.context.scene.interesse_dentes = \"1080\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n    if ManufacturerLimpo == \"'Carestream Health'\" and ManufacturerModelNameLimpo == \"'CS 9000'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: 446\")\n        print(\"SoftTissue: 536\")\n        print(\"Teeth: 982\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n#        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"446\"\n        bpy.context.scene.interesse_mole = \"-536\"\n        bpy.context.scene.interesse_dentes = \"982\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\n\n    if ManufacturerLimpo == \"'Carestream Health'\" and ManufacturerModelNameLimpo == \"'CS 8100 3D'\":\n        print(\"SÉRIE 1\")\n        print(\"Bone: -522\")\n        print(\"SoftTissue: -680\")\n        print(\"Teeth: 982\")\n\n        os.chdir(scn.my_tool.path+\"/1\")\n        scn.my_tool.path = os.getcwd()\n        bpy.ops.object.corrige_dicom()\n\n        bpy.ops.object.reduz_dimensao_dicom()\n\n        # Copia para o diretório\n        try:\n            CopiaTomoDir(scn.my_tool.path)\n        except:\n            print(\"Doesn't have Patient Dir\")\n\n        # Gera o 3D\n        bpy.context.scene.interesse_ossos = \"522\"\n        bpy.context.scene.interesse_mole = \"-680\"\n        bpy.context.scene.interesse_dentes = \"982\"\n\n        bpy.ops.object.gera_modelos_tomo()\n\ndef GeraModeloTomoAutoDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.ops.object.ajusta_tomo()\n\n    print(\"Original:\", scn.my_tool.path)\n\n    try:\n        os.chdir(scn.my_tool.path+\"/1\")\n    except:\n        print(\"Dir 1 doesn't exist\")\n\n    try:\n        os.chdir(scn.my_tool.path+\"/2\")\n    except:\n        print(\"Dir 2 doesn't exist\")\n\n    try:\n        os.chdir(scn.my_tool.path+\"/3\")\n    except:\n        print(\"Dir 3 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/4\")\n    except:\n        print(\"Dir 4 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/5\")\n    except:\n        print(\"Dir 5 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/6\")\n    except:\n        print(\"Dir 6 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/9\")\n    except:\n        print(\"Dir 6 doesn't exist\")\n\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/0\")\n    except:\n        print(\"Dir 0 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/81\")\n    except:\n        print(\"Dir 81 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/100\")\n    except:\n        print(\"Dir 81 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/202\")\n    except:\n        print(\"Dir 202 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/303\")\n    except:\n        print(\"Dir 303 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/67821\")\n    except:\n        print(\"Dir 67821 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/134149\")\n    except:\n        print(\"Dir 134149 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/347885\")\n    except:\n        print(\"Dir 347885 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/453970\")\n    except:\n        print(\"Dir 453970 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/454156\")\n    except:\n        print(\"Dir 454156 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/456750\")\n    except:\n        print(\"Dir 453970 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/303\")\n    except:\n        print(\"Dir 303 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/601\")\n    except:\n        print(\"Dir 601 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/700\")\n    except:\n        print(\"Dir 700 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/900\")\n    except:\n        print(\"Dir 900 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/1000\")\n    except:\n        print(\"Dir 1000 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/1005\")\n    except:\n        print(\"Dir 1005 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/2000\")\n    except:\n        print(\"Dir 1005 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/3330\")\n    except:\n        print(\"Dir 1005 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/35881\")\n    except:\n        print(\"Dir 1005 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/1007002\")\n    except:\n        print(\"Dir 1007002 doesn't exist\")\n\n    try:\n\t    os.chdir(scn.my_tool.path+\"/001006002\")\n    except:\n        print(\"Dir 001006002 doesn't exist\")\n\n\n\n    # Não usar o 1, dá erro!\n\n    try:\n        print(\"Atual:\", os.getcwd())\n        print (os.listdir(os.getcwd())[0])\n\n        ArquivoAtual = os.listdir(os.getcwd())[0]\n\n        IdentificaTomografo(ArquivoAtual)\n    except:\n        print(\"Erro no DICOM, tentativa 2!\")\n        scn.my_tool.path = os.getcwd()\n        global DirExportado\n        DirExportado = scn.my_tool.path\n        bpy.ops.object.corrige_dicom()\n        scn.my_tool.path = os.getcwd()+\"/FIXED/\"\n        ArquivoAtual = os.listdir(os.getcwd())[0]\n        IdentificaTomografo(ArquivoAtual)\n\nclass GeraModeloTomoAuto(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelos_tomo_auto\"\n    bl_label = \"Gera Modelo Tomo\"\n\n    def execute(self, context):\n        try:\n\n            try:\n                GeraModeloTomoAutoDef(self, context)\n            except:\n                GeraModeloTomoAutoDef(self, context)\n        except:\n\n            print(\"EROOOOO\")\n\n            if platform.system() == \"Windows\":\n\n                context = bpy.context\n                scn = context.scene\n\n                os.chdir(DirExportado+\"/Error/\")\n                os.makedirs(\"FIXED\")\n\n                path = DirExportado+\"/Error/\"\n                dirs = os.listdir( path )\n\n                print(\"DIRRRRRRRR GLOBAL:\", DirExportado)\n\n\n                # print the files in given directory\n                DCMNum = 0\n\n                for file in dirs:\n                    print (file)\n\n                    print(\"FIXED WINDOWS MANUAL!!!\")\n                    try:\n                        os.system(\"C:\\OrtogOnBlender\\dicomtools\\dicomtodicom --verbose -o FIXED \"+file)\n                        shutil.move(DirExportado+\"/Error/FIXED/IM-0001-0001.dcm\", DirExportado+\"/Error/FIXED/\"+str(DCMNum))\n                        DCMNum += 1\n                    except:\n                        print(\"Arquivo corrompido ou não é um DICOM!\")\n\n                scn.my_tool.path = DirExportado+\"/Error/FIXED/\"\n                GeraModeloTomoAutoDef(self, context)\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModeloTomoAuto)\n\ndef DesagrupaTomoDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    if bpy.data.objects.get('Bones') and bpy.data.objects.get('SoftTissue') and bpy.data.objects.get('Teeth'):\n\n        a = bpy.data.objects['Bones']\n        b = bpy.data.objects['SoftTissue']\n        c = bpy.data.objects['Teeth']\n\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        bpy.data.objects['SoftTissue'].hide_viewport = False\n        bpy.data.objects['Bones'].hide_viewport = False\n        bpy.data.objects['Teeth'].hide_viewport = False\n\n        a.select_set(True)\n        b.select_set(True)\n        c.select_set(True)\n\n        context.view_layer.objects.active = a\n\n        bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n    else:\n        bpy.ops.object.dialog_operator_falta_objeto('INVOKE_DEFAULT')\n        #return {'FINISHED'}\n\nclass DesagrupaTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.desagrupa_tomo\"\n    bl_label = \"Desagrupa Tomo\"\n\n    def execute(self, context):\n        DesagrupaTomoDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(DesagrupaTomo)\n\ndef GeraModelosTomoManualDef(self, context):\n\n    scn = context.scene\n\n    if scn.my_tool.path == \"\":\n            bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n            return {'FINISHED'}\n\n    else:\n\n        homeall = expanduser(\"~\")\n\n        os.chdir(scn.my_tool.path)\n        DirAtual = os.getcwd()\n        ArqAtual = os.listdir(os.getcwd())[0]\n        print(\"Atual:\", os.getcwd())\n        print (os.listdir(os.getcwd())[0])\n\n        # IDENTIFICA TOMOGRAFO\n\n        # Lê arquivo DICOM\n\n\n        ds = pydicom.dcmread(ArqAtual, force=True)\n\n        try:\n            # Separa Manufacturer\n            ManufacturerComplete = ds.data_element(\"Manufacturer\")\n            ManufacturerLimpa1 = str(ManufacturerComplete).split('LO: ')\n            ManufacturerLimpo = str(ManufacturerLimpa1[1]).strip('\"')\n\n            print(\"ManufacturerComplete:\", ManufacturerComplete)\n            print(\"ManufacturerLimpa1:\", ManufacturerLimpa1)\n            print(\"ManufacturerLimpo:\", ManufacturerLimpo)\n\n        except:\n            print(\"Sem Manufacturer\")\n\n\n        try:\n            # Separa StationName\n            StationNameComplete = ds.data_element(\"StationName\")\n            StationNameLimpa1 = str(StationNameComplete).split('SH: ')\n            StationNameLimpo = str(StationNameLimpa1[1]).strip('\"')\n\n            print(\"StationNameComplete:\", StationNameComplete)\n            print(\"StationNameLimpa1:\", StationNameLimpa1)\n            print(\"StationNameLimpo:\", StationNameLimpo)\n        except:\n            print(\"Sem StationName\")\n\n\n\n        try:\n            # Separa ManufacturerModelName\n            ManufacturerModelNameComplete = ds.data_element(\"ManufacturerModelName\")\n            ManufacturerModelNameLimpa1 = str(ManufacturerModelNameComplete).split('LO: ')\n            ManufacturerModelNameLimpo = str(ManufacturerModelNameLimpa1[1]).strip('\"')\n\n            print(\"ManufacturerModelName:\", ManufacturerModelNameComplete)\n            print(\"ManufacturerModelNameLimpa1:\", ManufacturerModelNameLimpa1)\n            print(\"ManufacturerModelNameLimpo:\", ManufacturerModelNameLimpo)\n            return ManufacturerModelName\n        except:\n            print(\"Sem ManufacturerModelName\")\n\n        # GERA MODELOS\n\n        ListaArquivos = sorted(os.listdir(scn.my_tool.path))\n\n        os.chdir(scn.my_tool.path)\n\n        ds = pydicom.dcmread(str(DirAtual+\"/\"+ArqAtual), force=True)\n        DimPixelsX = ds.Rows\n        DimPixelsY = ds.Columns\n\n        print(\"TESTA FATIA...\")\n        print(\"DimPixelsX\", DimPixelsX)\n        print(\"DimPixelsY\", DimPixelsY)\n\n        # CAPTURA VALORES DOS FATORES\n\n        FatorOssos = bpy.context.scene.interesse_ossos\n        FatorMole = bpy.context.scene.interesse_mole\n        FatorDentes = bpy.context.scene.interesse_dentes\n\n        DiretorioTomo = scn.my_tool.path\n\n        TmpDirTomografo = tempfile.mkdtemp()\n        TmpTomograforFile = TmpDirTomografo+'/CT_Scan_tomograph.txt'\n\n        try:\n            with open(TmpTomograforFile, \"a\") as ModeloTomografo:\n                ModeloTomografo.write('ManufacturerLimpo == '+'\"'+str(ManufacturerLimpo)+'\"'+\"\\n\")\n                ModeloTomografo.write('StationNameLimpo == '+'\"'+str(StationNameLimpo)+'\"'+\"\\n\")\n                ModeloTomografo.write('ManufacturerModelNameLimpo == '+'\"'+str(ManufacturerModelNameLimpo)+'\"'+\"\\n\")\n                if DimPixelsX > 512 or DimPixelsY > 512:\n                    ModeloTomografo.write(\"NECESSÁRIO REDUZIR!!!\\n\")\n                else:\n                    ModeloTomografo.write(\"Não é necessário reduzir\\n\")\n\n                ModeloTomografo.write('bpy.context.scene.interesse_ossos = '+'\"'+str(FatorOssos)+'\"'+\"\\n\")\n                ModeloTomografo.write('bpy.context.scene.interesse_mole = '+'\"'+str(FatorMole)+'\"'+\"\\n\")\n                ModeloTomografo.write('bpy.context.scene.interesse_dentes = '+'\"'+str(FatorDentes)+'\"'+\"\\n\")\n                ModeloTomografo.write('DiretorioTomo == '+str(DiretorioTomo))\n\n                # SCRIPT\n\n                ModeloTomografo.write(\"\\n\")\n                ModeloTomografo.write(\"\\n\")\n                ModeloTomografo.write(\"    \"+'if ManufacturerLimpo == '+'\"'+str(ManufacturerLimpo)+'\" and StationNameLimpo == '+'\"'+str(StationNameLimpo)+'\" and ManufacturerModelNameLimpo == '+'\"'+str(ManufacturerModelNameLimpo)+'\":'+\"\\n\")\n\n                ModeloTomografo.write(\"\\n\")\n                ModeloTomografo.write(\"        \"+'os.chdir(scn.my_tool.path+\"'+\"/\"+str(DiretorioTomo).split('/')[-2]+'\")'+\"\\n\")\n\n                ModeloTomografo.write(\"\\n\")\n                ModeloTomografo.write(\"        \"+'scn.my_tool.path = os.getcwd()'+\"\\n\")\n                ModeloTomografo.write(\"        \"+'bpy.ops.object.corrige_dicom()'+\"\\n\")\n\n                ModeloTomografo.write(\"\\n\")\n                if DimPixelsX > 512 or DimPixelsY > 512:\n                    ModeloTomografo.write(\"        \"+'bpy.ops.object.reduz_dimensao_dicom()'+\"\\n\")\n\n                ModeloTomografo.write(\"\\n\")\n                ModeloTomografo.write(\"        \"+'try:'+\"\\n\")\n                ModeloTomografo.write(\"            \"+'CopiaTomoDir(scn.my_tool.path)'+\"\\n\")\n                ModeloTomografo.write(\"        \"+'except:'+\"\\n\")\n                ModeloTomografo.write(\"            \"+'print(\"Doesn\\'t have Patient Dir\")'+\"\\n\")\n\n\n                ModeloTomografo.write(''+\"\\n\")\n\n                ModeloTomografo.write(\"        \"+'bpy.context.scene.interesse_ossos = \"'+str(FatorOssos)+'\"'+\"\\n\")\n                ModeloTomografo.write(\"        \"+'bpy.context.scene.interesse_mole = \"'+str(FatorMole)+'\"'+\"\\n\")\n                ModeloTomografo.write(\"        \"+'bpy.context.scene.interesse_dentes = \"'+str(FatorDentes)+'\"'+\"\\n\")\n\n                ModeloTomografo.write(''+\"\\n\")\n                ModeloTomografo.write(\"        \"+'bpy.ops.object.gera_modelos_tomo()'+\"\\n\")\n\n                ModeloTomografo.close()\n\n        except:\n            print(\"Não consta dados do tomógrafo.\")\n\n\n\n\n\n\n\n        # ABRE DIRETÓRIO\n\n        if platform.system() == \"Windows\":\n            os.startfile(TmpTomograforFile)\n        elif platform.system() == \"Darwin\":\n            subprocess.Popen([\"open\", TmpTomograforFile])\n        else:\n            subprocess.Popen([\"xdg-open\", TmpTomograforFile])\n\n        if DimPixelsX > 512 or DimPixelsY > 512:\n\n            print(\"MAIOR QUE 512!!! REDUZINDO...\")\n\n            bpy.ops.object.corrige_dicom()\n            bpy.ops.object.reduz_dimensao_dicom() # SÓ FUNCIONA SE FOR COMPATIVEL! POR ISSO O FIXED ANTES!!!\n            bpy.ops.object.gera_modelos_tomo()\n\n        else:\n            print(\"MENOR OU IGUAL A 512...\")\n            bpy.ops.object.corrige_dicom()\n            bpy.ops.object.gera_modelos_tomo()\n\n\nclass GeraModelosTomoManual(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelo_tomo_manual\"\n    bl_label = \"Gera Modelo Tomo Manual\"\n\n    def execute(self, context):\n        GeraModelosTomoManualDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModelosTomoManual)\n\n\ndef GeraModelosTomoCustomlDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    if scn.my_tool.path == \"\":\n            bpy.ops.object.dialog_operator_informe_dicom('INVOKE_DEFAULT')\n            return {'FINISHED'}\n\n    else:\n\n        homeall = expanduser(\"~\")\n\n        os.chdir(scn.my_tool.path)\n        DirAtual = os.getcwd()\n        ArqAtual = os.listdir(os.getcwd())[0]\n        print(\"Atual:\", os.getcwd())\n        print (os.listdir(os.getcwd())[0])\n\n        # IDENTIFICA TOMOGRAFO\n\n        # Lê arquivo DICOM\n\n\n        ds = pydicom.dcmread(ArqAtual)\n\n        # Separa Manufacturer\n        ManufacturerComplete = ds.data_element(\"Manufacturer\")\n        ManufacturerLimpa1 = str(ManufacturerComplete).split('LO: ')\n        ManufacturerLimpo = str(ManufacturerLimpa1[1]).strip('\"')\n\n        print(\"ManufacturerComplete:\", ManufacturerComplete)\n        print(\"ManufacturerLimpa1:\", ManufacturerLimpa1)\n        print(\"ManufacturerLimpo:\", ManufacturerLimpo)\n\n\n        try:\n            # Separa StationName\n            StationNameComplete = ds.data_element(\"StationName\")\n            StationNameLimpa1 = str(StationNameComplete).split('SH: ')\n            StationNameLimpo = str(StationNameLimpa1[1]).strip('\"')\n\n            print(\"StationNameComplete:\", StationNameComplete)\n            print(\"StationNameLimpa1:\", StationNameLimpa1)\n            print(\"StationNameLimpo:\", StationNameLimpo)\n        except:\n            print(\"Sem StationNam\")\n\n\n\n        try:\n            # Separa ManufacturerModelName\n            ManufacturerModelNameComplete = ds.data_element(\"ManufacturerModelName\")\n            ManufacturerModelNameLimpa1 = str(ManufacturerModelNameComplete).split('LO: ')\n            ManufacturerModelNameLimpo = str(ManufacturerModelNameLimpa1[1]).strip('\"')\n\n            print(\"ManufacturerModelName:\", ManufacturerModelNameComplete)\n            print(\"ManufacturerModelNameLimpa1:\", ManufacturerModelNameLimpa1)\n            print(\"ManufacturerModelNameLimpo:\", ManufacturerModelNameLimpo)\n            return ManufacturerModelName\n        except:\n            print(\"Sem ManufacturerModelName\")\n\n        # GERA MODELOS\n\n        ListaArquivos = sorted(os.listdir(scn.my_tool.path))\n\n        os.chdir(scn.my_tool.path)\n\n        ds = pydicom.dcmread(str(DirAtual+\"/\"+ArqAtual), force=True)\n        DimPixelsX = ds.Rows\n        DimPixelsY = ds.Columns\n\n        print(\"TESTA FATIA...\")\n        print(\"DimPixelsX\", DimPixelsX)\n        print(\"DimPixelsY\", DimPixelsY)\n\n\n        if DimPixelsX > 512 or DimPixelsY > 512:\n\n            print(\"MAIOR QUE 512!!! REDUZINDO...\")\n\n            bpy.ops.object.corrige_dicom()\n            bpy.ops.object.reduz_dimensao_dicom() # SÓ FUNCIONA SE FOR COMPATIVEL! POR ISSO O FIXED ANTES!!!\n            ReconTomo(scn.my_tool.path, bpy.context.scene.interesse_geral, bpy.context.scene.nome_objeto, bpy.context.scene.fator_simplificacao)\n\n            bpy.ops.transform.rotate(value=3.14159, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n            a = bpy.context.active_object\n            a.location[0] = 0\n            a.location[1] = 0\n            a.location[2] = 0\n            bpy.ops.view3d.view_all(center=False)\n\n            activeObject = bpy.context.active_object\n            mat = bpy.data.materials.new(name=activeObject.name) #set new material to variable\n            activeObject.data.materials.append(mat) #add the material to the object\n            activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\n        else:\n            print(\"MENOR OU IGUAL A 512...\")\n            bpy.ops.object.corrige_dicom()\n            ReconTomo(scn.my_tool.path, bpy.context.scene.interesse_geral, bpy.context.scene.nome_objeto, bpy.context.scene.fator_simplificacao)\n\n            bpy.ops.transform.rotate(value=3.14159, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)\n            a = bpy.context.active_object\n            a.location[0] = 0\n            a.location[1] = 0\n            a.location[2] = 0\n            bpy.ops.view3d.view_all(center=False)\n\n            activeObject = bpy.context.active_object\n            mat = bpy.data.materials.new(name=activeObject.name) #set new material to variable\n            activeObject.data.materials.append(mat) #add the material to the object\n            activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\nclass GeraModelosTomoCustom(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelo_tomo_custom\"\n    bl_label = \"Gera Modelo Tomo Custom\"\n\n    def execute(self, context):\n        GeraModelosTomoCustomlDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraModelosTomoCustom)\n"
  },
  {
    "path": "GeraRelatorio.py",
    "content": "import bpy\nimport csv\nimport tempfile\nimport subprocess\nimport openpyxl\nimport platform\nfrom string import ascii_uppercase\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, Fill\nfrom openpyxl.styles import Border, Side, PatternFill, Font, GradientFill, Alignment\n\nfrom .CalculaPontos import *\nfrom .AjustaTomo import *\nfrom .Cefalometria import *\n\n\ndef DeslocamentoINIFIN(obj, obj1, obj2):\n    objini = bpy.data.objects[obj1]\n    objfin = bpy.data.objects[obj2]\n    \n\n#    if bpy.data.objects.get(obj) is not None:\n    Xdes = str(round(objfin.location[0] - objini.location[0], 2))\n    Ydes = str(round(objfin.location[1] - objini.location[1], 2))\n    Zdes = str(round(objfin.location[2] - objini.location[2], 2))\n\n\n    a = [obj, str(Xdes), str(Ydes), str(Zdes)]\n\n    return a\n\n\ndef CapturaCefaloINI():    \n    print(\"Nada\")\n\n\n#    global SNA_INI, SNB_INI, ANB_INI, Y_Cresc_INI, Y_Cresc_INI, SNPlO_INI, FMA_INI, FMIA_INI, IMPA_INI, NS_INI\n\n#    bpy.ops.object.cefalo_calc_tudo()\n\n#    SNA_INI = bpy.types.Scene.angulo_SNA[1]['default']\n#    SNB_INI = bpy.types.Scene.angulo_SNB[1]['default']\n#    ANB_INI = bpy.types.Scene.angulo_ANB[1]['default']\n#    Y_Cresc_INI = bpy.types.Scene.angulo_Y_Cresc[1]['default']\n#    SNPlO_INI = bpy.types.Scene.angulo_SNPlO[1]['default'] \n#    FMA_INI = bpy.types.Scene.angulo_FMA[1]['default']\n#    FMIA_INI = bpy.types.Scene.angulo_FMIA[1]['default']\n#    IMPA_INI = bpy.types.Scene.angulo_IMPA[1]['default']\n#    NS_INI = bpy.types.Scene.angulo_NS[1]['default']\n\ndef CapturaCefaloFIN():    \n    print(\"Nada\")\n#    global SNA_FIN, SNB_FIN, ANB_FIN, Y_Cresc_FIN, Y_Cresc_FIN, SNPlO_FIN, FMA_FIN, FMIA_FIN, IMPA_FIN, NS_FIN\n\n#    bpy.ops.object.cefalo_calc_tudo()\n\n#    SNA_FIN = bpy.types.Scene.angulo_SNA[1]['default']\n#    SNB_FIN = bpy.types.Scene.angulo_SNB[1]['default']\n#    ANB_FIN = bpy.types.Scene.angulo_ANB[1]['default']\n#    Y_Cresc_FIN = bpy.types.Scene.angulo_Y_Cresc[1]['default']\n#    SNPlO_FIN = bpy.types.Scene.angulo_SNPlO[1]['default']\n#    FMA_FIN = bpy.types.Scene.angulo_FMA[1]['default']\n#    FMIA_FIN = bpy.types.Scene.angulo_FMIA[1]['default']\n#    IMPA_FIN = bpy.types.Scene.angulo_IMPA[1]['default']\n#    NS_FIN = bpy.types.Scene.angulo_NS[1]['default']\n\ndef GeraRelatorioDef(self, context):\n    \n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    # CAPTURA FRAME INICIAL\n\n    frame1 = bpy.data.scenes[\"Scene\"].frame_start\n\n    obj_pre(frame1)\n    CapturaCefaloINI()\n\n\n    # CAPTURA FRAME INICIAL\n\n    frame2 = bpy.data.scenes[\"Scene\"].frame_end\n\n    obj_pos(frame2)\n    CapturaCefaloFIN()\n\n\n\n    # Gera CSV\n    tmpdir = tempfile.mkdtemp()\n\n    ListaApagar = []\n\n    with open(tmpdir+'/Report_OrtogOnBlender.csv', mode='w') as centroid_file:\n        report_writer = csv.writer(centroid_file, delimiter=',', quotechar='\"', quoting=csv.QUOTE_MINIMAL)\n\n        report_writer.writerow(['ORTOGONBLENDER'])\n        report_writer.writerow([''])\n\n        try:\n            Collection_Head = bpy.data.collections['Anatomical Points - Head'].all_objects\n\n            report_writer.writerow(['HEAD'])\n            report_writer.writerow(['ID', 'LocX', 'LocY', 'LocZ'])\n\n            for ob in Collection_Head:\n                    report_writer.writerow(DeslocamentoINIFIN( ob.name+' : ', ob.name+'.INI', ob.name+'.FIN'))\n                    ListaApagar.append(ob.name+'.INI')\n                    ListaApagar.append(ob.name+'.FIN')\n        except:\n            print(\"Sem pontos da Cabeça.\")\n\n\n        try:\n            Collection_Maxilla = bpy.data.collections['Anatomical Points - Maxilla'].all_objects\n\n            report_writer.writerow([''])\n            report_writer.writerow(['MAXILLA'])\n            report_writer.writerow(['ID', 'LocX', 'LocY', 'LocZ'])\n\n            for ob in Collection_Maxilla:\n                    report_writer.writerow(DeslocamentoINIFIN( ob.name+' : ', ob.name+'.INI', ob.name+'.FIN'))\n                    ListaApagar.append(ob.name+'.INI')\n                    ListaApagar.append(ob.name+'.FIN')\n        except:\n            print(\"Sem pontos da Maxila.\")\n\n\n\n        try:\n            Collection_Mandible = bpy.data.collections['Anatomical Points - Mandible'].all_objects\n\n            report_writer.writerow([''])\n            report_writer.writerow(['MANDIBLE'])\n            report_writer.writerow(['ID', 'LocX', 'LocY', 'LocZ'])\n\n            for ob in Collection_Mandible:\n                    report_writer.writerow(DeslocamentoINIFIN( ob.name+' : ', ob.name+'.INI', ob.name+'.FIN'))\n                    ListaApagar.append(ob.name+'.INI')\n                    ListaApagar.append(ob.name+'.FIN')\n        except:\n            print(\"Sem pontos da Mandíbula.\")\n\n\n        try:\n            Collection_Teeth = bpy.data.collections['Anatomical Points - Teeth'].all_objects\n\n            report_writer.writerow([''])\n            report_writer.writerow(['TEETH'])\n            report_writer.writerow(['ID', 'LocX', 'LocY', 'LocZ'])\n\n            for ob in Collection_Teeth:\n                    report_writer.writerow(DeslocamentoINIFIN( ob.name+' : ', ob.name+'.INI', ob.name+'.FIN'))\n                    ListaApagar.append(ob.name+'.INI')\n                    ListaApagar.append(ob.name+'.FIN')\n        except:\n            print(\"Sem pontos dos Dentes.\")\n\n\n        try:\n            Collection_SoftTissue = bpy.data.collections['Anatomical Points - Soft Tissue'].all_objects\n\n            report_writer.writerow([''])\n            report_writer.writerow(['SOFT TISSUE'])\n            report_writer.writerow(['ID', 'LocX', 'LocY', 'LocZ'])\n\n            for ob in Collection_SoftTissue:\n                    report_writer.writerow(DeslocamentoINIFIN( ob.name+' : ', ob.name+'.INI', ob.name+'.FIN'))\n                    ListaApagar.append(ob.name+'.INI')\n                    ListaApagar.append(ob.name+'.FIN')\n        except:\n            print(\"Sem pontos do Tecido Mole.\")\n\n        '''\n        report_writer.writerow([''])\n        report_writer.writerow([''])\n        report_writer.writerow(['CEFALOMETRY'])\n        report_writer.writerow(['ID', 'PRE', 'POST', 'RANGE'])\n\n        report_writer.writerow(['SNA', str(SNA_INI), str(SNA_FIN), '80º - 84º'])\n        report_writer.writerow(['SNB', str(SNB_INI), str(SNB_FIN), '78º - 82º'])\n        report_writer.writerow(['ANB', str(ANB_INI), str(ANB_FIN), '0º - 4º'])\n        report_writer.writerow(['Y_Cresc', str(Y_Cresc_INI), str(Y_Cresc_FIN), '65º - 69º'])\n        report_writer.writerow(['SNPlO', str(SNPlO_INI), str(SNPlO_FIN), '12º - 16º'])\n        report_writer.writerow(['FMA', str(FMA_INI), str(FMA_FIN), '23º - 27º'])\n        report_writer.writerow(['FMIA', str(FMIA_INI), str(FMIA_FIN), '66º - 70º'])\n        report_writer.writerow(['IMPA', str(IMPA_INI), str(IMPA_FIN), '85º - 89º'])\n        report_writer.writerow(['1NS', str(NS_INI), str(NS_FIN), '101º - 105º'])\n\n        '''\n    # Apaga\n    try:\n        for ob in ListaApagar:\n            apagaObjeto(ob)\n    except:\n        print(\"Sem objetos INI e FIN na cena.\")\n\n\n#    subprocess.Popen(\"libreoffice \"+tmpdir+\"/Report_OrtogOnBlender.csv\", shell=True)\n\n    if platform.system() == \"Linux\":\n        abrir_diretorio(tmpdir)\n        subprocess.Popen(\"libreoffice \"+tmpdir+\"/Report_OrtogOnBlender.csv\", shell=True)\n\n    if platform.system() == \"Windows\":\n        abrir_diretorio(tmpdir)\n        subprocess.Popen('cd \"C:/Program Files/LibreOffice/program/\" & dir & soffice.bin '+tmpdir+\"/Report_OrtogOnBlender.csv\", shell=True)\n        \n    if platform.system() == \"Darwin\":\n        abrir_diretorio(tmpdir)\n        subprocess.Popen('/Applications/LibreOffice.app/Contents/MacOS/soffice '+tmpdir+\"/Report_OrtogOnBlender.csv\", shell=True)\n\n    '''\n    # Converte em XLSX\n    wb = Workbook()\n    ws = wb.active\n    with open(tmpdir+'/Report_OrtogOnBlender.csv', 'r') as f:\n        for row in csv.reader(f):\n            ws.append(row)\n    wb.save(tmpdir+'/Report_OrtogOnBlender.xlsx')\n\n# AJUSTA OS TAMANHOS DAS CÉLULAS (AUTOFIT)\n\n    newFile = tmpdir+'/Report_OrtogOnBlender.xlsx'\n\n    wb = openpyxl.load_workbook(filename = newFile)        \n    worksheet = wb.active\n\n    for col in worksheet.columns:\n         max_length = 0\n         column = col[0].column # Get the column name\n         for cell in col:\n             try: # Necessary to avoid error on empty cells\n                 if len(str(cell.value)) > max_length:\n                     max_length = len(cell.value)\n             except:\n                 pass\n         adjusted_width = (max_length + 2) * 1.2\n         worksheet.column_dimensions[column].width = adjusted_width\n\n#    wb.save(newFile)\n\n    # STYLE\n\n    listaFontes1 = ['A1','A3','A16','A26','A34']\n\n    for i in listaFontes1:\n        c = worksheet[i]\n#        c.font = Font(bold=True, name='Arial')\n        c.font = Font(bold=True, name=\"Calibri\")\n\n\n    ListaCor1 = ['A3','B3','C3','D3','A16','B16','C16','D16','A26','B26','C26','D26','A34','B34','C34','D34']\n\n    for i in ListaCor1:\n        d = worksheet[i]\n        d.fill = PatternFill(\"solid\", fgColor=\"b1e2e2\")\n\n    ListaCor2 = ['A4','B4','C4','D4','A17','B17','C17','D17','A27','B27','C27','D27','A35','B35','C35','D35']\n\n    for i in ListaCor2:\n        d = worksheet[i]\n        d.fill = PatternFill(\"solid\", fgColor=\"fff9ae\")\n\n    wb.save(newFile)\n\n\n    if platform.system() == \"Linux\":\n        subprocess.Popen(\"libreoffice \"+tmpdir+\"/Report_OrtogOnBlender.xlsx\", shell=True)\n\n    if platform.system() == \"Windows\":\n        abrir_diretorio(tmpdir)\n        subprocess.Popen('cd \"C:/Program Files/LibreOffice/program/\" & dir & soffice.bin '+tmpdir+\"/Report_OrtogOnBlender.xlsx\", shell=True)\n        \n    if platform.system() == \"Darwin\":\n        abrir_diretorio(tmpdir)\n        subprocess.Popen('/Applications/LibreOffice.app/Contents/MacOS/soffice '+tmpdir+\"/Report_OrtogOnBlender.xlsx\", shell=True)    \n    '''\n\nclass GeraRelatorio(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_relatorio\"\n    bl_label = \"Gera deslocamento de todos\"\n\n    def execute(self, context):\n        GeraRelatorioDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraRelatorio)\n"
  },
  {
    "path": "ImportaObjMat.py",
    "content": "import bpy\nimport platform\n\ndef ImportaMaterial(impMaterial, SelObj):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        dirScript = bpy.utils.user_resource('SCRIPTS')\n        \n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Material\\\\\"\n        object    = impMaterial\n        \n    if platform.system() == \"Windows\":\n        dirScript = 'C:/OrtogOnBlender/Blender280/2.80/scripts/' \n\n        blendfile = dirScript+\"addons/OrtogOnBlender-master/objetos.blend\"\n        section   = \"\\\\Material\\\\\"\n        object    = impMaterial\n\n    filepath  = blendfile + section + object\n    directory = blendfile + section\n    filename  = object\n\n    bpy.ops.wm.append(\n        filepath=filepath, \n        filename=filename,\n        directory=directory)\n\n\n#    bpy.context.scene.render.engine = 'CYCLES' # Troca tipo renderização\n\n    # Etapa de importação de material\n\n\n#    objects = bpy.data.objects\n\n\n    material_01 = bpy.data.materials[impMaterial] # Informa material à def\n\n    obj = bpy.data.objects[SelObj] # Informa objeto à def\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    context.view_layer.objects.active = obj\n    bpy.context.object.show_transparent = True\n\n\n    bpy.ops.object.material_slot_add()\n    obj.data.materials[0] = material_01\n\n    mensagem = \"Beleza!\"\n\n    return mensagem\n\n\n\n"
  },
  {
    "path": "ListaArquivos.txt",
    "content": "/tmp/tmptqwi9nhvCOPY/IMG0074.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0566.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0574.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0069.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0046.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0156.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0135.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0419.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0064.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0306.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0254.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0343.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0514.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0209.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0024.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0195.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0299.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0412.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0421.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0056.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0369.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0081.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0404.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0347.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0411.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0087.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0501.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0387.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0482.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0372.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0546.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0099.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0222.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0019.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0393.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0253.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0152.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0352.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0132.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0186.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0242.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0567.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0447.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0042.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0053.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0592.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0250.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0450.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0353.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0079.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0119.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0008.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0216.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0579.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0062.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0441.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0258.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0410.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0374.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0158.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0149.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0536.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0114.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0310.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0106.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0172.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0206.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0101.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0039.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0058.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0040.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0018.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0431.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0523.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0287.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0063.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0544.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0236.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0500.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0461.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0273.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0467.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0354.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0207.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0015.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0355.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0423.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0476.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0462.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0597.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0521.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0455.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0255.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0477.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0388.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0578.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0227.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0045.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0377.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0322.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0538.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0356.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0555.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0319.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0506.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0256.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0213.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0240.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0233.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0097.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0530.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0403.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0147.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0484.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0145.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0266.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0537.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0245.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0175.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0561.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0312.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0334.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0384.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0049.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0562.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0378.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0420.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0318.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0089.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0190.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0272.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0196.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0103.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0252.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0122.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0348.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0188.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0440.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0449.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0385.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0047.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0446.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0333.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0428.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0350.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0274.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0111.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0068.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0307.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0361.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0159.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0552.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0485.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0013.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0210.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0166.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0309.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0569.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0025.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0263.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0478.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0491.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0284.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0279.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0535.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0328.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0407.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0585.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0533.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0178.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0594.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0422.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0073.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0487.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0054.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0123.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0231.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0199.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0436.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0468.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0078.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0037.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0550.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0129.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0143.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0311.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0105.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0173.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0475.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0269.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0002.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0297.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0324.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0109.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0575.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0094.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0497.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0009.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0367.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0444.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0150.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0479.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0465.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0241.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0383.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0390.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0185.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0076.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0362.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0401.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0003.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0365.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0118.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0184.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0259.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0576.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0330.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0534.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0221.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0160.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0522.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0032.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0059.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0338.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0486.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0121.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0408.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0515.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0179.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0177.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0473.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0265.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0205.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0433.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0571.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0113.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0451.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0547.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0329.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0373.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0601.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0144.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0285.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0397.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0291.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0014.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0531.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0495.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0581.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0246.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0358.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0098.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0088.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0438.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0060.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0001.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0075.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0235.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0104.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0582.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0043.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0007.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0549.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0137.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0472.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0389.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0474.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0117.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0202.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0138.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0036.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0368.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0092.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0203.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0427.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0277.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0165.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0327.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0217.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0382.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0041.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0211.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0090.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0084.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0357.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0548.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0151.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0557.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0435.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0218.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0187.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0083.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0512.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0293.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0116.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0399.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0174.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0381.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0021.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0541.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0257.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0392.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0051.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0224.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0080.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0502.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0208.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0349.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0336.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0553.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0276.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0238.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0228.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0580.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0162.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0509.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0588.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0425.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0591.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0498.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0414.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0316.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0219.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0005.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0065.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0505.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0315.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0154.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0593.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0023.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0507.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0590.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0016.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0071.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0405.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0262.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0010.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0091.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0234.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0225.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0603.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0077.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0300.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0520.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0323.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0516.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0568.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0466.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0004.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0292.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0230.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0442.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0586.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0464.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0220.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0424.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0560.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0251.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0481.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0131.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0082.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0303.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0223.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0331.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0429.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0342.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0183.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0020.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0061.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0108.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0340.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0398.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0128.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0146.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0376.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0339.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0181.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0270.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0439.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0006.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0456.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0483.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0370.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0504.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0394.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0418.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0313.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0321.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0086.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0164.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0573.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0170.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0375.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0558.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0426.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0517.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0559.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0445.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0344.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0212.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0345.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0539.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0395.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0139.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0126.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0391.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0237.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0197.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0542.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0248.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0215.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0337.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0400.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0460.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0148.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0033.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0280.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0584.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0458.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0232.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0226.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0100.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0044.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0589.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0120.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0115.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0320.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0110.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0386.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0155.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0503.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0011.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0095.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0264.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0332.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0193.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0526.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0499.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0599.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0295.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0363.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0028.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0471.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0294.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0406.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0031.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0302.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0169.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0249.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0570.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0524.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0161.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0602.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0180.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0496.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0026.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0563.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0463.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0457.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0554.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0416.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0243.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0283.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0127.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0325.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0454.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0289.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0430.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0510.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0182.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0308.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0489.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0314.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0275.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0360.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0396.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0072.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0434.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0096.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0380.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0027.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0359.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0304.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0413.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0443.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0492.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0527.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0364.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0493.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0572.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0480.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0229.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0543.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0305.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0513.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0034.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0038.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0048.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0102.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0605.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0298.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0030.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0271.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0066.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0017.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0200.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0351.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0437.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0432.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0112.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0239.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0290.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0488.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0204.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0012.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0366.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0415.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0029.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0124.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0371.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0604.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0198.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0596.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0134.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0346.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0163.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0244.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0452.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0286.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0133.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0214.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0518.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0278.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0107.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0556.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0528.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0525.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0191.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0052.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0093.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0050.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0453.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0281.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0067.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0176.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0409.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0519.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0125.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0168.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0565.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0136.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0141.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0606.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0511.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0140.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0595.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0085.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0600.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0508.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0022.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0035.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0341.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0545.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0261.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0494.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0260.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0268.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0247.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0194.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0142.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0577.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0282.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0448.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0189.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0540.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0326.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0296.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0490.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0288.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0130.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0417.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0564.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0057.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0598.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0532.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0335.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0070.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0171.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0055.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0201.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0551.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0402.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0459.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0317.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0192.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0587.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0153.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0470.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0583.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0379.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0157.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0167.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0469.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0529.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0301.dcm\n/tmp/tmptqwi9nhvCOPY/IMG0267.dcm\n"
  },
  {
    "path": "MicrosGenerate3D.mlx",
    "content": "<!DOCTYPE FilterScript>\n<FilterScript>\n <filter name=\"Compute normals for point sets\">\n  <Param description=\"Neighbour num\" tooltip=\"The number of neighbors used to estimate normals.\" type=\"RichInt\" value=\"10\" name=\"K\" isxmlparam=\"0\"/>\n  <Param description=\"Smooth Iteration\" tooltip=\"The number of smoothing iteration done on the p used to estimate and propagate normals.\" type=\"RichInt\" value=\"0\" name=\"smoothIter\" isxmlparam=\"0\"/>\n  <Param description=\"Flip normals w.r.t. viewpoint\" tooltip=\"If the 'viewpoint' (i.e. scanner position) is known, it can be used to disambiguate normals orientation, so that all the normals will be oriented in the same direction.\" type=\"RichBool\" value=\"false\" name=\"flipFlag\" isxmlparam=\"0\"/>\n  <Param z=\"0\" y=\"0\" description=\"Viewpoint Pos.\" tooltip=\"The viewpoint position can be set by hand (i.e. getting the current viewpoint) or it can be retrieved from mesh camera, if the viewpoint position is stored there.\" x=\"0\" type=\"RichPoint3f\" name=\"viewPos\" isxmlparam=\"0\"/>\n </filter>\n <xmlfilter name=\"Surface Reconstruction: Screened Poisson\">\n  <xmlparam value=\"0\" name=\"cgDepth\"/>\n  <xmlparam value=\"false\" name=\"confidence\"/>\n  <xmlparam value=\"8\" name=\"depth\"/>\n  <xmlparam value=\"5\" name=\"fullDepth\"/>\n  <xmlparam value=\"8\" name=\"iters\"/>\n  <xmlparam value=\"4\" name=\"pointWeight\"/>\n  <xmlparam value=\"false\" name=\"preClean\"/>\n  <xmlparam value=\"1.5\" name=\"samplesPerNode\"/>\n  <xmlparam value=\"1.1\" name=\"scale\"/>\n  <xmlparam value=\"false\" name=\"visibleLayer\"/>\n </xmlfilter>\n <filter name=\"Invert Faces Orientation\">\n  <Param description=\"Force Flip\" tooltip=\"If selected, the normals will always be flipped; otherwise, the filter tries to set them outside\" type=\"RichBool\" value=\"true\" name=\"forceFlip\" isxmlparam=\"0\"/>\n  <Param description=\"Flip only selected faces\" tooltip=\"If selected, only selected faces will be affected\" type=\"RichBool\" value=\"false\" name=\"onlySelected\" isxmlparam=\"0\"/>\n </filter>\n</FilterScript>\n"
  },
  {
    "path": "NomePaciente.py",
    "content": "import bpy\nfrom os.path import expanduser\nimport os\n\n# MENSAGENS\n\nclass PatientName(bpy.types.Operator):\n    bl_idname = \"object.dialog_operator_patient_name\"\n    bl_label = \"Please, write the patient's name and surname to save!\"\n\n\n    def execute(self, context):\n        message = (\"Teste\")\n        self.report({'INFO'}, message)\n        return {'FINISHED'}\n\n    def invoke(self, context, event):\n        wm = context.window_manager\n        return wm.invoke_props_dialog(self)\n\nbpy.utils.register_class(PatientName)\n\n\n\n# CRIA DIRETÓRIO E SALVA ARQUIVO INICIAL\n\ndef NomePacienteDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    NomePacienteDir = homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente\n\n    if NomePaciente != \"\" and SobrenomePaciente != \"\":\n\n        if not os.path.exists(homeDir+\"/OrtogOnBlenderDir\"):\n            os.mkdir(homeDir+\"/OrtogOnBlenderDir\")\n            print(\"Diretorio OrtogOnBlender criado\")\n\n        if not os.path.exists(NomePacienteDir):\n            os.mkdir(NomePacienteDir)\n            bpy.ops.wm.save_as_mainfile(filepath=homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Base-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n            print(\"Diretorio \"+NomePaciente+\"_\"+SobrenomePaciente+\" criado!\")\n\n    else:\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\nclass NomePaciente(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente\"\n    bl_label = \"Gera Nome Dir Nome Paciente\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteDir = homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente\n\n#        if found == False:\n        if not os.path.exists(NomePacienteDir):\n            return True\n        else:\n            if os.path.exists(NomePacienteDir):\n                return False\n\n    def execute(self, context):\n        NomePacienteDef(self, context)\n        return {'FINISHED'}\n\n# SALVA ARQUIVO TOMOGRAFIA\n\ndef NomePacienteVoxelDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Voxel-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteVoxel(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_voxel\"\n    bl_label = \"Gera Nome Dir Nome Paciente Voxel\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Voxel-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        bpy.ops.file.pack_all()\n        NomePacienteVoxelDef(self, context)\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(NomePacienteVoxel)\n\n# SALVA ARQUIVO TOMOGRAFIA\n\ndef NomePacienteTomoDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/CT_Scan-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_tomo\"\n    bl_label = \"Gera Nome Dir Nome Paciente Tomo\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/CT_Scan-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteTomoDef(self, context)\n        return {'FINISHED'}\n\n# SALVA ARQUIVO TOMOGRAFIA AUTO\n\ndef NomePacienteTomoAutoDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/CT_Scan_Auto-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteTomoAuto(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_tomo_auto\"\n    bl_label = \"Gera Nome Dir Nome Paciente Tomo AUto\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/CT_Scan_Auto-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteTomoAutoDef(self, context)\n        return {'FINISHED'}\n\n# SALVA ARQUIVO MOLDES\n\ndef NomePacienteArcDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Arch-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo com os arcos criado!\")\n\nclass NomePacienteArc(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_arc\"\n    bl_label = \"Gera Nome Dir Nome Paciente Tomo\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Arch-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteArcDef(self, context)\n        return {'FINISHED'}\n\n# REFERENCIAS\n\ndef NomePacienteRefDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Ref-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo com os arcos criado!\")\n\nclass NomePacienteRef(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_ref\"\n    bl_label = \"Gera Nome Dir Nome Paciente Ref\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Ref-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteRefDef(self, context)\n        return {'FINISHED'}\n\n# SEGMENTAÇÃO\n\ndef NomePacienteSegDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Seg-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo com os arcos criado!\")\n\nclass NomePacienteSeg(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_seg\"\n    bl_label = \"Gera Nome Dir Nome Paciente Seg\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Seg-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteSegDef(self, context)\n        return {'FINISHED'}\n\n# FOTOGRAMETRIA\n\ndef NomePacienteFotogramDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Photogram-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo com os arcos criado!\")\n\nclass NomePacienteFotogram(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_fotogram\"\n    bl_label = \"Gera Nome Dir Nome Paciente Fotogram\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Photogram-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteFotogramDef(self, context)\n        return {'FINISHED'}\n\n# ALINHAMENTO\n\ndef NomePacienteAlinhaFaceDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Align_Face-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo com os arcos criado!\")\n\nclass NomePacienteAlinhaFace(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_alinha_face\"\n    bl_label = \"Gera Nome Dir Nome Paciente Alinha Face\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Align_Face-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteAlinhaFaceDef(self, context)\n        return {'FINISHED'}\n\n# ALINHAMENTO FOTO TOMO\n\ndef NomePacienteAlinhaFotoTomoDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Align_Photogram_CT-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo com os arcos criado!\")\n\nclass NomePacienteAlinhaFotoTomo(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_alinha_foto_tomo\"\n    bl_label = \"Gera Nome Dir Nome Paciente Alinha Fotogram Tomo\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Align_Photogram_CT-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteAlinhaFotoTomoDef(self, context)\n        return {'FINISHED'}\n\n# PONTOS CABEÇA\n\ndef NomePacientePointsHeadDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Head-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacientePointsHead(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_points_head\"\n    bl_label = \"Gera Nome Dir Nome Paciente Voxel\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Head-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacientePointsHeadDef(self, context)\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(NomePacientePointsHead)\n\n# PONTOS MAXILA\n\ndef NomePacientePointsMaxillaDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Maxilla-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacientePointsMaxilla(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_points_maxilla\"\n    bl_label = \"Gera Nome Dir Nome Paciente Maxilla\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Maxilla-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacientePointsMaxillaDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacientePointsMaxilla)\n\n# PONTOS MANDÍBULA\n\ndef NomePacientePointsMandibleDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Mandible-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacientePointsMandible(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_points_mandible\"\n    bl_label = \"Gera Nome Dir Nome Paciente Mandible\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Mandible-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacientePointsMandibleDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacientePointsMandible)\n\n# PONTOS DENTES\n\ndef NomePacientePointsTeethDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Teeth-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacientePointsTeeth(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_points_teeth\"\n    bl_label = \"Gera Nome Dir Nome Paciente Teeth\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Teeth-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacientePointsTeethDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacientePointsTeeth)\n\n# PONTOS TECIDO MOLE\n\ndef NomePacientePointsSoftDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Soft-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacientePointsSoft(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_points_soft\"\n    bl_label = \"Gera Nome Dir Nome Paciente Soft\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Points_Soft-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacientePointsSoftDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacientePointsSoft)\n\n# PONTOS OSTEOTOMIA\n\ndef NomePacienteOsteotomyDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Osteotomy-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteOsteotomy(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_osteotomy\"\n    bl_label = \"Gera Nome Dir Nome Paciente Osteotomy\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Osteotomy-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteOsteotomyDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteOsteotomy)\n\n# DINÂMICA\n\ndef NomePacienteDynamicDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Dynamic-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteDynamic(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_dynamic\"\n    bl_label = \"Gera Nome Dir Nome Paciente Dynamic\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Dynamic-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteDynamicDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteDynamic)\n\n# CINEMÁTICA\n\ndef NomePacienteKinematicDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Kinematic-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteKinematic(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_kinematic\"\n    bl_label = \"Gera Nome Dir Nome Paciente Kinematic\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Kinematic-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteKinematicDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteKinematic)\n\n\n# GUIA E SPLINT\n\ndef NomePacienteGuideDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Guide-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteGuide(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_guide\"\n    bl_label = \"Gera Nome Dir Nome Paciente Guide\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Guide-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteGuideDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteGuide)\n\n\ndef NomePacienteMarkersDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Markers-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteMarkers(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_markers\"\n    bl_label = \"Gera Nome Dir Nome Paciente Markers\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Markers-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteMarkersDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteMarkers)\n\n\ndef NomePacienteMusclesDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Muscles-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteMuscles(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_muscles\"\n    bl_label = \"Gera Nome Dir Nome Paciente Muscles\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Muscles-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteMusclesDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteMuscles)\n\n\n\ndef NomePacienteSculptDef(self, context):\n\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n#    scene = context.scene\n#    rd = scene.render\n\n    homeDir = expanduser(\"~\")\n\n    NomePaciente = bpy.context.scene.nome_paciente\n    SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n    if NomePaciente == \"\" and SobrenomePaciente == \"\":\n        bpy.ops.object.dialog_operator_patient_name('INVOKE_DEFAULT')\n\n    else:\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Sculpt-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n        if not os.path.exists(NomePacienteFile):\n            bpy.ops.wm.save_as_mainfile(filepath=NomePacienteFile)\n            print(\"Arquivo da tomografia criado!\")\n\n\nclass NomePacienteSculpt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_dir_nome_paciente_sculpt\"\n    bl_label = \"Gera Nome Dir Nome Paciente Sculpt\"\n\n    @classmethod\n    def poll(cls, context):\n\n#        found = 'Orbital right' in bpy.data.objects\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n    #    scene = context.scene\n    #    rd = scene.render\n\n        homeDir = expanduser(\"~\")\n\n        NomePaciente = bpy.context.scene.nome_paciente\n        SobrenomePaciente = bpy.context.scene.sobrenome_paciente\n\n        NomePacienteFile = str(homeDir+\"/OrtogOnBlenderDir/\"+NomePaciente+\"_\"+SobrenomePaciente+\"/Sculpt-\"+NomePaciente+\"_\"+SobrenomePaciente+\".blend\")\n\n#        if found == False:\n        if not os.path.exists(NomePacienteFile):\n            return True\n        else:\n            if os.path.exists(NomePacienteFile):\n                return False\n\n\n    def execute(self, context):\n        NomePacienteSculptDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(NomePacienteSculpt)\n\n\nbpy.utils.register_class(NomePaciente)\nbpy.utils.register_class(NomePacienteTomo)\nbpy.utils.register_class(NomePacienteTomoAuto)\nbpy.utils.register_class(NomePacienteArc)\nbpy.utils.register_class(NomePacienteRef)\nbpy.utils.register_class(NomePacienteSeg)\nbpy.utils.register_class(NomePacienteFotogram)\nbpy.utils.register_class(NomePacienteAlinhaFace)\nbpy.utils.register_class(NomePacienteAlinhaFotoTomo)\n"
  },
  {
    "path": "OrtogMeshes.py",
    "content": "import bpy\n\nfrom random import randint\nfrom mathutils import Matrix, Vector\n\nfrom bpy.types import (Panel,\n                       Operator,\n                       AddonPreferences,\n                       PropertyGroup,\n                       )\nfrom bpy_extras.object_utils import AddObjectHelper, object_data_add\n\n# LINHA BASE\n\ndef LinhaBaseDef(self, context):\n\n    verts = [Vector((0, 0, 125)),\n             Vector((0, 0, -125)),\n            ]\n\n    edges = [[0,1]]\n\n    faces = []\n\n\n    mesh = bpy.data.meshes.new(name=\"LinhaBase\")\n    mesh.from_pydata(verts, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\nclass LinhaBase(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_linhabase\"\n    bl_label = \"Add Linha Base\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        LinhaBaseDef(self, context)\n\n        return {'FINISHED'}\n\n\ndef CriaMentoDef(self, context):\n\n    verts = [Vector((-34, 22.5, 0)),\n             Vector((34, 22.5, 0)),\n             Vector((34, -22.5, 0)),\n             Vector((-34, -22.5, 0)),\n            ]\n\n    edges = []\n    faces = [[0, 1, 2, 3]]\n\n    mesh = bpy.data.meshes.new(name=\"Mento\")\n    mesh.from_pydata(verts, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\n    bpy.ops.object.modifier_add(type='SOLIDIFY')\n    bpy.context.object.modifiers[\"Solidify\"].thickness = 0.3\n    bpy.context.object.modifiers[\"Solidify\"].offset = 0\n\n    bpy.context.object.show_wire = True\n\n    context = bpy.context\n    activeObject = context.object\n\n    mat = bpy.data.materials.new(name='Mat_'+activeObject.name) #set new material to variable\n    activeObject.data.materials.append(mat) #add the material to the object\n    activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\n\nclass CriaMento(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_mento\"\n    bl_label = \"Add Mento\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaMentoDef(self, context)\n\n        return {'FINISHED'}\n\n\ndef CriaRamoDef(self, context):\n\n    verts = [Vector((0, -22.5, 29.5)),\n             Vector((0, 22.5, 29.5)),\n             Vector((0, 22.5, -29.5)),\n             Vector((0, -22.5, -29.5)),\n            ]\n\n    edges = []\n    faces = [[0, 1, 2, 3]]\n\n    mesh = bpy.data.meshes.new(name=\"Ramo\")\n    mesh.from_pydata(verts, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\n    bpy.ops.object.modifier_add(type='SOLIDIFY')\n    bpy.context.object.modifiers[\"Solidify\"].thickness = 0.3\n    bpy.context.object.modifiers[\"Solidify\"].offset = 0\n\n    bpy.context.object.show_wire = True\n\n    context = bpy.context\n    activeObject = context.object\n\n    mat = bpy.data.materials.new(name='Mat_'+activeObject.name) #set new material to variable\n    activeObject.data.materials.append(mat) #add the material to the object\n    activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\n\nclass CriaRamo(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_ramo\"\n    bl_label = \"Add Ramo\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaRamoDef(self, context)\n\n        return {'FINISHED'}\n\ndef CriaMaxilaDef(self, context):\n\n    verts = [Vector((-34, 30, 0)),\n             Vector((-34, -30, 0)),\n             Vector((-4, -30, 10)),\n             Vector((-4, 30, 10)),\n             Vector((4, 30, 10)),\n             Vector((4, -30, 10)),\n             Vector((34, -30, 0)),\n             Vector((34, 30, 0)),\n            ]\n\n    edges = []\n    faces = [[0, 1, 2, 3],[5,4,3,2],[4, 5, 6, 7]]\n\n    mesh = bpy.data.meshes.new(name=\"Maxila\")\n    mesh.from_pydata(verts, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\n    bpy.ops.object.modifier_add(type='SOLIDIFY')\n    bpy.context.object.modifiers[\"Solidify\"].thickness = 0.3\n    bpy.context.object.modifiers[\"Solidify\"].offset = 0\n\n    bpy.context.object.show_wire = True\n\n    context = bpy.context\n    activeObject = context.object\n\n    mat = bpy.data.materials.new(name='Mat_'+activeObject.name) #set new material to variable\n    activeObject.data.materials.append(mat) #add the material to the object\n    activeObject.active_material.diffuse_color = (randint(20, 100)*.01, randint(20, 100)*.01, randint(20, 100)*.01, 1)\n\n\nclass CriaMaxila(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_maxila\"\n    bl_label = \"Add Maxila\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaMaxilaDef(self, context)\n\n        return {'FINISHED'}\n\n# MALHA ALINHA ORIGEM\n\ndef CriaMeshAlinhOrigDef(self, context):\n\n    context = bpy.context\n\n    vec0 = bpy.data.objects['EMP1a'].location\n    vec1 = bpy.data.objects['EMP2a'].location\n    vec2 = bpy.data.objects['EMP3a'].location\n\n    verts = [Vector((vec0)),\n             Vector((vec1)),\n             Vector((vec2)),\n            ]\n\n    edges = []\n    faces = [[0, 1, 2]]\n\n    mesh = bpy.data.meshes.new(name=\"MeshAlignOrigi\")\n    mesh.from_pydata(verts, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\n\n\nclass CriaMeshAlinhOrig(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_mesh_alinha_origi\"\n    bl_label = \"Add Mesh Align Origin\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaMeshAlinhOrigDef(self, context)\n        bpy.context.object.location[0] = 0\n        bpy.context.object.location[1] = 0\n        bpy.context.object.location[2] = 0\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n\n        return {'FINISHED'}\n\n# MALHA ALINHA ORIGEM\n\ndef CriaMeshAlinhAlinhDef(self, context):\n\n    context = bpy.context\n\n    vec0 = bpy.data.objects['EMP1b'].location\n    vec1 = bpy.data.objects['EMP2b'].location\n    vec2 = bpy.data.objects['EMP3b'].location\n\n    verts = [Vector((vec0)),\n             Vector((vec1)),\n             Vector((vec2)),\n            ]\n\n    edges = []\n    faces = [[0, 1, 2]]\n\n    mesh = bpy.data.meshes.new(name=\"MeshAlignAlign\")\n    mesh.from_pydata(verts, edges, faces)\n    object_data_add(context, mesh, operator=self)\n\n\n\nclass CriaMeshAlinhAlinh(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"mesh.add_mesh_alinha_alinha\"\n    bl_label = \"Add Mesh Align Align\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        CriaMeshAlinhAlinhDef(self, context)\n        bpy.context.object.location[0] = 0\n        bpy.context.object.location[1] = 0\n        bpy.context.object.location[2] = 0\n        bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaMeshAlinhOrig)\nbpy.utils.register_class(CriaMeshAlinhAlinh)\n\n\n\ndef AdicionaPlanosCorteAutoDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    # Plano Maxila\n\n    try:\n        ListaPontos1 = [ 'Orbital right', 'Orbital left', 'A point' ]\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        for i in ListaPontos1:\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n\n\n        # Cursor to selected\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                ctx = bpy.context.copy()\n                ctx['area'] = area\n                ctx['region'] = area.regions[-1]\n        #        bpy.ops.view3d.view_selected(ctx)\n                bpy.ops.view3d.snap_cursor_to_selected(ctx)\n                break\n\n        CursorLoc = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.add_maxila(location=(CursorLoc))\n        bpy.ops.transform.translate(value=(0, 0, -10))\n    except:\n        print(\"Pode estar faltando algum ponto para o plano da Maxila.\")\n\n    # Plano Mento\n\n    try:\n        ListaPontos1 = [ 'B point', 'Me point' ]\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        for i in ListaPontos1:\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n\n\n        # Cursor to selected\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                ctx = bpy.context.copy()\n                ctx['area'] = area\n                ctx['region'] = area.regions[-1]\n        #        bpy.ops.view3d.view_selected(ctx)\n                bpy.ops.view3d.snap_cursor_to_selected(ctx)\n                break\n\n        CursorLoc = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.add_mento(location=(CursorLoc))\n    except:\n        print(\"Pode estar faltando algum ponto para o plano do Mento.\")\n\n    # Ramo Esquerdo\n\n    try:\n        ListaPontos1 = [ 'Tooth 19', 'Go left' ]\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        for i in ListaPontos1:\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n\n\n        # Cursor to selected\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                ctx = bpy.context.copy()\n                ctx['area'] = area\n                ctx['region'] = area.regions[-1]\n        #        bpy.ops.view3d.view_selected(ctx)\n                bpy.ops.view3d.snap_cursor_to_selected(ctx)\n                break\n\n        CursorLoc = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.add_ramo(location=(CursorLoc))\n    except:\n        print(\"Pode estar faltando algum ponto para o plano do Ramo Esquerdo.\")\n\n\n    # Ramo Direito\n\n    try:\n        ListaPontos1 = [ 'Tooth 30', 'Go right' ]\n\n        bpy.ops.object.select_all(action='DESELECT')\n\n        for i in ListaPontos1:\n            bpy.data.objects[i].select_set(True)\n            context.view_layer.objects.active = bpy.data.objects[i]\n\n\n        # Cursor to selected\n\n        for area in bpy.context.screen.areas:\n            if area.type == 'VIEW_3D':\n                ctx = bpy.context.copy()\n                ctx['area'] = area\n                ctx['region'] = area.regions[-1]\n        #        bpy.ops.view3d.view_selected(ctx)\n                bpy.ops.view3d.snap_cursor_to_selected(ctx)\n                break\n\n        CursorLoc = bpy.context.scene.cursor.location\n\n        bpy.ops.mesh.add_ramo(location=(CursorLoc))\n    except:\n        print(\"Pode estar faltando algum ponto para o plano do Ramo Direito.\")\n\n    bpy.ops.wm.tool_set_by_id(name=\"builtin.move\")\n\nclass AdicionaPlanosCorteAuto(Operator, AddObjectHelper):\n    \"\"\"Create a new Mesh Object\"\"\"\n    bl_idname = \"object.adiciona_planos_corte_auto\"\n    bl_label = \"Add Cut Planes Auto\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n\n        AdicionaPlanosCorteAutoDef()\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(AdicionaPlanosCorteAuto)\n"
  },
  {
    "path": "OtherOnBlender.py",
    "content": "import bpy\nimport platform\nfrom .__init__ import *\nfrom .Version import *\nfrom .FerrSegmentacao import *\nfrom .CortaOssoFibula import *\nfrom .TomoReconsRapida import * # Apagar!\nfrom .DesenhaObjetos import *\nfrom .Poisson import *\nfrom .DesenhaObjetos import *\n\nclass OTHER_PT_AtualizaAddonSec(bpy.types.Panel):\n    bl_label = \"Upgrade Script\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"VERSION: \"+VERSION)\n\n        row = layout.row()\n        row.operator(\"object.atualiza_script\", text=\"UPGRADE OTHERTOOLS!\", icon=\"RECOVER_LAST\")\n\n\n\nbpy.utils.register_class(OTHER_PT_AtualizaAddonSec)\n\n\nclass OTHER_PT_Converte_Video(bpy.types.Panel):\n    bl_label = \"Video to Images\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathvideo\", text=\"\")\n\n\n        if platform.system() == \"Linux\":\n\n            row = layout.row()\n            row.operator(\"object.converte_video_imagem\", text=\"Convert Video to Images!\", icon=\"RENDER_STILL\")\n\n\n        if platform.system() == \"Windows\":\n\n            row = layout.row()\n            row.operator(\"object.converte_video_imagem_win\", text=\"Convert Video to Images!\", icon=\"RENDER_STILL\")\n\nbpy.utils.register_class(OTHER_PT_Converte_Video)\n\n\nclass OTHER_PT_Converte_Img_Tomo(bpy.types.Panel):\n    bl_label = \"Images to CT-Scan\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"path_slices_img\", text=\"\")\n\n        row = layout.row()\n        row.label(text=\"Dimensions:\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"S1\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"S2\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"S3\")\n\n        row = layout.row()\n        row.operator(\"object.converte_imagens_tomo\", text=\"Convert Images to CT-Scan!\", icon=\"RENDER_STILL\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Calculations:\")\n\n        row = layout.row(align = True)\n        row.label(text=\"Real Size:\")\n        row.prop(context.scene, \"MedidaRealDCM\")\n\n        row = layout.row(align = True)\n        row.label(text=\"Current Size:\")\n        row.prop(context.scene, \"MedidaAtualDCM\")\n\n        row = layout.row()\n        row.operator(\"object.calcula_dimensao_dcm\", text=\"Calculate!\", icon=\"RENDER_STILL\")\n\n        row = layout.row(align = True)\n        row.label(text=\"Scale Factor:\")\n        row.prop(context.scene, \"FatorEscalaDCM\")\n\n        row = layout.row()\n        row.label(text=\"Convert MHA to DCM:\")\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathmha\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.abre_slicer_mha\", text=\"Open Slicer\", icon=\"RENDER_STILL\")\n\n\nbpy.utils.register_class(OTHER_PT_Converte_Img_Tomo)\n\n\nbpy.types.Scene.S1 = bpy.props.StringProperty \\\n  (\n    name = \"s1\",\n    description = \"s1\",\n    default = \"1\"\n  )\n\n\nbpy.types.Scene.S2 = bpy.props.StringProperty \\\n  (\n    name = \"s2\",\n    description = \"s2\",\n    default = \"1\"\n  )\n\nbpy.types.Scene.S3 = bpy.props.StringProperty \\\n(\n name = \"s3\",\n description = \"s3\",\n default = \"1\"\n)\n\nbpy.types.Scene.FatorEscalaDCM = bpy.props.StringProperty \\\n(\n name = \"\",\n description = \"Scale Factor\",\n default = \"NONE\"\n)\n\nbpy.types.Scene.MedidaRealDCM = bpy.props.StringProperty \\\n(\n name = \"\",\n description = \"Real Size\",\n default = \"NONE\"\n)\n\nbpy.types.Scene.MedidaAtualDCM = bpy.props.StringProperty \\\n(\n name = \"\",\n description = \"Current Measure\",\n default = \"NONE\"\n)\n\n\nclass OTHER_PT_Objeto_para_Dicom(bpy.types.Panel):\n    bl_label = \"3D Object to CT-Scan\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        row = layout.row()\n#        row.label(text=\"Dimensions:\")\n\n#       Add Volume Area\n\n        row = layout.row()\n        row.label(text=\"Setup Structure:\")\n\n        row = layout.row()\n        row.operator(\"object.importa_voxelcube\", text=\"Import VoxelCube\", icon=\"MESH_CUBE\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.cria_voxelcube_planos\", text=\"Create VoxelCube Planes\", icon=\"SNAP_VOLUME\")\n\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_geral\", text=\"Difference\", icon=\"MOD_BOOLEAN\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_union\", text=\"Union\", icon=\"MOD_CAST\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_inter\", text=\"Intersect\", icon=\"MOD_MASK\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_union_multipla\", text=\"MULTIPLE UNION\", icon=\"STICKY_UVS_LOC\")\n\n\n        row = layout.row()\n        row.label(text=\"Convert 3D to Voxel:\")\n\n        row = layout.row()\n        row.label(text=\"1) Import VoxelCube.\")\n\n        row = layout.row()\n        row.label(text=\"2) Select one or more objects.\")\n\n        row = layout.row()\n        row.operator(\"object.converte_3d_voxel\", text=\"Convert to DICOM!\", icon=\"ALEMBIC\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Convert MHA to DICOM:\")\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathmha\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.abre_slicer_mha\", text=\"Open Slicer\", icon=\"RENDER_STILL\")\n\nbpy.utils.register_class(OTHER_PT_Objeto_para_Dicom)\n\n\nclass OTHER_PT_Cut_Points(bpy.types.Panel):\n    bl_label = \"Cut Points\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        row = layout.row()\n#        row.label(text=\"Dimensions:\")\n\n#       Add Volume Area\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.operator(\"object.cut_point_pt\", text=\"Add Cut Point\", icon=\"NODE_MATERIAL\")\n\n        row = layout.row()\n        if context.window_manager.measureit_run_opengl is False:\n            icon = 'PLAY'\n            txt = 'Show'\n        else:\n            icon = \"PAUSE\"\n            txt = 'Hide'\n        row.operator(\"measureit.runopengl\", text=txt, icon=icon)\n        row.prop(scn, \"measureit_gl_ghost\", text=\"\", icon='GHOST_ENABLED')\n\n        row = layout.row()\n        row.operator(\"object.cria_cotas_botao\", text=\"Create Measures\", icon=\"TRACKING_FORWARDS_SINGLE\")\n\n\n        row = layout.row()\n        row.operator(\"object.cria_bones_fibula\", text=\"Create Bones\", icon=\"BONE_DATA\")\n\n\n\nbpy.utils.register_class(OTHER_PT_Cut_Points)\n\n'''\nclass OTHER_PT_TomoReconRapida(bpy.types.Panel):\n    bl_label = \"CT-Scan Fast Reconstruction\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"path\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.gera_modelotomo_rec_rapida\", text=\"CT-Scan Fast Recon\", icon=\"NODE_MATERIAL\")\n\nbpy.utils.register_class(OTHER_PT_TomoReconRapida)\n'''\n\nclass OTHER_PT_Vein(bpy.types.Panel):\n    bl_label = \"Vein and Nerves\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        row = layout.row()\n#        row.label(text=\"Dimensions:\")\n\n#       Add Volume Area\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.operator(\"mesh.add_ponto_veia\", text=\"Create Point\", icon=\"NODE_MATERIAL\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_veia\", text=\"Create Vein or Nerve\", icon=\"OUTLINER_OB_CURVE\")\n\n\nbpy.utils.register_class(OTHER_PT_Vein)\n\n\ndef CriaSplintDentesPintaDef():\n\n    # Grava a arcada selecionada\n    context = bpy.context\n    objArcada = context.active_object\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    # Cria Metabal\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.ops.object.metaball_add(type='BALL', radius=1, view_align=False, enter_editmode=False, location=(0,0,0))\n    objMetaball = context.active_object\n\n    # Seleciona a arcada\n    bpy.ops.object.select_all(action='DESELECT')\n    objArcada.select_set(True)\n    bpy.context.view_layer.objects.active = objArcada\n\n\n    # Adiciona partícula\n    bpy.ops.object.particle_system_add()\n    #bpy.data.particles.new(\"Espessura\")\n    bpy.data.particles[\"ParticleSettings\"].type = 'HAIR'\n    bpy.context.object.particle_systems[\"ParticleSettings\"].vertex_group_density = \"Group\"\n    bpy.data.particles[\"ParticleSettings\"].render_type = 'OBJECT'\n    bpy.data.particles[\"ParticleSettings\"].instance_object = bpy.data.objects[\"Mball\"]\n    bpy.data.particles[\"ParticleSettings\"].particle_size = 0.4\n    bpy.data.particles[\"ParticleSettings\"].name = \"DELETE\"\n\n    # Seleciona MBall\n    bpy.ops.object.select_all(action='DESELECT')\n    objMetaball.select_set(True)\n    bpy.context.view_layer.objects.active = objMetaball\n    objMetaball.name = \"Splint_Offset\"\n    objMetaball.name = \"Splint_Offset\"\n\n    # Converte MBall em malha\n    bpy.ops.object.convert(target='MESH')\n\n    bpy.context.view_layer.objects.active = bpy.data.objects[\"Splint_Offset.001\"]\n    bpy.data.objects[\"Splint_Offset.001\"].select_set(True)\n    bpy.data.objects[\"Splint_Offset.001\"].name = \"Splint_Offset_final\"\n\n\n    # Modificador Smooth\n    bpy.ops.object.modifier_add(type='SMOOTH')\n    bpy.context.object.modifiers[\"Smooth\"].factor = 2\n    bpy.context.object.modifiers[\"Smooth\"].iterations = 30\n\n    # Modificador Remesh\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 7\n\n    # Converte malha\n    bpy.ops.object.convert(target='MESH')\n\n\nclass CriaSplintDentesPinta(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cria_splint_dentes_pinta\"\n    bl_label = \"Create Teeth Offset\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        CriaSplintDentesPintaDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CriaSplintDentesPinta)\n\n\nclass OTHER_PT_PintaOffset(bpy.types.Panel):\n    bl_label = \"Offset Splint\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Create Offset:\")\n\n        row = layout.row()\n        row.operator(\"object.weight_1\", text=\"Weight Paint 1\", icon=\"COLORSET_01_VEC\")\n\n        row = layout.row()\n        row.operator(\"object.weight_0\", text=\"Weight Paint 0\", icon=\"COLORSET_04_VEC\")\n\n        row = layout.row()\n        row.operator(\"object.cria_splint_dentes_pinta\", text=\"Create Offset!\", icon=\"MOD_SKIN\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Boolean Segmentation:\")\n\n        row = layout.row()\n#        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n        row.operator(\"object.linha_corte_fora_a_fora\", icon='LINE_DATA', text=\"Draw Line\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_dentro\", text=\"Subtract IN\", icon=\"LIGHTPROBE_CUBEMAP\")\n\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_fora\", text=\"Subtract OUT\", icon=\"MESH_CUBE\")\n\n        row = layout.row()\n        row.label(text=\"Boolean:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_geral\", text=\"Difference\", icon=\"MOD_BOOLEAN\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_union\", text=\"Union\", icon=\"MOD_CAST\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_inter\", text=\"Intersect\", icon=\"MOD_MASK\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.booleana_union_multipla\", text=\"MULTIPLE UNION\", icon=\"STICKY_UVS_LOC\")\n\nbpy.utils.register_class(OTHER_PT_PintaOffset)\n\nclass OTHER_PT_MicrosXYZ(bpy.types.Panel):\n    bl_label = \"Atomic Force Microscope\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Others\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        row = layout.row()\n#        row.label(text=\"Convert MHA to DCM:\")\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathmha\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.importa_reconstroi_xyz\", text=\"Import and Reconstruct XYZ\", icon=\"OVERLAY\")\n\n        row = layout.row()\n        row.label(text=\"Draw & Cut:\")\n\n        row = layout.row()\n        row.operator(\"wm.modal_cria_pontos_micros\", icon='CURVE_DATA', text=\"Create Points\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_unido\", icon='CURVE_BEZCIRCLE', text=\"Create Bezier Line\")\n\n        row = layout.row()\n        circle=row.operator(\"object.segmenta_desenho_micros\", text=\"Cut Line!\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        row.operator(\"object.fecha_buraco_todos\", icon='MOD_TRIANGULATE', text=\"Close All Holes\")\n\n\nbpy.utils.register_class(OTHER_PT_MicrosXYZ)\n"
  },
  {
    "path": "Poisson.py",
    "content": "import bpy\nimport tempfile\nimport platform\nimport subprocess\nimport shutil\n\ndef PoissonDef(self, context):\n\n    tmpdir = tempfile.mkdtemp()\n\n    bpy.ops.object.modifier_add(type='SUBSURF')\n    bpy.context.object.modifiers[\"Subdivision\"].levels = 1\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Subdivision\")\n    #bpy.ops.object.convert(target='MESH')\n\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.mesh.select_all(action='SELECT')\n    bpy.ops.mesh.delete(type='EDGE_FACE')\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.wm.collada_export(filepath=tmpdir+\"/Pontos.dae\", selected=True)\n\n    if platform.system() == \"Linux\":\n        subprocess.call('meshlabserver -i '+tmpdir+'/Pontos.dae -o '+tmpdir+'/Poisson.ply -s ~/Programs/OrtogOnBlender/Meshlab/Poisson.mlx -om vc fq wn', shell=True)\n\n    bpy.ops.object.delete(use_global=False)\n\n\n    bpy.ops.import_mesh.ply(filepath=tmpdir+\"/Poisson.ply\", files=[], directory=\"\", filter_glob=\"*.ply\")\n\nclass Poisson(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"mesh.poisson\"\n    bl_label = \"Ortog Poisson\"\n\n    def execute(self, context):\n       PoissonDef(self, context)\n       return {'FINISHED'}\n\nbpy.utils.register_class(Poisson)\n\ndef ReconstXYZDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    tmpdir = tempfile.mkdtemp()\n\n    dirScript = bpy.utils.user_resource('SCRIPTS')\n\n    shutil.copyfile(scn.my_tool.filepathmha, tmpdir+\"/file.xyz\")\n\n\n    if platform.system() == \"Linux\":\n        subprocess.call('meshlabserver -i '+tmpdir+'/file.xyz -o '+tmpdir+'/ObjectXYZ.ply -s '+dirScript+'addons/OrtogOnBlender-master/MicrosGenerate3D.mlx -om', shell=True)\n\n    #bpy.ops.object.delete(use_global=False)\n\n    bpy.ops.import_mesh.ply(filepath=tmpdir+\"/ObjectXYZ.ply\", files=[], directory=\"\", filter_glob=\"*.ply\")\n\n    bpy.context.space_data.shading.type = 'SOLID'\n    bpy.context.space_data.shading.show_shadows = True\n    bpy.context.space_data.shading.show_cavity = True\n    bpy.context.space_data.shading.cavity_valley_factor = 2.5\n    bpy.context.space_data.shading.cavity_ridge_factor = 2.5\n    bpy.context.space_data.shading.cavity_type = 'BOTH'\n    bpy.context.space_data.shading.curvature_valley_factor = 0.604167\n    bpy.context.space_data.shading.shadow_intensity = 0.884375\n\n    bpy.context.scene.display.matcap_ssao_distance = 0.53 # Funciona!\n#    bpy.context.scene.matcap_ssao_distance = 0.53 # Não funciona!\n#    bpy.context.scene.matcap_ssao_attenuation = 1\n\n    bpy.context.scene.display.light_direction = (0.666667, 0.319444, 0.673432)\n    bpy.context.scene.display.shadow_focus = 0.270833\n#    bpy.context.scene.light_direction = (0.666667, 0.319444, 0.673432)\n#    bpy.context.scene.shadow_focus = 0.270833\n\n    bpy.ops.view3d.view_selected(use_all_regions=False)\n\n\nclass ReconstXYZ(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.importa_reconstroi_xyz\"\n    bl_label = \"Import and Reconstruc XYZ\"\n\n    def execute(self, context):\n       ReconstXYZDef()\n       return {'FINISHED'}\n\nbpy.utils.register_class(ReconstXYZ)\n"
  },
  {
    "path": "PontosAnatomicos.py",
    "content": "import bpy\nimport bmesh\nfrom math import sqrt\nimport fnmatch\n\n# OCULTAR MOSTRAR Pontos\n\ndef PontosMostraNomesDef(self, context):\n\n    ListaPontosNomesShow = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left', 'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30', 'Condylar Process right', 'Condylar Process left', 'Coronoid Process left', 'Coronoid Process right', 'Mid Go-Ramus Fracure left', 'Mid Go-Ramus Fracure right', 'Mid Upper Incisors', 'Mid Mandibula Angle left', 'Mid Mandibula Angle right', 'Radix', 'Anterior Nostril left', 'Posterior Nostril left', 'Anterior Nostril right', 'Posterior Nostril right', 'Rhinion', 'Alar Groove right', 'Alar Groove left', 'Supratip', 'Infratip Lobule', 'Columella right', 'Columella left', 'Alar Rim right', 'Alar Rim left', 'Medial Canthus left', 'Medial Canthus right', 'Lateral Canthus left', 'Lateral Canthus right', 'Trichion', 'Submental', 'Supraglabella', 'Glabella', 'Condyle Rotation Point', 'Pronasale digi', 'Exocanthus-Alar Base right digi', 'Exocanthus-Alar Base left digi', 'Cheek right digi', 'Cheek left digi', 'Alar Base right digi', 'Alar Base left digi', 'Subnasale digi', 'Cheilion-Alar Base right digi', 'Cheilion-Alar Base left digi', 'Cupid\\'s Bow right digi', 'Cupid\\'s Bow left digi', 'Cheilion right digi', 'Cheilion left digi', 'Lower Lip digi', 'B point soft digi', 'Pogonion soft digi', 'Pronasale real', 'Exocanthus-Alar Base right real', 'Exocanthus-Alar Base left real', 'Cheek right real', 'Cheek left real', 'Alar Base right real', 'Alar Base left real', 'Subnasale real', 'Cheilion-Alar Base right real', 'Cheilion-Alar Base left real', 'Cupid\\'s Bow right real', 'Cupid\\'s Bow left real', 'Cheilion right real', 'Cheilion left real', 'Lower Lip real', 'B point soft real', 'Pogonion soft real', 'Alar Cheek Groove right', 'Alar Cheek Groove left']\n\n    for i in ListaPontosNomesShow:\n        try:\n\n            bpy.data.objects[i].show_name = True\n\n        except:\n            print(\"Ponto\", i, \"ausente!\")\n\nclass PontosMostraNomes(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pontos_mostra_nomes\"\n    bl_label = \"Show Anat. Points\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        PontosMostraNomesDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(PontosMostraNomes)\n\ndef PontosOcultaNomesDef(self, context):\n\n    ListaPontosNomesShow = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left', 'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30', 'Condylar Process right', 'Condylar Process left', 'Coronoid Process left', 'Coronoid Process right', 'Mid Go-Ramus Fracure left', 'Mid Go-Ramus Fracure right', 'Mid Upper Incisors', 'Mid Mandibula Angle left', 'Mid Mandibula Angle right', 'Radix', 'Anterior Nostril left', 'Posterior Nostril left', 'Anterior Nostril right', 'Posterior Nostril right', 'Rhinion', 'Alar Groove right', 'Alar Groove left', 'Supratip', 'Infratip Lobule', 'Columella right', 'Columella left', 'Alar Rim right', 'Alar Rim left', 'Medial Canthus left', 'Medial Canthus right', 'Trichion', 'Submental', 'Supraglabella', 'Glabella', 'Condyle Rotation Point', 'Pronasale digi', 'Exocanthus-Alar Base right digi', 'Exocanthus-Alar Base left digi', 'Cheek right digi', 'Cheek left digi', 'Alar Base right digi', 'Alar Base left digi', 'Subnasale digi', 'Cheilion-Alar Base right digi', 'Cheilion-Alar Base left digi', 'Cupid\\'s Bow right digi', 'Cupid\\'s Bow left digi', 'Cheilion right digi', 'Cheilion left digi', 'Lower Lip digi', 'B point soft digi', 'Pogonion soft digi', 'Pronasale real', 'Exocanthus-Alar Base right real', 'Exocanthus-Alar Base left real', 'Cheek right real', 'Cheek left real', 'Alar Base right real', 'Alar Base left real', 'Subnasale real', 'Cheilion-Alar Base right real', 'Cheilion-Alar Base left real', 'Cupid\\'s Bow right real', 'Cupid\\'s Bow left real', 'Cheilion right real', 'Cheilion left real', 'Lower Lip real', 'B point soft real', 'Pogonion soft real', 'Alar Cheek Groove right', 'Alar Cheek Groove left', 'Lateral Canthus left', 'Lateral Canthus right']\n\n    for i in ListaPontosNomesShow:\n        try:\n            bpy.data.objects[i].show_name = False\n\n        except:\n            print(\"Ponto\", i, \"ausente!\")\n\nclass PontosOcultaNomes(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pontos_oculta_nomes\"\n    bl_label = \"Hide Anat. Points\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        PontosOcultaNomesDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(PontosOcultaNomes)\n\n\ndef TestaPontoCollDef():\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n    #Teste se há algum objeto ponto na cena aqui!\n    ListaPontos = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left', 'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30', 'Condylar Process right', 'Condylar Process left', 'Coronoid Process left', 'Coronoid Process right', 'Mid Go-Ramus Fracure left', 'Mid Go-Ramus Fracure right', 'Mid Upper Incisors', 'Mid Mandibula Angle left', 'Mid Mandibula Angle right', 'Radix', 'Anterior Nostril left', 'Posterior Nostril left', 'Anterior Nostril right', 'Posterior Nostril right', 'Rhinion', 'Alar Groove right', 'Alar Groove left', 'Supratip', 'Infratip Lobule', 'Columella right', 'Columella left', 'Alar Rim right', 'Alar Rim left', 'Medial Canthus left', 'Medial Canthus right', 'Trichion', 'Submental', 'Supraglabella', 'Glabella', 'Condyle Rotation Point', 'Pronasale digi', 'Exocanthus-Alar Base right digi', 'Exocanthus-Alar Base left digi', 'Cheek right digi', 'Cheek left digi', 'Alar Base right digi', 'Alar Base left digi', 'Subnasale digi', 'Cheilion-Alar Base right digi', 'Cheilion-Alar Base left digi', 'Cupid\\'s Bow right digi', 'Cupid\\'s Bow left digi', 'Cheilion right digi', 'Cheilion left digi', 'Lower Lip digi', 'B point soft digi', 'Pogonion soft digi', 'Pronasale real', 'Exocanthus-Alar Base right real', 'Exocanthus-Alar Base left real', 'Cheek right real', 'Cheek left real', 'Alar Base right real', 'Alar Base left real', 'Subnasale real', 'Cheilion-Alar Base right real', 'Cheilion-Alar Base left real', 'Cupid\\'s Bow right real', 'Cupid\\'s Bow left real', 'Cheilion right real', 'Cheilion left real', 'Lower Lip real', 'B point soft real', 'Pogonion soft real', 'Alar Cheek Groove right', 'Alar Cheek Groove left', 'Lateral Canthus left', 'Lateral Canthus right']\n\n\n    ObjetosColletion = bpy.data.collections['Collection'].objects\n\n    for i in ObjetosColletion:\n        if i.name in ListaPontos:\n#            print(\"HÁ O NOME!\", i.name)\n            objColletion = bpy.data.objects[i.name]\n            bpy.data.collections['Collection'].objects.unlink(objColletion)\n\n\n\ndef CriaPontoDef(nome, colecao):\n\n    context = bpy.context\n    obj = context.active_object\n    scn = context.scene\n\n\n#    bpy.ops.object.empty_add(type='PLAIN_AXES')\n#    bpy.context.object.name = \"EMP1a\"\n#    bpy.context.object.empty_draw_size = 3\n#    bpy.context.object.empty_display_size = 3\n\n    bpy.ops.mesh.primitive_uv_sphere_add(radius=1)\n    bpy.context.object.name = nome\n    bpy.context.object.show_name = True\n\n\n    # MATERIAL\n\n    ListaMateriais = []\n    MateriaisCena = bpy.data.materials\n\n    for i in MateriaisCena:\n        ListaMateriais.append(i.name)\n\n    if 'MatAnatPoints' in ListaMateriais:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials[\"MatAnatPoints\"] #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.45, 0.0, 0.9, 1)\n    else:\n        activeObject = bpy.context.active_object #Set active object to variable\n        mat = bpy.data.materials.new(name=\"MatAnatPoints\") #set new material to variable\n        activeObject.data.materials.append(mat) #add the material to the object\n        bpy.context.object.active_material.diffuse_color = (0.45, 0.0, 0.9, 1)\n\n\n    # COLEÇÃO\n    # Copia para a coleção determinada\n\n    ListaColecoes = []\n    ColocoesCena =  bpy.data.collections\n\n    for i in ColocoesCena:\n        ListaColecoes.append(i.name)\n\n    if colecao in ListaColecoes:\n        bpy.ops.object.collection_link(collection=colecao)\n#        bpy.data.collections['Collection'].objects.unlink(obj)\n    else:\n        myCol = bpy.data.collections.new(colecao)\n        bpy.context.scene.collection.children.link(myCol)\n        bpy.ops.object.collection_link(collection=colecao)\n#        bpy.data.collections['Collection'].objects.unlink(obj)\n\n\n# CABEÇA\n\nclass Orbital_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.orbital_right_pt\"\n    bl_label = \"Orbital right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Orbital right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Orbital right', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Orbital_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.orbital_left_pt\"\n    bl_label = \"Orbital left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Orbital left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Orbital left', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass N_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.n_pt\"\n    bl_label = \"N point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'N point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('N point', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Po_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.po_right\"\n    bl_label = \"Po right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Po right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Po right', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Po_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.po_left\"\n    bl_label = \"Po left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Po left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Po left', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Pt_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pt_right\"\n    bl_label = \"Pt right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Pt right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Pt right', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Pt_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pt_left\"\n    bl_label = \"Pt left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Pt left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Pt left', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Ba_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ba_pt\"\n    bl_label = \"Ba point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Ba point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Ba point', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass S_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.s_pt\"\n    bl_label = \"S point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'S point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('S point', 'Anatomical Points - Head')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\n# MAXILA\n\nclass U1_Tip_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.u1_tip_pt\"\n    bl_label = \"U1 Tip\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'U1 Tip' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('U1 Tip', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass U1_LabGenBor_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.u1_labgenbor_pt\"\n    bl_label = \"U1 Labial Gengival Border\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'U1 Labial Gengival Border' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('U1 Labial Gengival Border', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass U1_LinGenBor_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.u1_lingenbor_pt\"\n    bl_label = \"U1 Lingual Gengival Border\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'U1 Lingual Gengival Border' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('U1 Lingual Gengival Border', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass M_U6_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.m_u6_pt\"\n    bl_label = \"M U6\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'M U6' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('M U6', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass D_U6_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.d_u6_pt\"\n    bl_label = \"D U6\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'D U6' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('D U6', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass U6_Occlusal_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.u6_occlusal_pt\"\n    bl_label = \"U6 Occlusal\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'U6 Occlusal' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('U6 Occlusal', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass PNS_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pns_pt\"\n    bl_label = \"PNS point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'PNS point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('PNS point', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass A_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.a_pt\"\n    bl_label = \"A point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'A point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('A point', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass ANS_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ans_pt\"\n    bl_label = \"ANS point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ANS point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ANS point', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass U1_Root_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.u1_root_pt\"\n    bl_label = \"U1 Root\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'U1 Root' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('U1 Root', 'Anatomical Points - Maxilla')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\n# MANDÍBULA\n\nclass L1_Tip_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.l1_tip_pt\"\n    bl_label = \"L1 Tip\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'L1 Tip' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('L1 Tip', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass L1_Root_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.l1_root_pt\"\n    bl_label = \"L1 Root\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'L1 Root' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('L1 Root', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass L1_LabGenBor_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.l1_labgenbor_pt\"\n    bl_label = \"L1 Labial Gengival Border\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'L1 Labial Gengival Border' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('L1 Labial Gengival Border', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass L1_LinGenBor_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.l1_lingenbor_pt\"\n    bl_label = \"L1 Lingual Gengival Border\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'L1 Lingual Gengival Border' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('L1 Lingual Gengival Border', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass B_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.b_pt\"\n    bl_label = \"B point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'B point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('B point', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass M_L6_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.m_l6_pt\"\n    bl_label = \"M L6\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'M L6' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('M L6', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass L6_Occlusal_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.l6_occlusal_pt\"\n    bl_label = \"L6 Occlusal\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'L6 Occlusal' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('L6 Occlusal', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass D_L6_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.d_l6_pt\"\n    bl_label = \"D L6\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'D L6' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('D L6', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass MidRamusRight_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mid_ramus_right_pt\"\n    bl_label = \"Mid Ramus right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Ramus right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Mid Ramus right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass MidRamusLeft_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mid_ramus_left_pt\"\n    bl_label = \"Mid Ramus left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Ramus left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Mid Ramus left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass R_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.r_right_pt\"\n    bl_label = \"R right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'R right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('R right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass R_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.r_left_pt\"\n    bl_label = \"R left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'R left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('R left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Go_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.go_right_pt\"\n    bl_label = \"Go right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Go right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Go right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Go_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.go_left_pt\"\n    bl_label = \"Go left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Go left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Go left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Ar_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ar_right_pt\"\n    bl_label = \"Ar right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Ar right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Ar right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Ar_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ar_left_pt\"\n    bl_label = \"Ar left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Ar left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Ar left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Sigmoid_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.sigmoid_right_pt\"\n    bl_label = \"Sigmoid right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Sigmoid right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Sigmoid right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Sigmoid_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.sigmoid_left_pt\"\n    bl_label = \"Sigmoid left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Sigmoid left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Sigmoid left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Co_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.co_right_pt\"\n    bl_label = \"Co right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Co right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Co right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Co_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.co_left_pt\"\n    bl_label = \"Co left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Co left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Co left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Pg_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.pg_pt\"\n    bl_label = \"Pg point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Pg point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Pg point', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Gn_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gn_pt\"\n    bl_label = \"Gn point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Gn point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Gn point', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nclass Me_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.me_pt\"\n    bl_label = \"Me point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Me point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Me point', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\n\nclass Condylar_Process_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.condylar_process_left_pt\"\n    bl_label = \"Condylar Process left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Condylar Process left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Condylar Process left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Condylar_Process_left_pt)\n\n\nclass Condylar_Process_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.condylar_process_right_pt\"\n    bl_label = \"Condylar Process right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Condylar Process right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Condylar Process right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Condylar_Process_right_pt)\n\n\nclass Coronoid_Process_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.coronoid_process_left_pt\"\n    bl_label = \"Coronoid Process left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Coronoid Process left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Coronoid Process left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Coronoid_Process_left_pt)\n\n\nclass Coronoid_Process_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.coronoid_process_right_pt\"\n    bl_label = \"Coronoid Process right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Coronoid Process right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Coronoid Process right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Coronoid_Process_right_pt)\n\n\nclass Go_Ramus_Fracure_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.go_ramus_fracure_left_pt\"\n    bl_label = \"Mid Go-Ramus Fracure left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Go-Ramus Fracure left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Mid Go-Ramus Fracure left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Go_Ramus_Fracure_left_pt)\n\n\nclass Go_Ramus_Fracure_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.go_ramus_fracure_right_pt\"\n    bl_label = \"Mid Go-Ramus Fracure right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Go-Ramus Fracure right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Mid Go-Ramus Fracure right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Go_Ramus_Fracure_right_pt)\n\n\nclass Mid_Mandibula_Angle_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mid_mandibula_angle_left_pt\"\n    bl_label = \"Mid Mandibula Angle left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Mandibula Angle left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Mid Mandibula Angle left', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Mid_Mandibula_Angle_left_pt)\n\nclass Mid_Mandibula_Angle_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mid_mandibula_angle_right_pt\"\n    bl_label = \"Mid Mandibula Angle right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Mandibula Angle right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Mid Mandibula Angle right', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Mid_Mandibula_Angle_right_pt)\n\n\nclass Mid_Upper_Incisors_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mid_upper_incisors_pt\"\n    bl_label = \"Mid Upper Incisors\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Mid Upper Incisors' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Mid Upper Incisors', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Mid_Upper_Incisors_pt)\n\n\n# DENTES\n\nclass Tooth_8_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_8_pt\"\n    bl_label = \"Tooth 8\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 8' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 8', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_8_pt)\n\nclass Tooth_9_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_9_pt\"\n    bl_label = \"Tooth 9\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 9' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 9', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_9_pt)\n\nclass Tooth_6_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_6_pt\"\n    bl_label = \"Tooth 6\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 6' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 6', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_6_pt)\n\nclass Tooth_11_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_11_pt\"\n    bl_label = \"Tooth 11\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 11' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 11', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_11_pt)\n\nclass Tooth_3_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_3_pt\"\n    bl_label = \"Tooth 3\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 3' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 3', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_3_pt)\n\nclass Tooth_14_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_14_pt\"\n    bl_label = \"Tooth 14\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 14' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 14', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_14_pt)\n\nclass Tooth_24_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_24_pt\"\n    bl_label = \"Tooth 24\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 24' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 24', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_24_pt)\n\nclass Tooth_25_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_25_pt\"\n    bl_label = \"Tooth 25\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 25' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 25', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_25_pt)\n\nclass Tooth_22_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_22_pt\"\n    bl_label = \"Tooth 22\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 22' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 22', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_22_pt)\n\nclass Tooth_27_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_27_pt\"\n    bl_label = \"Tooth 27\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 27' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 27', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_27_pt)\n\nclass Tooth_19_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_19_pt\"\n    bl_label = \"Tooth 19\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 19' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 19', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_19_pt)\n\nclass Tooth_30_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tooth_30_pt\"\n    bl_label = \"Tooth 30\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tooth 30' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tooth 30', 'Anatomical Points - Teeth')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tooth_30_pt)\n\n\n# TECIDO MOLE\n\nclass ST_Glabella_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_glabella_pt\"\n    bl_label = \"ST Glabella\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST Glabella' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST Glabella', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_Glabella_pt)\n\n\nclass ST_Nasion_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_nasion_pt\"\n    bl_label = \"ST Nasion\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST Nasion' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST Nasion', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_Nasion_pt)\n\nclass Bridge_Nose_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.bridge_nose_pt\"\n    bl_label = \"Bridge of Nose\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Bridge of Nose' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Bridge of Nose', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Bridge_Nose_pt)\n\nclass Tip_Nose_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.tip_nose_pt\"\n    bl_label = \"Tip of Nose\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Tip of Nose' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Tip of Nose', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Tip_Nose_pt)\n\nclass Columella_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.columella_pt\"\n    bl_label = \"Columalla\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Columella' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Columella', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Columella_pt)\n\nclass Subnasale_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.subnasale_pt\"\n    bl_label = \"Subnasale\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Subnasale' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Subnasale', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Subnasale_pt)\n\nclass ST_A_point_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_a_point_pt\"\n    bl_label = \"ST A point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST A point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST A point', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_A_point_pt)\n\nclass Upper_Lip_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.upper_lip_pt\"\n    bl_label = \"Upper Lip\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Upper Lip' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Upper Lip', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Upper_Lip_pt)\n\nclass Stomion_Superius_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.stomion_superius_pt\"\n    bl_label = \"Stomion Superius\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Stomion Superius' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Stomion Superius', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Stomion_Superius_pt)\n\nclass Stomion_Inferius_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.stomion_inferius_pt\"\n    bl_label = \"Stomion Inferius\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Stomion Inferius' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Stomion Inferius', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Stomion_Inferius_pt)\n\nclass Lower_Lip_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.lower_lip_pt\"\n    bl_label = \"Lower Lip\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Lower Lip' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Lower Lip', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Lower_Lip_pt)\n\nclass ST_B_point_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_b_point_pt\"\n    bl_label = \"ST B point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST B point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST B point', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_B_point_pt)\n\n\nclass ST_Pogonion_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_pogonion_pt\"\n    bl_label = \"ST Pogonion\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST Pogonion' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST Pogonion', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_Pogonion_pt)\n\n\nclass ST_Gnathion_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_gnathion_pt\"\n    bl_label = \"ST Gnathion\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST Gnathion' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST Gnathion', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_Gnathion_pt)\n\n\nclass ST_Menton_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.st_menton_pt\"\n    bl_label = \"ST Menton\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'ST Menton' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('ST Menton', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(ST_Menton_pt)\n\n\nclass Throat_point_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.throat_point_pt\"\n    bl_label = \"Throat point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Throat point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Throat point', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Throat_point_pt)\n\nclass Subpupil_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.subpupil_right_pt\"\n    bl_label = \"Subpupil right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Subpupil right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Subpupil right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Subpupil_right_pt)\n\nclass Subpupil_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.subpupil_left_pt\"\n    bl_label = \"Subpupil left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Subpupil left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Subpupil left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Subpupil_left_pt)\n\nclass CB_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cb_right_pt\"\n    bl_label = \"CB right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'CB right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('CB right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CB_right_pt)\n\n\nclass CB_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cb_left_pt\"\n    bl_label = \"CB left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'CB left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('CB left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CB_left_pt)\n\nclass OR_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.or_right_pt\"\n    bl_label = \"OR right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'OR right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('OR right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(OR_right_pt)\n\n\nclass OR_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.or_left_pt\"\n    bl_label = \"OR left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'OR left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('OR left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(OR_left_pt)\n\nclass Cheekbone_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheekbone_left_pt\"\n    bl_label = \"Cheekbone left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheekbone left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Cheekbone left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheekbone_left_pt)\n\nclass Cheekbone_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.cheekbone_right_pt\"\n    bl_label = \"Cheekbone right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Cheekbone right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Cheekbone right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Cheekbone_right_pt)\n\n\nclass SP_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.sp_right_pt\"\n    bl_label = \"SP right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'SP right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('SP right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SP_right_pt)\n\nclass SP_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.sp_left_pt\"\n    bl_label = \"SP left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'SP left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('SP left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SP_left_pt)\n\n\nclass AB_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ab_right_pt\"\n    bl_label = \"AB right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'AB right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('AB right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(AB_right_pt)\n\n\nclass AB_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.ab_left_pt\"\n    bl_label = \"AB left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'AB left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('AB left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(AB_left_pt)\n\n\nclass Head_of_Condyle_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.head_of_condyle_pt\"\n    bl_label = \"Condyle Rotation Point\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Condyle Rotation Point' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Condyle Rotation Point', 'Anatomical Points - Mandible')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Head_of_Condyle_pt)\n\n\nclass Lateral_Canthus_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.lateral_canthus_left_pt\"\n    bl_label = \"Lateral Canthus left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Lateral Canthus left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Lateral Canthus left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Lateral_Canthus_left_pt)\n\nclass Lateral_Canthus_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.lateral_canthus_right_pt\"\n    bl_label = \"Lateral Canthus right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Lateral Canthus right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Lateral Canthus right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Lateral_Canthus_right_pt)\n\n# Parenteia pontos duro\n\ndef ParenteiaPonto(ponto):\n\n    bpy.ops.object.mostra_pontos_anatomicos()\n\n    listaDist = []\n\n    osteotomias = [bpy.data.objects[\"ca\"], bpy.data.objects[\"ma\"], bpy.data.objects[\"cm\"], bpy.data.objects[\"me\"], bpy.data.objects[\"rd\"], bpy.data.objects[\"re\"]]\n\n#    for item in bpy.data.objects:\n    for item in osteotomias:\n#        if item.hide == False and item.type == 'MESH':\n\n            obj = bpy.data.objects[item.name]\n            # print(\"OBJETO ATUAL\", obj)\n\n            # Lista os vértices do objeto\n            if obj.mode == 'EDIT':\n                bm = bmesh.from_edit_mesh(obj.data)\n                vertices = bm.verts\n\n            else:\n                vertices = obj.data.vertices\n\n            # Todos os vértices por vetor\n            verts = [obj.matrix_world @ vert.co for vert in vertices]\n\n            # Captura vetor do objeto\n\n            referencia = bpy.data.objects[ponto].location\n\n\n\n            # Calcula distância pontos\n\n            def DistanciaObjs(obj1, obj2):\n\n                objA = bpy.data.objects[obj1].location\n                objB = obj2\n\n                distancia = sqrt( (objB[0] - objA[0])**2 + (objB[1] - objA[1])**2 + (objB[2] - objA[2])**2 )\n\n                return distancia\n\n\n\n            for i in range(len(verts)):\n\n                vertAtual = verts[i]\n\n                distanciaVert = DistanciaObjs(ponto, vertAtual)\n\n                listaDist.append([distanciaVert, obj.name])\n\n\n\n\n    listaFin = sorted(listaDist)\n    print(\"MAIS PRÓXIMO!\", listaFin[0])\n\n    bpy.ops.object.select_all(action='DESELECT')\n    ObjPai = bpy.data.objects[listaFin[0][1]]\n    ObjFilho = bpy.data.objects[ponto]\n    ObjPai.select_set(True)\n    ObjFilho.select_set(True)\n    bpy.context.view_layer.objects.active = ObjPai\n    bpy.ops.object.parent_set()\n    bpy.ops.object.select_all(action='DESELECT')\n    #bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)\n\n# Parenteia pontos mole\n\ndef ParenteiaPontoMole(ponto):\n\n    listaDist = []\n\n    obj = bpy.data.objects[\"SoftTissueDynamic\"]\n            # print(\"OBJETO ATUAL\", obj)\n\n            # Lista os vértices do objeto\n    if obj.mode == 'EDIT':\n        bm = bmesh.from_edit_mesh(obj.data)\n        vertices = bm.verts\n\n    else:\n        vertices = obj.data.vertices\n\n            # Todos os vértices por vetor\n    verts = [obj.matrix_world @ vert.co for vert in vertices]\n\n            # Captura vetor do objeto\n\n    referencia = bpy.data.objects[ponto].location\n\n            # Calcula distância pontos\n\n    def DistanciaObjs(obj1, obj2):\n        objA = bpy.data.objects[obj1].location\n        objB = obj2\n\n        distancia = sqrt( (objB[0] - objA[0])**2 + (objB[1] - objA[1])**2 + (objB[2] - objA[2])**2 )\n\n        return distancia\n\n\n    for i in range(len(verts)):\n\n        vertAtual = verts[i]\n\n        distanciaVert = DistanciaObjs(ponto, vertAtual)\n\n        listaDist.append([distanciaVert, i])\n\n\n\n    listaFin = sorted(listaDist)\n    print(\"MAIS PRÓXIMO!\", listaFin[0])\n\n\n\n    bpy.ops.object.select_all(action='DESELECT')\n    obj.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_mode(type=\"VERT\")\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n# Quebra aqui\n    obj.data.vertices[listaFin[0][1]].select = True\n\n\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n\n\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n\n    b = bpy.data.objects[ponto]\n\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = b\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.mesh.select_all(action = 'DESELECT')\n\n\n    obj.select_set(True)\n    b.select_set(True)\n    bpy.context.view_layer.objects.active = obj\n\n    print(b.name)\n\n\n    bpy.ops.object.mode_set(mode = 'EDIT')\n    bpy.ops.object.vertex_parent_set()\n    bpy.ops.object.mode_set(mode = 'OBJECT')\n\n\nclass testaPontos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.testa_pontos\"\n    bl_label = \"TestaPontos\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        testaPontosDef(self, context)\n        return {'FINISHED'}\n\n# Parenteia pontos\n\ndef ParenteiaEMPDef(self, context):\n\n\n\t# Lista com todos os pontos\n\n\tListaPontos = ['Orbital right', 'Orbital left', 'N point', 'Po right', 'Po left', 'Pt right', 'Pt left', 'Ba point', 'S point', 'U1 Tip', 'U1 Labial Gengival Border', 'U1 Lingual Gengival Border', 'M U6', 'D U6', 'U6 Occlusal', 'PNS point', 'A point', 'ANS point', 'U1 Root', 'L1 Tip', 'L1 Root', 'L1 Labial Gengival Border', 'L1 Lingual Gengival Border', 'B point', 'M L6', 'L6 Occlusal', 'D L6', 'Mid Ramus right', 'Mid Ramus left', 'R right', 'R left', 'Go right', 'Go left', 'Ar right', 'Ar left', 'Sigmoid right', 'Sigmoid left', 'Co right', 'Co left', 'Pg point', 'Gn point', 'Me point', 'Tooth 8', 'Tooth 9', 'Tooth 6', 'Tooth 11', 'Tooth 3', 'Tooth 14', 'Tooth 24', 'Tooth 25', 'Tooth 22', 'Tooth 27', 'Tooth 19', 'Tooth 30', 'Condyle Rotation Point']\n\n\tListaPontosMole = [ 'ST Glabella', 'ST Nasion', 'Bridge of Nose', 'Tip of Nose', 'Cheekbone right', 'Cheekbone left', 'Columella', 'Subnasale', 'Subpupil right', 'Subpupil left' ,'ST A point', 'Upper Lip', 'Stomion Superius', 'Stomion Inferius', 'Lower Lip', 'ST B point', 'ST Pogonion', 'ST Gnathion', 'ST Menton', 'Throat point', 'CB right', 'CB left', 'OR right', 'OR left', 'SP right', 'SP left', 'AB right', 'AB left', 'Radix', 'Anterior Nostril left', 'Posterior Nostril left', 'Anterior Nostril right', 'Posterior Nostril right','Rhinion', 'Alar Groove right', 'Alar Groove left', 'Supratip', 'Infratip Lobule', 'Alar Rim right', 'Alar Rim left', 'Columella right', 'Columella left', 'Alar Rim right', 'Alar Rim left', 'Medial Canthus left', 'Medial Canthus right', 'Trichion', 'Submental', 'Supraglabella', 'Glabella', 'Alar Cheek Groove right', 'Alar Cheek Groove left', 'Lateral Canthus left', 'Lateral Canthus right']\n\n\t# Cria lista com pontos da cena\n\n\tObjetosCena = bpy.data.objects\n\n# Compara pontos duro\n\tfor ob in ListaPontos:\n\t\tif ob in ObjetosCena:\n\t\t\tParenteiaPonto(ob)\n\t\t\tprint(ob,\"Existe na lista (Duro)!\")\n\n\n# Compara pontos mole\n\tfor ob in ListaPontosMole:\n\t\tif ob in ObjetosCena:\n\t\t\tParenteiaPontoMole(ob)\n\t\t\tprint(ob,\"Existe na lista (Mole)!\")\n\nclass ParenteiaEMP(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.parenteia_emp\"\n    bl_label = \"ParenteiaEMP\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        ParenteiaEMPDef(self, context)\n        return {'FINISHED'}\n\nbpy.utils.register_class(ParenteiaEMP)\n\ndef OcultaPontosAnatomicosDef():\n    for i in bpy.data.collections:\n        if fnmatch.fnmatchcase(i.name, \"Anatomical Points*\"):\n            bpy.data.collections[i.name].hide_viewport=True\n\nclass OcultaPontosAnatomicos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.oculta_pontos_anatomicos\"\n    bl_label = \"Hide Anatomical Points\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        OcultaPontosAnatomicosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(OcultaPontosAnatomicos)\n\ndef MostraPontosAnatomicosDef():\n    for i in bpy.data.collections:\n        if fnmatch.fnmatchcase(i.name, \"Anatomical Points*\"):\n            bpy.data.collections[i.name].hide_viewport=False\n\n\nclass MostraPontosAnatomicos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.mostra_pontos_anatomicos\"\n    bl_label = \"Show Anatomical Points\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        MostraPontosAnatomicosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(MostraPontosAnatomicos)\n"
  },
  {
    "path": "README.md",
    "content": "**OrtogOnBlender**\n==================\n![GitHub Logo](http://www.ciceromoraes.com.br/ups/OrtogOnBlender.jpg)\n<h2>História</h2>\n\nNo ano de 2014 iniciou-se uma parceria entre o cirurgião bucomaxilofacial, Dr. Everton da Rosa e o 3D designer [Cicero Moraes](http://www.ciceromoraes.com.br) com o objetivo de criar uma metodologia de planejamento de cirurgia ortognática baseada em software livre. A ferramenta principal de trabalho seria o Blender 3D, poderoso software livre de modelagem e animação. No entanto, apesar de este contar com um workflow bem preparado para o campo artístico, o mesmo não poderia se dizer em relação às ciências da saúde. Dentre os muitos problemas encontrados podem ser citados: a falta de uma poderosa ferramenta de cálculos booleanos para o processo de osteotomia e criação de guias cirúrgicos, a falta de suporte e conversão de  arquivos DICOM (tomografias computadorizadas) e a distribuição difusa dos comandos pela interface, o que  dificultava em muito a utilização do software por iniciantes no mundo da computação gráfica 3D.\n\nDe 2014 a 2017 dos dois especialistas desenvolveram e lapidaram não apenas uma metodologia de uso do software livre na cirurgia ortognática, mas também uma forma de compartilhar esse conhecimento através de cursos presenciais. No segundo semestre de 2017 o OrtogOnBlender começou a ser desenvolvido e em poucos meses já contava com uma versão funcional.\n\n<h2>Sobre o Addon</h2>\n\nO OrtogOnBlender é um addon de planejamento digital de cirurgia ortognática, baseado no software de modelagem e animação Blender 3D e é focado na facilitação do uso de ferramentas 3D por parte de profissionais da área de cirurgia bucomaxilofacial.\n\nOrganizado em um painel na parte esquerda da 3D View, o addon tem em sua estrutura os seguintes passos:\n\n* **Importa Tomo**: Reconstrução dos ossos e do mole em 3D, a partir de uma tomografia computadorizada.\n\n* **Importar Tomo 3D/Moldes**: Importação da reconstrução da tomografia computadorizada ou digitalização de moles das arcadas dentárias, efetuadas em software externo.\n\n* **Zoom Cena**: Elementos de visualização da cena.\n\n* **Cria Fotogrametria**: Digitalização de faces a partir de fotografias.\n\n* **Importa Fotogrametria**: Importa digitalização de face efetuada em software externo.\n\n* **Alinha  Faces**: Alinha a face e a redimensiona utilizando as informações fornecidas pelo usuário.\n\n* **Importar Cefalometria**: Importa imagem de cefalometria para alinhamento da face.\n\n* **Redimensiona e Alinha Faces**: Redimensiona a face baseada em medida conhecida e alinha a fotogrametria em relação ao mole reconstruído a partir da tomografia.\n\n* **Osteotomia**: Osteotomia dos ossos da cabeça, com ferramentas de booleana complexa e configura cada uma das peças separadas (coloração e nomeamento).\n\n* **Dinâmica do Mole**: Atrela a deformação da pele em relação a movimentação dos ossos provindos da osteotomia.\n\n* **Criação do Splint**: Configuração dos estados do planejamento digital e criação dos splints cirúrgicos, para posterior impressão 3D\n\n<h2>Como Instalar (Geral)</h2>\n\n* Baixe o arquivo em “Clone or download”\n* No Blender vá em: `File` → `User Preferences` → `Addons` → `Install from file` Procure o arquivo OrtogOnBlender-master.zip, clique sobre ele e em seguida no botão: `Install from file`\n* Ativar a opção `ortog:OrtogOnBlender` e configure os caminhos dos scripts expandindo a setinha do lado esquerdo.\n* Para manter o addon ativo clique em: `Save User Settings`.\n\n<h2>Como Instalar (Detalhado)</h2>\n\n* Tutorial de instalação no Windows: http://www.ciceromoraes.com.br/doc/pt_br/OrtogOnBlender/Instalacao_Windows.html\n\n* Tutorial de instalação no Mac OS X: http://www.ciceromoraes.com.br/doc/pt_br/OrtogOnBlender/Instalacao_MacOSX.html\n\n* Tutorial de instalação no Linux: http://www.ciceromoraes.com.br/doc/pt_br/OrtogOnBlender/Instalacao_Linux.html\n\n<h2>Dependências</h2>\n\nO OrtogOnBlender utiliza uma série de addons e bibliotecas/programas, alguns nativos e outros externos em relação ao Blender 3D, são eles:\n\n<h4>Addons</h4>\n\n* Measureit (nativo)\n* 3D Navigation (nativo)\n* Import Images as Planes (nativo)\n* Cork on Blender - https://github.com/dfelinto/cork-on-blender\t\n* Cut Mesh - https://github.com/patmo141/cut_mesh\n* Object Alignment - https://github.com/patmo141/object_alignment\n\n<h4>Programas</h4>\n\n* Meshlab (instalador) - http://www.meshlab.net/\n* OpenMVG (código-fonte) - https://github.com/openMVG/openMVG\n* OpenMVS (código-fonte) - http://cdcseacave.github.io/openMVS/\n* MVE/SMVS (código-fonte) - https://github.com/flanggut/smvs\n* Dicom2Mesh (código-fonte) - https://github.com/AOT-AG/DicomToMesh\n\n<h3>Agradecimentos</h3>\n\n[Dalai Felinto](https://github.com/dfelinto/), [Pierre Moulon](https://github.com/pmoulon), [Patrick Moore](https://github.com/patmo141/), [Adrian Schneider](https://github.com/eidelen), Rodrigo Dornelles, Liogi Iwaki Filho, Antônio Eduardo Izidro, Paulo Henrique  Luiz de Freitas, Vinicius de Paula Ribeiro, Richard Gravalos, José Patrício Neto, Hugo Santos Cunha, Frederico Yonezaki, Eduardo Correa Costa, Renata Porto Stypulkowski, Samuel Cardoso Santiago Júnior, José Arnaldo dos Santos Júnior, Lucio Gamboa Villegas, Walace Guimarães Matos e Adriano Rocha Campos.\n"
  },
  {
    "path": "RelatorioAnimacao.py",
    "content": "import bpy\n\ndef AnimaLocRotDef(self, context):\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.ops.anim.keyframe_insert_menu(type='BUILTIN_KSI_LocRot')\n\n\nclass AnimaLocRot(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"anim.ortog_loc_rot\"\n    bl_label = \"Kinematic Ortog\"\n    \n    def execute(self, context):\n       AnimaLocRotDef(self, context)\n       return {'FINISHED'}\n\nbpy.utils.register_class(AnimaLocRot)\n"
  },
  {
    "path": "RhinOnBlender.py",
    "content": "import bpy\nimport platform\nfrom .__init__ import *\nfrom .RhinTools import *\nfrom .Version import *\nfrom .RhinOpenGL import *\n\nclass RHIN_PT_AtualizaAddonSec(bpy.types.Panel):\n    bl_label = \"Upgrade Script\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"VERSION: \"+VERSION)\n\n        row = layout.row()\n        row.operator(\"object.atualiza_script\", text=\"UPGRADE RHIN!\", icon=\"RECOVER_LAST\")\n\nbpy.utils.register_class(RHIN_PT_AtualizaAddonSec)\n\nclass RHIN_PT_NomePaciente(bpy.types.Panel):\n    bl_label = \"Patient's Name\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n        row = layout.row()\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"nome_paciente\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"sobrenome_paciente\")\n\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(RHIN_PT_NomePaciente)\n\n\nclass RHIN_PT_Fotogrametria(bpy.types.Panel):\n    bl_label = \"Photogrammetry Start\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.prop(scn, \"my_enum\")\n\n        my_enum = scn.my_enum\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.OPENMVG:\n#            row = layout.row()\n#            row.label(text=\"OpenMVG+OpenMVS:\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'RIGHT'\n            col.prop(context.scene, \"d_factor\")\n            col.prop(context.scene, \"smooth_factor\")\n\n            col.prop(scn.my_tool, \"imagem_bool\", text=\"Decrease picture size!\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.rhin_fotogrametria_dec\", text=\"Start Photogrammetry!\", icon=\"IMAGE_DATA\")\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.SMVS:\n\n#            row = layout.row()\n#            row.label(text=\"SMVS+Meshlab:\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto_smvs\", text=\"Alternative Photogrammetry I\", icon=\"IMAGE_DATA\")\n\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.MESHROOM:\n\n#            row = layout.row()\n#            row.label(text=\"Meshroom (AliceVision):\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto_meshroom\", text=\"Alternative Photogrammetry II\", icon=\"IMAGE_DATA\")\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.OPENMVGWIN:\n#            row = layout.row()\n#            row.label(text=\"OpenMVG+OpenMVS:\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'RIGHT'\n            col.prop(context.scene, \"d_factor\")\n            col.prop(context.scene, \"smooth_factor\")\n\n            col.prop(scn.my_tool, \"imagem_bool\", text=\"Decrease picture size!\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto_win\", text=\"Start Photogrammetry!\", icon=\"IMAGE_DATA\")\n\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_fotogram\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(RHIN_PT_Fotogrametria)\n\n\nclass RHIN_PT_AlinhaFace(bpy.types.Panel):\n    bl_label = \"Photogrammetry - Align & Scale\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Align Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1b\", text=\"Cantal Lateral Right\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp2b\", text=\"Cantal Lateral Left\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp3b\", text=\"Down Point\", icon=\"SORTBYEXT\")\n\n#        row = layout.row()\n#        row.operator(\"object.cria_tres_pontos\", text=\"3 Points Click\", icon=\"OUTLINER_OB_MESH\")\n\n        row = self.layout.row(align = True)\n        row.label(text=\"Real Size:\")\n        row.prop(context.scene, \"medida_real2\")\n\n        row = layout.row()\n        row.operator(\"object.alinha_forca\", text=\"Align and Resize!\", icon=\"ORIENTATION_LOCAL\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Segmentation Cut Through:\")\n\n        row = layout.row()\n        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n\n        row = layout.row()\n        linha=row.operator(\"object.segmenta_desenho\", text=\"Cut Draw!\", icon=\"FCURVE\")\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Surface Cut:\")\n\n        row = layout.row()\n        row.operator(\"wm.modal_cria_pontos\", icon='CURVE_DATA', text=\"Create Points\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_unido\", icon='CURVE_BEZCIRCLE', text=\"Create Bezier Line\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta\", text=\"Cut Line!\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta_dupla\", text=\"Cut Line Double!\", icon=\"MOD_THICKNESS\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_alinha_face\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(RHIN_PT_AlinhaFace)\n\n\n'''\nclass RHIN_PT_FotogramModif(bpy.types.Panel):\n    bl_label = \"Photogrammetry - Modifiers\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Modifiers:\")\n\n        ob = context.object\n\n        layout.operator_menu_enum(\"object.modifier_add\", \"type\")\n\n        for md in ob.modifiers:\n            box = layout.template_modifier(md)\n            if box:\n                # match enum type to our functions, avoids a lookup table.\n                getattr(self, md.type)(box, ob, md)\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.convert\", text=\"APPLY ALL!\", icon=\"ERROR\").target='MESH'\n\nbpy.utils.register_class(RHIN_PT_FotogramModif)\n'''\n\nclass RHIN_PT_PontosAnatomicos(bpy.types.Panel):\n    bl_label = \"Anatomical Points\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        scn = context.scene\n\n        row = layout.row()\n        linha=row.operator(\"object.copia_face\", text=\"COPY FACE!\")\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.label(text=\"Anatomical Points\")\n\n        row = layout.row()\n        row.label(text=\"Nose Calculation Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.radix_pt\", text=\"Radix\")\n\n        row = layout.row()\n        linha=row.operator(\"object.tip_nose_pt\", text=\"Tip of Nose\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_cheek_groove_right_pt\", text=\"Alar Cheek Groove right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_cheek_groove_left_pt\", text=\"Alar Cheek Groove left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.subnasale_pt\", text=\"Subnasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.anterior_nostril_left_pt\", text=\"Anterior Nostril left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.posterior_nostril_left_pt\", text=\"Posterior Nostril left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.anterior_nostril_right_pt\", text=\"Anterior Nostril right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.posterior_nostril_right_pt\", text=\"Posterior Nostril right\")\n\n\n\n        row = layout.row()\n        row.label(text=\"Facial Analysis Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.medial_canthus_right_pt\", text=\"Medial Canthus right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.medial_canthus_left_pt\", text=\"Medial Canthus left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.trichion_pt\", text=\"Trichion\")\n\n        row = layout.row()\n        linha=row.operator(\"object.st_glabella_pt\", text=\"ST Glabella\")\n\n        row = layout.row()\n        linha=row.operator(\"object.subnasale_pt\", text=\"Subnasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.st_menton_pt\", text=\"ST Menton\")\n\n\n        row = layout.row()\n        row.label(text=\"Control Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.rhinion_pt\", text=\"Rhinion\")\n\n        row = layout.row()\n        linha=row.operator(\"object.supratip_pt\", text=\"Supratip\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_groove_right_pt\", text=\"Alar Groove right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_groove_left_pt\", text=\"Alar Groove left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.infratip_lobule_pt\", text=\"Infratip Lobule\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_rim_right_pt\", text=\"Alar Rim right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alar_rim_left_pt\", text=\"Alar Rim left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.columella_right_pt\", text=\"Columella right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.columella_left_pt\", text=\"Columella left\")\n\n\n       \trow = layout.row()\n        row = layout.row()\n        row.label(text=\"Parent Points:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.parenteia_emp\", text=\"Parent Points\", icon=\"LINKED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.pontos_oculta_nomes\", text=\"Hide Names\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pontos_mostra_nomes\", text=\"Show Names\", icon=\"GHOST_ENABLED\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_points_soft\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nbpy.utils.register_class(RHIN_PT_PontosAnatomicos)\n\nclass RHIN_PT_DistAngles(bpy.types.Panel):\n    bl_label = \"Dists & Angles\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        scn = context.scene\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.label(text=\"Facial Analysis Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.lateral_canthus_right_pt\", text=\"Lateral Canthus right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.lateral_canthus_left_pt\", text=\"Lateral Canthus left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.medial_canthus_right_pt\", text=\"Medial Canthus right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.medial_canthus_left_pt\", text=\"Medial Canthus left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.trichion_pt\", text=\"Trichion\")\n\n        row = layout.row()\n        linha=row.operator(\"object.st_glabella_pt\", text=\"ST Glabella\")\n\n        row = layout.row()\n        linha=row.operator(\"object.subnasale_pt\", text=\"Subnasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.st_menton_pt\", text=\"ST Menton\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.rhin_visualiza_gl\", text=\"View Lines!\", icon=\"HIDE_OFF\")\n\n        row = layout.row()\n        linha=row.operator(\"object.rhin_remove_gl\", text=\"Hide Lines!\", icon=\"HIDE_ON\")\n\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.pontos_oculta_nomes\", text=\"Hide Names\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pontos_mostra_nomes\", text=\"Show Names\", icon=\"GHOST_ENABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.parenteia_emp\", text=\"Parent Points\", icon=\"LINKED\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.dist_nariz\", text=\"CALC ALL!\", icon=\"PREFERENCES\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.label(text=\"Results:\")\n\n        # Proporção do nariz\n        row = layout.row()\n        row = layout.row()\n\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        linha=row.operator(\"object.radix_pt\", text=\"Radix\")\n        linha=row.operator(\"object.tip_nose_pt\", text=\"Tip of Nose\")\n#        linha=row.operator(\"object.subnasale_pt\", text=\"Subnasale\")\n        row = col.row()\n        linha=row.operator(\"object.alar_cheek_groove_right_pt\", text=\"Alar Cheek Groove right\")\n        row = col.row()\n        linha=row.operator(\"object.alar_cheek_groove_left_pt\", text=\"Alar Cheek Groove left\")\n        row = col.row()\n        row.scale_y=1.0\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_prop_nariz\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.label(text=\"Average: 0.67\") # Calculado\n\n        # Ângulo nasolabial esquerdo\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        linha=row.operator(\"object.anterior_nostril_left_pt\", text=\"Ant. Nostril left\")\n        linha=row.operator(\"object.posterior_nostril_left_pt\", text=\"Post. Nostril left\")\n        row = col.row()\n        row.scale_y=1.0\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_angulo_nasolabial_esquerdo\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.label(text=\"Women: 95 - 100º    Men: 90º - 95º\") # Calculado\n\n        # Ângulo nasolabial direito\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        linha=row.operator(\"object.anterior_nostril_right_pt\", text=\"Ant. Nostril right\")\n        linha=row.operator(\"object.posterior_nostril_right_pt\", text=\"Post. Nostril right\")\n        row = col.row()\n        row.scale_y=1.0\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_angulo_nasolabial_direito\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.label(text=\"Women: 95 - 100º    Men: 90º - 95º\") # Calculado\n\n        # Alar Rim - Columella left\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        linha=row.operator(\"object.anterior_nostril_left_pt\", text=\"Ant. Nostril left\")\n        linha=row.operator(\"object.posterior_nostril_left_pt\", text=\"Post. Nostril left\")\n        row = col.row()\n        linha=row.operator(\"object.alar_rim_left_pt\", text=\"Alar Rim left\")\n        linha=row.operator(\"object.columella_left_pt\", text=\"Columella left\")\n        row = col.row()\n        row.scale_y=1.0\n        row.alignment = 'RIGHT'\n        row.label(text=\"Alar Rim - Columella Factor LEFT\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_alar_rim_med_esquerdo\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_columella_med_esquerdo\")\n\n        # Alar Rim - Columella left\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        linha=row.operator(\"object.anterior_nostril_right_pt\", text=\"Ant. Nostril right\")\n        linha=row.operator(\"object.posterior_nostril_right_pt\", text=\"Post. Nostril right\")\n        row = col.row()\n        linha=row.operator(\"object.alar_rim_right_pt\", text=\"Alar Rim right\")\n        linha=row.operator(\"object.columella_right_pt\", text=\"Columella right\")\n        row = col.row()\n        row.scale_y=1.0\n        row.alignment = 'RIGHT'\n        row.label(text=\"Alar Rim - Columella Factor RIGHT\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_alar_rim_med_direito\")\n        row = col.row()\n        row.alignment = 'RIGHT'\n        row.prop(context.scene, \"rhin_columella_med_direito\")\n\n\nbpy.utils.register_class(RHIN_PT_DistAngles)\n\nbpy.types.Scene.rhin_prop_nariz = bpy.props.StringProperty \\\n    (\n        name = \"Nose Proportion\",\n        description = \"Nose Proportion\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.rhin_angulo_nasolabial_esquerdo = bpy.props.StringProperty \\\n    (\n        name = \"Nasolabial Angle left\",\n        description = \"Nasolabial Angle left\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.rhin_angulo_nasolabial_direito = bpy.props.StringProperty \\\n    (\n        name = \"Nasolabial Angle right\",\n        description = \"Nasolabial Angle right\",\n        default = \"NONE\"\n    )\n\n# Alar Rim - Columella left\nbpy.types.Scene.rhin_alar_rim_med_esquerdo = bpy.props.StringProperty \\\n    (\n        name = \"Alar Rim - Nostril\",\n        description = \"Alar Rim - Nostril\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.rhin_columella_med_esquerdo = bpy.props.StringProperty \\\n    (\n        name = \"Columella - Nostril\",\n        description = \"Columella - Nostril\",\n        default = \"NONE\"\n    )\n\n# Alar Rim - Columella right\nbpy.types.Scene.rhin_alar_rim_med_direito = bpy.props.StringProperty \\\n    (\n        name = \"Alar Rim - Nostril\",\n        description = \"Alar Rim - Nostril\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.rhin_columella_med_direito = bpy.props.StringProperty \\\n    (\n        name = \"Columella - Nostril\",\n        description = \"Columella - Nostril\",\n        default = \"NONE\"\n    )\n\n\nclass RHIN_PT_Escultura(bpy.types.Panel):\n    bl_label = \"Sculpting\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        row = layout.row()\n        row.operator(\"object.cria_shape_keys\", text=\"Create Shape Keys\", icon=\"MOD_SIMPLEDEFORM\")\n\n        row = layout.row()\n        ob = context.object\n        key = ob.data.shape_keys\n        kb = ob.active_shape_key\n\n        enable_edit = ob.mode != 'EDIT'\n        enable_edit_value = False\n\n        if ob.show_only_shape_key is False:\n            if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode):\n                enable_edit_value = True\n\n        if key.use_relative:\n            if ob.active_shape_key_index != 0:\n                layout.use_property_split = True\n\n                row = layout.row()\n                row.active = enable_edit_value\n                row.prop(kb, \"value\")\n\n                row = layout.row()\n                linha=row.operator(\"object.escultura_grab\", text=\"Grab\", icon=\"BRUSH_GRAB\")\n\n                row = layout.row()\n                linha=row.operator(\"object.escultura_smooth\", text=\"Smooth\", icon=\"BRUSH_SMOOTH\")\n\n                row = layout.row()\n                linha=row.operator(\"object.escultura_mask\", text=\"Mask\", icon=\"BRUSH_MASK\")\n\n                row = layout.row()\n                linha=row.operator(\"object.mode_set\", text=\"OK! (Object Mode)\", icon=\"META_CUBE\").mode='OBJECT'\n\n        row = layout.row()\n        row.label(text=\"View/Transp.:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.material_transparente_dois\", text=\"Transp. Material\", icon=\"SHADING_RENDERED\")\n\n        row = layout.row()\n        #col = self.layout.column(align = True)\n        row.alignment = 'CENTER'\n        row.prop(context.scene, \"mat_transp_pre\")\n        #row = layout.row()\n        row.operator(\"object.material_transp_pre\", text=\"Original\")\n\n        row = layout.row()\n        #col = self.layout.column(align = True)\n        row.alignment = 'CENTER'\n        row.prop(context.scene, \"mat_transp_pos\")\n        #row = layout.row()\n        row.operator(\"object.material_transp_pos\", text=\"Planning\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.material_opaco_dois\", text=\"Opaque Material\", icon=\"SHADING_SOLID\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"view3d.clip_border\", text=\"Clipping Border\", icon=\"UV_FACESEL\")\n\n\nbpy.utils.register_class(RHIN_PT_Escultura)\n\n\nclass RHIN_PT_GuideCreation(bpy.types.Panel):\n    bl_label = \"Guide Creation\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Rhin\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.pontos_oculta_nomes\", text=\"Hide Names\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pontos_mostra_nomes\", text=\"Show Names\", icon=\"GHOST_ENABLED\")\n\n\n        row = layout.row()\n        row.label(text=\"Anatomical Points\")\n\n        row = layout.row()\n        linha=row.operator(\"object.supraglabella_pt\", text=\"Supraglabella\")\n\n        row = layout.row()\n        linha=row.operator(\"object.st_glabella_pt\", text=\"ST Glabella\")\n\n        row = layout.row()\n        linha=row.operator(\"object.radix_pt\", text=\"Radix\")\n\n        row = layout.row()\n        linha=row.operator(\"object.rhinion_pt\", text=\"Rhinion\")\n\n        row = layout.row()\n        linha=row.operator(\"object.supratip_pt\", text=\"Supratip\")\n\n        row = layout.row()\n        linha=row.operator(\"object.tip_nose_pt\", text=\"Tip of Nose\")\n\n        row = layout.row()\n        linha=row.operator(\"object.columella_pt\", text=\"Columella\")\n\n        row = layout.row()\n        linha=row.operator(\"object.subnasale_pt\", text=\"Subnasale\")\n\n        row = layout.row()\n        linha=row.operator(\"object.upper_lip_pt\", text=\"Upper Lip\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.gera_guia_nariz\", text=\"Create Nose Guide!\", icon=\"PREFERENCES\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"export_mesh.stl\", text=\"Export STL\", icon=\"TRACKING_REFINE_FORWARDS\").use_selection=True#.use_mesh_modifiers=True\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_guide\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n    bpy.types.Scene.mat_transp_pre = bpy.props.StringProperty \\\n      (\n        name = \"Original\",\n        description = \"Original Face\",\n        default = \"0.30\"\n      )\n\n    bpy.types.Scene.mat_transp_pos = bpy.props.StringProperty \\\n      (\n        name = \"Planning\",\n        description = \"Planning Face\",\n        default = \"0.30\"\n      )\n\nbpy.utils.register_class(RHIN_PT_GuideCreation)\n"
  },
  {
    "path": "RhinOpenGL.py",
    "content": "import bpy\nimport gpu\nimport bgl\nfrom gpu_extras.batch import batch_for_shader\n\ndef LinhasCentraisCria():\n\n    CantusRightX = bpy.data.objects['Medial Canthus right'].location[0]\n    CantusRightY = bpy.data.objects['Medial Canthus right'].location[1]\n\n    CantusLeftX = bpy.data.objects['Medial Canthus left'].location[0]\n    CantusLeftY = bpy.data.objects['Medial Canthus left'].location[1]\n\n    TrichionY = bpy.data.objects['Trichion'].location[1]\n    TrichionZ = bpy.data.objects['Trichion'].location[2]\n\n    STGlabellaY = bpy.data.objects['ST Glabella'].location[1]\n    STGlabellaZ = bpy.data.objects['ST Glabella'].location[2]\n\n\n    SubnasaleY = bpy.data.objects['Subnasale'].location[1]\n    SubnasaleZ = bpy.data.objects['Subnasale'].location[2]\n\n    STMentonY = bpy.data.objects['ST Menton'].location[1]\n    STMentonZ = bpy.data.objects['ST Menton'].location[2]\n\n    DistanciaCantus = abs(CantusLeftX - CantusRightX)\n\n    print(\"DISTANCIA CANTUS!!!\", DistanciaCantus)\n\n    try:\n\n        LatCantusRightX = bpy.data.objects['Lateral Canthus right'].location[0]\n        LatCantusRightY = bpy.data.objects['Lateral Canthus right'].location[1]\n\n        LatCantusLeftX = bpy.data.objects['Lateral Canthus left'].location[0]\n        LatCantusLeftY = bpy.data.objects['Lateral Canthus left'].location[1]\n\n        coords = [(LatCantusRightX,LatCantusRightY,-1000), (LatCantusRightX,LatCantusRightY,1000),(CantusRightX,CantusRightY,-1000), (CantusRightX,CantusRightY,1000), (LatCantusLeftX,LatCantusLeftY,-1000), (LatCantusLeftX,LatCantusLeftY, 1000),(CantusLeftX,CantusLeftY,-1000), (CantusLeftX,CantusLeftY, 1000), (1000, TrichionY, TrichionZ), (-1000, TrichionY, TrichionZ), (1000, STGlabellaY, STGlabellaZ), (-1000, STGlabellaY, STGlabellaZ), (1000, SubnasaleY, SubnasaleZ), (-1000, SubnasaleY, SubnasaleZ), (1000, STMentonY, STMentonZ), (-1000, STMentonY, STMentonZ) ] #, (CantusRightX-DistanciaCantus,CantusRightY,-1000), (CantusRightX-DistanciaCantus,CantusRightY, 1000), (CantusLeftX+DistanciaCantus,CantusLeftY,-1000), (CantusLeftX+DistanciaCantus,CantusLeftY, 1000)]\n\n        shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')\n\n        batch = batch_for_shader(shader, 'LINES', {\"pos\": coords})\n\n    except:\n        coords = [(CantusRightX,CantusRightY,-1000), (CantusRightX,CantusRightY,1000),(CantusLeftX,CantusLeftY,-1000), (CantusLeftX,CantusLeftY, 1000), (1000, TrichionY, TrichionZ), (-1000, TrichionY, TrichionZ), (1000, STGlabellaY, STGlabellaZ), (-1000, STGlabellaY, STGlabellaZ), (1000, SubnasaleY, SubnasaleZ), (-1000, SubnasaleY, SubnasaleZ), (1000, STMentonY, STMentonZ), (-1000, STMentonY, STMentonZ) ] #, (CantusRightX-DistanciaCantus,CantusRightY,-1000), (CantusRightX-DistanciaCantus,CantusRightY, 1000), (CantusLeftX+DistanciaCantus,CantusLeftY,-1000), (CantusLeftX+DistanciaCantus,CantusLeftY, 1000)]\n\n        shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')\n\n        batch = batch_for_shader(shader, 'LINES', {\"pos\": coords})\n\n    def draw():\n        shader.bind()\n        bgl.glLineWidth(3) # 1 Grossura\n    #    bgl.glDisable(bgl.GL_BLEND)\n    #    bgl.glEnable(bgl.GL_DEPTH_TEST)\n        bgl.glDisable(bgl.GL_DEPTH_TEST)\n    #    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)\n        shader.uniform_float(\"color\", (1, 1, 1, 1))\n        batch.draw(shader)\n\n    global my_draw_handler\n    my_draw_handler = bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')\n\n    bpy.ops.view3d.view_all(center=False)\n\n\nclass RhinVisualizaGL(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.rhin_visualiza_gl\"\n    bl_label = \"Visualiza OpenGL\"\n\n    def execute(self, context):\n        LinhasCentraisCria()\n        return {'FINISHED'}\n\nbpy.utils.register_class(RhinVisualizaGL)\n\n\ndef LinhasCentraisApaga():\n\n    bpy.types.SpaceView3D.draw_handler_remove(my_draw_handler, 'WINDOW')\n    bpy.ops.view3d.view_all(center=False)\n\n\nclass RhinRemoveGL(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.rhin_remove_gl\"\n    bl_label = \"Remove OpenGL\"\n\n    def execute(self, context):\n        LinhasCentraisApaga()\n        return {'FINISHED'}\n\nbpy.utils.register_class(RhinRemoveGL)\n"
  },
  {
    "path": "RhinTools.py",
    "content": "import bpy\nfrom .PontosAnatomicos import *\nfrom .Cefalometria import *\nfrom .FerrMedidas import *\nfrom .FerrImgTomo import * # Importa tratamento de materiais\nfrom math import sqrt\n\nimport bmesh\nfrom mathutils import Matrix, Vector\nfrom time import gmtime, strftime\n\n# PONTOS ANATOMICOS\n\nclass Alar_Cheek_Groove_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_cheek_groove_right_pt\"\n    bl_label = \"Alar Cheek Groove right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Cheek Groove right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Alar Cheek Groove right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Cheek_Groove_right_pt)\n\n\nclass Alar_Cheek_Groove_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_cheek_groove_left_pt\"\n    bl_label = \"Alar Cheek Groove left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Cheek Groove left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Alar Cheek Groove left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Cheek_Groove_left_pt)\n\n\nclass Medial_Canthus_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.medial_canthus_right_pt\"\n    bl_label = \"Medial Canthus right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Medial Canthus right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Medial Canthus right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Medial_Canthus_right_pt)\n\nclass Medial_Canthus_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.medial_canthus_left_pt\"\n    bl_label = \"Medial Canthus left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Medial Canthus left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Medial Canthus left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Medial_Canthus_left_pt)\n\nclass Radix_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.radix_pt\"\n    bl_label = \"Radix\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Radix' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Radix', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Radix_pt)\n\nclass Anterior_Nostril_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.anterior_nostril_left_pt\"\n    bl_label = \"Anterior Nostril left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Anterior Nostril left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Anterior Nostril left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Anterior_Nostril_left_pt)\n\n\nclass Anterior_Nostril_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.anterior_nostril_right_pt\"\n    bl_label = \"Anterior Nostril right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Anterior Nostril right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Anterior Nostril right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Anterior_Nostril_right_pt)\n\n\nclass Posterior_Nostril_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.posterior_nostril_left_pt\"\n    bl_label = \"Posterior Nostril left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Posterior Nostril left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Posterior Nostril left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Posterior_Nostril_left_pt)\n\n\nclass Posterior_Nostril_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.posterior_nostril_right_pt\"\n    bl_label = \"Posterior Nostril right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Posterior Nostril right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Posterior Nostril right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Posterior_Nostril_right_pt)\n\nclass Rhinion_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.rhinion_pt\"\n    bl_label = \"Rhinion\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Rhinion' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Rhinion', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Rhinion_pt)\n\nclass Alar_Groove_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_groove_right_pt\"\n    bl_label = \"Alar Groove right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Groove right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Alar Groove right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Groove_right_pt)\n\nclass Alar_Groove_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_groove_left_pt\"\n    bl_label = \"Alar Groove left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Groove left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Alar Groove left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Groove_left_pt)\n\nclass Supratip_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.supratip_pt\"\n    bl_label = \"Supratip\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Supratip' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Supratip', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Supratip_pt)\n\nclass Infratip_Lobule_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.infratip_lobule_pt\"\n    bl_label = \"Infratip Lobule\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Infratip Lobule' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Infratip Lobule', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Infratip_Lobule_pt)\n\nclass Alar_Rim_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_rim_right_pt\"\n    bl_label = \"Alar Rim right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Rim right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Alar Rim right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Rim_right_pt)\n\nclass Alar_Rim_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.alar_rim_left_pt\"\n    bl_label = \"Alar Rim left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Alar Rim left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Alar Rim left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Alar_Rim_left_pt)\n\nclass Columella_right_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.columella_right_pt\"\n    bl_label = \"Columella right\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Columella right' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Columella right', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Columella_right_pt)\n\nclass Columella_left_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.columella_left_pt\"\n    bl_label = \"Columella left\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Columella left' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CriaPontoDef('Columella left', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Columella_left_pt)\n\n\nclass Trichion_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.trichion_pt\"\n    bl_label = \"Trichion\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Trichion' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Trichion', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Trichion_pt)\n\n\nclass Submental_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.submental_pt\"\n    bl_label = \"Submental\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Submental' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Submental', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Submental_pt)\n\n\nclass Supraglabella_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.supraglabella_pt\"\n    bl_label = \"Supraglabella\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Supraglabella' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Supraglabella', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Supraglabella_pt)\n\nclass Glabella_pt(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.glabella_pt\"\n    bl_label = \"Glabella\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'Glabella' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n    def execute(self, context):\n        CriaPontoDef('Glabella', 'Anatomical Points - Soft Tissue')\n        TestaPontoCollDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(Glabella_pt)\n\n# COPIA FACE\n\ndef CopiaFaceDef():\n    bpy.context.object.name = \"SoftTissueDynamic\"\n    bpy.ops.object.duplicate()\n    bpy.context.object.name = \"SoftTissueDynamic_COPY\"\n\n    FaceCopiada = bpy.data.objects['SoftTissueDynamic_COPY']\n    FaceCopiada.hide_viewport=True\n\n    FaceOriginal = bpy.data.objects['SoftTissueDynamic']\n    FaceOriginal.select_set(True)\n    bpy.context.view_layer.objects.active = FaceOriginal\n\nclass CopiaFace(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.copia_face\"\n    bl_label = \"Copy Face\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    @classmethod\n    def poll(cls, context):\n\n        found = 'SoftTissueDynamic_COPY' in bpy.data.objects\n\n        if found == False:\n            return True\n        else:\n            if found == True:\n                return False\n\n\n    def execute(self, context):\n        CopiaFaceDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(CopiaFace)\n\n\ndef CalculaDistsNarizDef():\n\n    try:\n        bpy.ops.object.mode_set(mode = 'OBJECT')\n    except:\n        print(\"Já em modo objeto.\")\n\n    try:\n        ListaPontos = ['Tip of Nose', 'Subnasale','Radix', 'Anterior Nostril left', 'Posterior Nostril left', 'Anterior Nostril right', 'Posterior Nostril right','Rhinion', 'Alar Groove right', 'Alar Groove left', 'Supratip', 'Infratip Lobule', 'Alar Rim right', 'Alar Rim left', 'Columella right', 'Columella left', 'Alar Cheek Groove right', 'Alar Cheek Groove left']\n\n        for i in ListaPontos:\n    #            print(\"HÁ O NOME!\", i.name)\n            try:\n                bpy.ops.object.select_all(action='DESELECT')\n                ObjetoAtual = bpy.data.objects[i]\n                ObjetoAtual.select_set(True)\n                bpy.context.view_layer.objects.active = ObjetoAtual\n                bpy.ops.object.duplicate()\n                NovoNome = str(bpy.data.objects[i].name)+\"_COPY_MEDIDAS\"\n                bpy.context.object.name = NovoNome\n                bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')\n                bpy.ops.object.select_all(action='DESELECT')\n            except:\n                print(\"Erro ao tentar copiar o objeto:\", i)\n    except:\n        print(\"Erro ao tentar copiar os objetos.\")\n\n    try:\n\n\n        DistRadixTip = DistanciaObjetos(\"Radix_COPY_MEDIDAS\", \"Tip of Nose_COPY_MEDIDAS\")\n\n        CursorToSelectedObjs(\"Alar Cheek Groove right\", \"Alar Cheek Groove left\")\n\n        print(\"HHHHHHHHAAHAHAHHAHAHA\")\n\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=1, view_align=False, enter_editmode=False)\n        bpy.context.object.name = \"Alar Cheek Groove MEIO\"\n\n        DistTipAlar = DistanciaObjetos(\"Tip of Nose_COPY_MEDIDAS\", \"Alar Cheek Groove MEIO\")\n\n        ProporcaoNariz = DistTipAlar / DistRadixTip\n        print(\"ProporcaoNariz\", ProporcaoNariz)\n\n        bpy.types.Scene.rhin_prop_nariz = bpy.props.StringProperty \\\n            (\n                name = \"Nose Proportion\",\n                description = \"Nose Proportion\",\n                default = str(round(ProporcaoNariz, 2))\n            )\n\n        # Apaga objeto criados\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjetoAtual = bpy.data.objects[\"Alar Cheek Groove MEIO\"]\n        ObjetoAtual.select_set(True)\n        bpy.context.view_layer.objects.active = ObjetoAtual\n        bpy.ops.object.delete(use_global=False)\n\n    except:\n        print(\"Problemas ao calcular a proporção do nariz.\")\n\n    try:\n\n        # CRIA PONTOS PARA CALCULAR ANGULO ESQUERDO\n        bpy.ops.object.select_all(action='DESELECT')\n\n        ObjetoAtual = bpy.data.objects[\"Posterior Nostril left_COPY_MEDIDAS\"]\n        ObjetoAtual.select_set(True)\n        bpy.context.view_layer.objects.active = ObjetoAtual\n        bpy.ops.object.duplicate()\n        NovoNome = \"Posterior Nostril left_ABAIXO\"\n        bpy.context.object.name = NovoNome\n        bpy.ops.transform.translate(value=(0, 0, -80))\n        bpy.ops.object.select_all(action='DESELECT')\n\n        # CALCULA ANGULO\n        AnguloNasolabial = CalculaAngulo(\"Anterior Nostril left_COPY_MEDIDAS\", \"Posterior Nostril left_COPY_MEDIDAS\", \"Posterior Nostril left_ABAIXO\")\n\n#        AnguloNasolabial = CalculaAngulo(\"Radix_COPY_MEDIDAS\", \"Tip of Nose_COPY_MEDIDAS\", \"Subnasale_COPY_MEDIDAS\")\n\n        bpy.types.Scene.rhin_angulo_nasolabial_esquerdo = bpy.props.StringProperty \\\n            (\n                name = \"Nasolabial Angle left\",\n                description = \"Nasolabial Angle left\",\n                default = str(AnguloNasolabial) #+\"º\"\n            )\n\n        # Apaga objeto criados\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjetoAtual = bpy.data.objects[\"Posterior Nostril left_ABAIXO\"]\n        ObjetoAtual.select_set(True)\n        bpy.context.view_layer.objects.active = ObjetoAtual\n        bpy.ops.object.delete(use_global=False)\n\n    except:\n        print(\"Não foi possível fazer o cálculo do ângulo nasolabial ESQUERDO.\")\n\n\n    try:\n\n        # CRIA PONTOS PARA CALCULAR ANGULO DIREITO\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjetoAtual = bpy.data.objects[\"Posterior Nostril right_COPY_MEDIDAS\"]\n        ObjetoAtual.select_set(True)\n        bpy.context.view_layer.objects.active = ObjetoAtual\n        bpy.ops.object.duplicate()\n        NovoNome = \"Posterior Nostril right_ABAIXO\"\n        bpy.context.object.name = NovoNome\n        bpy.ops.transform.translate(value=(0, 0, -80))\n        bpy.ops.object.select_all(action='DESELECT')\n\n        # CALCULA ANGULO\n        AnguloNasolabial = CalculaAngulo(\"Anterior Nostril right_COPY_MEDIDAS\", \"Posterior Nostril right_COPY_MEDIDAS\", \"Posterior Nostril right_ABAIXO\")\n\n\n#        AnguloNasolabial = CalculaAngulo(\"Radix_COPY_MEDIDAS\", \"Tip of Nose_COPY_MEDIDAS\", \"Subnasale_COPY_MEDIDAS\")\n\n        bpy.types.Scene.rhin_angulo_nasolabial_direito = bpy.props.StringProperty \\\n            (\n                name = \"Nasolabial Angle right\",\n                description = \"Nasolabial Angle right\",\n                default = str(AnguloNasolabial) #+\"º\"\n            )\n\n        # Apaga objeto criados\n\n        bpy.ops.object.select_all(action='DESELECT')\n        ObjetoAtual = bpy.data.objects[\"Posterior Nostril right_ABAIXO\"]\n        ObjetoAtual.select_set(True)\n        bpy.context.view_layer.objects.active = ObjetoAtual\n        bpy.ops.object.delete(use_global=False)\n\n    except:\n        print(\"Não foi possível fazer o cálculo do ângulo nasolabial DIREITO.\")\n\n\n    try:\n\n        # CALCULA ALAR RIM - COLUMELLA FACTOR - ESQUERDA\n        AnteriorNostrilLeft = bpy.data.objects[\"Anterior Nostril left_COPY_MEDIDAS\"].location[2]\n        PosteriorNostrilLeft = bpy.data.objects[\"Posterior Nostril left_COPY_MEDIDAS\"].location[2]\n\n        NostrileftMedia = (AnteriorNostrilLeft + PosteriorNostrilLeft) / 2\n\n        AlarRimLeft = bpy.data.objects[\"Alar Rim left_COPY_MEDIDAS\"].location[2]\n        FatorAlarRimLeft = abs(AlarRimLeft - NostrileftMedia)\n\n\n        bpy.types.Scene.rhin_alar_rim_med_esquerdo = bpy.props.StringProperty \\\n            (\n                name = \"Alar Rim - Nostril\",\n                description = \"Alar Rim - Nostril\",\n                default = str(round(FatorAlarRimLeft, 2))\n            )\n\n\n        ColumellaLeft = bpy.data.objects[\"Columella left_COPY_MEDIDAS\"].location[2]\n        FatorColumellaLeft = abs(ColumellaLeft - NostrileftMedia)\n        print(\"FatoColumellaLeft:\", FatorColumellaLeft)\n\n        bpy.types.Scene.rhin_columella_med_esquerdo = bpy.props.StringProperty \\\n            (\n                name = \"Columella - Nostril\",\n                description = \"Columella - Nostril\",\n                default = str(round(FatorColumellaLeft, 2))\n            )\n\n    except:\n        print(\"Não foi possível fazer o cálculo do fator Alar Rim-Columella - ESQUERDO.\")\n\n    try:\n\n        # CALCULA ALAR RIM - COLUMELLA FACTOR - DIREITA\n        AnteriorNostrilRight = bpy.data.objects[\"Anterior Nostril right_COPY_MEDIDAS\"].location[2]\n        PosteriorNostrilRight = bpy.data.objects[\"Posterior Nostril right_COPY_MEDIDAS\"].location[2]\n\n        NonstrilRightMedia = (AnteriorNostrilRight + PosteriorNostrilRight) / 2\n\n        AlarRimRight = bpy.data.objects[\"Alar Rim right_COPY_MEDIDAS\"].location[2]\n        print(\"AQUI!!!\")\n        #print(FatorAlarRimRight)\n\n        FatorAlarRimRight = abs(AlarRimRight - NonstrilRightMedia)\n\n\n\n        bpy.types.Scene.rhin_alar_rim_med_direito = bpy.props.StringProperty \\\n            (\n                name = \"Alar Rim - Nostril\",\n                description = \"Alar Rim - Nostril\",\n                default = str(round(FatorAlarRimRight, 2))\n            )\n\n\n        ColumellaRight = bpy.data.objects[\"Columella right_COPY_MEDIDAS\"].location[2]\n        FatorColumellaRight = abs(ColumellaRight - NonstrilRightMedia)\n        print(\"FatoColumellaRight:\", FatorColumellaRight)\n\n        bpy.types.Scene.rhin_columella_med_direito = bpy.props.StringProperty \\\n            (\n                name = \"Columella - Nostril\",\n                description = \"Columella - Nostril\",\n                default = str(round(FatorColumellaRight, 2))\n            )\n\n    except:\n        print(\"Não foi possível fazer o cálculo do fator Alar Rim-Columella - DIREITO.\")\n\n    # APAGA Pontos criados\n\n    try:\n        for i in ListaPontos:\n    #            print(\"HÁ O NOME!\", i.name)\n            try:\n                bpy.ops.object.select_all(action='DESELECT')\n                NomeAtual = str(bpy.data.objects[i].name)+\"_COPY_MEDIDAS\"\n                ObjetoAtual = bpy.data.objects[NomeAtual]\n                ObjetoAtual.select_set(True)\n                bpy.context.view_layer.objects.active = ObjetoAtual\n                bpy.ops.object.delete(use_global=False)\n                bpy.ops.object.select_all(action='DESELECT')\n            except:\n                print(\"Houve problema ao deletar o ponto:\", i)\n    except:\n        print(\"Houve algum problema ao deletar os pontos.\")\n\n\nclass CalculaDistsNariz(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.dist_nariz\"\n    bl_label = \"Nose dists\"\n\n    def execute(self, context):\n\n\n        try:\n            OriginalBool = bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport\n\n            if bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport == True:\n                print(\"XXXXXXXXXX\")\n                bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = False\n        except:\n            print(\"A coleção Anatomical Points - Soft Tissue não existe!\")\n\n\n        CalculaDistsNarizDef()\n\n        try:\n\n            if OriginalBool == False:\n                bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = False\n            else:\n                bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = True\n        except:\n            print(\"A coleção Anatomical Points - Soft Tissue não existe!\")\n\n\n        return {'FINISHED'}\n\n\nbpy.utils.register_class(CalculaDistsNariz)\n\n\n\nclass MostraOcultaPontos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.rhin_mostra_oculta_pontos\"\n    bl_label = \"Nose dists\"\n\n    def execute(self, context):\n\n        try:\n            if bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport == False:\n                print(\"HIDE FALSE\")\n                bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = True\n            else: #bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport == True:\n                print(\"HIDE TRUE\")\n                bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = False\n#                bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = False\n        except:\n            print(\"A coleção Anatomical Points - Soft Tissue não existe!\")\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(MostraOcultaPontos)\n\n\ndef GeraGuiaNarizDef():\n\n    Rosto = bpy.data.objects[\"SoftTissueDynamic\"]\n\n    Pontos = ['Supraglabella', 'ST Glabella', 'Radix', 'Rhinion', 'Supratip', 'Tip of Nose', 'Columella', 'Subnasale', 'Upper Lip']\n\n    coords = []\n\n    for i in Pontos:\n        VetorAtual = bpy.data.objects[i].location\n        VetX = bpy.data.objects[i].location[0]\n        VetY = bpy.data.objects[i].location[1]\n        VetZ = bpy.data.objects[i].location[2]\n        coords.append((VetX, VetY, VetZ))\n\n    curveData = bpy.data.curves.new('myCurve', type='CURVE')\n    curveData.dimensions = '3D'\n    #    curveData.resolution_u = 6\n    curveData.resolution_u = 36\n\n    # map coords to spline\n    polyline = curveData.splines.new('BEZIER')\n    polyline.bezier_points.add(len(coords)-1)\n    #    for i, coord in enumerate(coords):\n    #        x,y,z = coord\n    #        polyline.points[i].co = (x, y, z, 1)\n\n    from bpy_extras.io_utils import unpack_list\n    polyline.bezier_points.foreach_set(\"co\", unpack_list(coords))\n\n    # Apaga pontos\n    bpy.ops.object.select_all(action='DESELECT')\n\n    #for i in Pontos:\n    #    bpy.data.objects[i].select_set(True)\n\n    #bpy.ops.object.delete(use_global=False)\n\n    bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport = True\n\n    # Cria Linha\n    curveOB = bpy.data.objects.new('myCurve', curveData)\n\n    # attach to scene and validate context\n    scn = bpy.context.scene\n    #   scn.objects.link(curveOB)\n    bpy.context.collection.objects.link(curveOB)\n    #scn.collection.objects.link(curveOB) # Esta opção faz com que o objeto criado vá para a Scene Collection!\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.context.view_layer.objects.active = curveOB\n    curveOB.select_set(True)\n\n    bpy.ops.object.editmode_toggle()\n    bpy.ops.curve.select_all(action='SELECT')\n    bpy.ops.curve.handle_type_set(type='AUTOMATIC')\n\n    #bpy.ops.curve.make_segment()\n\n    bpy.ops.object.editmode_toggle()\n\n    bpy.ops.object.modifier_add(type='SHRINKWRAP')\n    bpy.context.object.modifiers[\"Shrinkwrap\"].target = Rosto\n    bpy.context.object.modifiers[\"Shrinkwrap\"].offset = 0.01\n    bpy.context.object.modifiers[\"Shrinkwrap\"].wrap_mode = 'ABOVE_SURFACE'\n\n    #bpy.context.space_data.context = 'MODIFIER'\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Shrinkwrap\")\n    #bpy.context.space_data.context = 'DATA'\n    bpy.context.object.data.bevel_depth = 4\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 6\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n\n    GuiaBaseNome = str(\"GuiaBase-\"+strftime(\"%Y%m%d%H%M%S\", gmtime()))\n    bpy.context.object.name = GuiaBaseNome\n\n    bpy.ops.object.select_all(action='DESELECT')\n    Rosto.select_set(True)\n    bpy.context.view_layer.objects.active = Rosto\n\n    bpy.ops.object.duplicate()\n\n    bpy.context.object.active_shape_key_index = 0 # Seleciona o primeiro para apagar e manter o segundo como forma.\n    bpy.ops.object.shape_key_remove(all=False)\n    bpy.ops.object.shape_key_remove(all=False)\n\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 8\n    bpy.context.object.modifiers[\"Remesh\"].scale = 0.99\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Remesh\")\n\n    NomeFaceNova = str(\"FaceDelete-\"+strftime(\"%Y%m%d%H%M%S\", gmtime()))\n    # strftime(\"%Y-%m-%d %H:%M:%S\", gmtime()))\n\n    bpy.context.object.name = NomeFaceNova\n\n    bpy.ops.object.select_all(action='DESELECT')\n    bpy.data.objects[NomeFaceNova].select_set(True)\n    bpy.data.objects[GuiaBaseNome].select_set(True)\n    bpy.context.view_layer.objects.active = bpy.data.objects[NomeFaceNova]\n\n    bpy.ops.object.booleana_osteo_geral()\n\n    bpy.ops.object.modifier_add(type='REMESH')\n    bpy.context.object.modifiers[\"Remesh\"].mode = 'SMOOTH'\n    bpy.context.object.modifiers[\"Remesh\"].octree_depth = 8\n    bpy.context.object.modifiers[\"Remesh\"].scale = 0.99\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Remesh\")\n\n\n\nclass GeraGuiaNariz(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_guia_nariz\"\n    bl_label = \"Nose Guide Generator\"\n\n    def execute(self, context):\n        GeraGuiaNarizDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(GeraGuiaNariz)\n\n\ndef EsculturaGrabDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.context.space_data.shading.type = 'MATERIAL'\n    bpy.ops.object.mode_set(mode = 'SCULPT')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin_brush.Grab\")\n    bpy.context.scene.tool_settings.sculpt.use_symmetry_x = False\n\n\nclass EsculturaGrab(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.escultura_grab\"\n    bl_label = \"Change to Grab\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT' or bpy.context.mode == 'SCULPT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        EsculturaGrabDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(EsculturaGrab)\n\n\ndef EsculturaSmoothDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.context.space_data.shading.type = 'MATERIAL'\n    bpy.ops.object.mode_set(mode = 'SCULPT')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin_brush.Smooth\")\n    bpy.context.scene.tool_settings.sculpt.use_symmetry_x = False\n\nclass EsculturaSmooth(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.escultura_smooth\"\n    bl_label = \"Change to Smooth\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT' or bpy.context.mode == 'SCULPT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        EsculturaSmoothDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(EsculturaSmooth)\n\n\ndef EsculturaMaskDef():\n\n    context = bpy.context\n    scn = context.scene\n\n    bpy.context.space_data.shading.type = 'MATERIAL'\n    bpy.ops.object.mode_set(mode = 'SCULPT')\n    bpy.ops.wm.tool_set_by_id(name=\"builtin_brush.Mask\")\n    bpy.context.scene.tool_settings.sculpt.use_symmetry_x = False\n\nclass EsculturaMask(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.escultura_mask\"\n    bl_label = \"Change to Mask\"\n\n    @classmethod\n    def poll(cls, context):\n        o = context.object\n        if o is None:\n            return False\n        else:\n            if o.type == \"MESH\":\n                if bpy.context.mode == 'OBJECT' or bpy.context.mode == 'SCULPT':\n                    return True\n                else:\n                    return False\n            else:\n                return False\n\n    def execute(self, context):\n        EsculturaMaskDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(EsculturaMask)\n\n\ndef MaterialTransparentePosDef():\n\n        m = Material()\n        m.set_cycles()\n\n        m.make_material(\"FaceRhinPos\")\n\n        ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n        ImageTexture.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n\n        diffuseBSDF = m.nodes['Principled BSDF']\n#        diffuseBSDF.inputs[\"Base Color\"].default_value = [0.3, 0.2, 0.4, 0.5]\n        materialOutput = m.nodes['Material Output']\n        transparentBSDF = m.makeNode('ShaderNodeBsdfTransparent', 'Transparent BSDF')\n        #bpy.data.node_groups[\"Shader Nodetree\"].nodes[\"Translucent BSDF\"].inputs[0].default_value = (0.8, 0.8, 0.8, 0.00745112)\n\n        mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n        m.dump_node(mixShader)\n        mixShader.inputs['Fac'].default_value = 0.3\n        m.link(transparentBSDF, 'BSDF', mixShader, 1)\n        m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n        m.link(mixShader, 'Shader', materialOutput, 'Surface')\n        m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n\n        bpy.ops.object.material_slot_remove()\n        bpy.ops.object.material_slot_add()\n\n        bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"FaceRhinPos\"]\n\n        bpy.context.object.active_material.blend_method = 'BLEND'\n\n\ndef MaterialTransparentePreDef():\n\n        m = Material()\n        m.set_cycles()\n\n        m.make_material(\"FaceRhinPre\")\n\n        ImageTexture = m.makeNode('ShaderNodeTexImage', 'Image Texture')\n        ImageTexture.image = bpy.data.images['scene_dense_mesh_texture_material_0_map_Kd.jpg']\n\n        diffuseBSDF = m.nodes['Principled BSDF']\n#        diffuseBSDF.inputs[\"Base Color\"].default_value = [0.3, 0.2, 0.4, 0.5]\n        materialOutput = m.nodes['Material Output']\n        transparentBSDF = m.makeNode('ShaderNodeBsdfTransparent', 'Transparent BSDF')\n        #bpy.data.node_groups[\"Shader Nodetree\"].nodes[\"Translucent BSDF\"].inputs[0].default_value = (0.8, 0.8, 0.8, 0.00745112)\n\n        mixShader = m.makeNode('ShaderNodeMixShader', 'Mix Shader')\n        m.dump_node(mixShader)\n        mixShader.inputs['Fac'].default_value = 0.3\n        m.link(transparentBSDF, 'BSDF', mixShader, 1)\n        m.link(diffuseBSDF, 'BSDF', mixShader, 2)\n        m.link(mixShader, 'Shader', materialOutput, 'Surface')\n        m.link(ImageTexture, 'Color', diffuseBSDF, 'Base Color')\n\n        bpy.ops.object.material_slot_remove()\n        bpy.ops.object.material_slot_add()\n\n        bpy.data.objects[bpy.context.view_layer.objects.active.name].active_material = bpy.data.materials[\"FaceRhinPre\"]\n\n        bpy.context.object.active_material.blend_method = 'BLEND'\n\n\nclass MaterialTransparenteDois(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.material_transparente_dois\"\n    bl_label = \"Material Transparente Pre\"\n\n    def execute(self, context):\n        bpy.data.objects['SoftTissueDynamic_COPY'].hide_viewport = False\n        FacePre = bpy.data.objects['SoftTissueDynamic_COPY']\n        bpy.ops.object.select_all(action='DESELECT')\n        FacePre.select_set(True)\n        bpy.context.view_layer.objects.active = FacePre\n        MaterialTransparentePreDef()\n\n        bpy.data.objects['SoftTissueDynamic'].hide_viewport = False\n        FacePos = bpy.data.objects['SoftTissueDynamic']\n        bpy.ops.object.select_all(action='DESELECT')\n        FacePos.select_set(True)\n        bpy.context.view_layer.objects.active = FacePos\n        MaterialTransparentePosDef()\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(MaterialTransparenteDois)\n\n\ndef MaterialTranspPreDef():\n    bpy.data.materials['FaceRhinPre'].node_tree.nodes[\"Mix Shader\"].inputs[0].default_value = float(bpy.context.scene.mat_transp_pre)\n\nclass MaterialTranspPre(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.material_transp_pre\"\n    bl_label = \"Material Transparente Pre\"\n\n    def execute(self, context):\n        MaterialTranspPreDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(MaterialTranspPre)\n\n\ndef MaterialTranspPosDef():\n    bpy.data.materials['FaceRhinPos'].node_tree.nodes[\"Mix Shader\"].inputs[0].default_value = float(bpy.context.scene.mat_transp_pos)\n\n\nclass MaterialTranspPos(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.material_transp_pos\"\n    bl_label = \"Material Transparente Pos\"\n\n    def execute(self, context):\n        MaterialTranspPosDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(MaterialTranspPos)\n\nclass MaterialOpacoDois(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.material_opaco_dois\"\n    bl_label = \"Material Opaco Dois\"\n\n    def execute(self, context):\n        bpy.data.objects['SoftTissueDynamic_COPY'].hide_viewport = False\n        FacePre = bpy.data.objects['SoftTissueDynamic_COPY']\n        bpy.ops.object.select_all(action='DESELECT')\n        FacePre.select_set(True)\n        bpy.context.view_layer.objects.active = FacePre\n        bpy.context.object.active_material.blend_method = 'OPAQUE'\n        #FacePre.hide_viewport = True\n\n        bpy.data.objects['SoftTissueDynamic'].hide_viewport = False\n        FacePos = bpy.data.objects['SoftTissueDynamic']\n        bpy.ops.object.select_all(action='DESELECT')\n        FacePos.select_set(True)\n        bpy.context.view_layer.objects.active = FacePos\n        bpy.context.object.active_material.blend_method = 'OPAQUE'\n\n        bpy.context.space_data.shading.type = 'SOLID'\n        bpy.context.space_data.shading.color_type = 'TEXTURE'\n\n        return {'FINISHED'}\n\nbpy.utils.register_class(MaterialOpacoDois)\n\ndef RhinFotogrametriaDecDef():\n\n    bpy.ops.object.select_all(action='DESELECT')\n\n    bpy.ops.object.gera_modelo_foto()\n\n    bpy.ops.object.modifier_add(type='DECIMATE')\n    bpy.context.object.modifiers[\"Decimate\"].ratio = 0.5\n    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=\"Decimate\")\n\n\nclass RhinFotogrametriaDec(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.rhin_fotogrametria_dec\"\n    bl_label = \"Rhin Photogrammetry Decimate\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n        RhinFotogrametriaDecDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(RhinFotogrametriaDec)\n"
  },
  {
    "path": "SegmentaImagens.py",
    "content": "import bpy\nimport tempfile\nimport platform\nimport os\n\nfrom .AjustaTomo import *\nfrom .FotogrametriaOpenMVG import *\n\ndef SegmentacaoImagemFaceDef():\n\n    context = bpy.context\n#    obj = context.object\n    scn = context.scene\n\n    TmpDirSegFace = tempfile.mkdtemp()\n    SegFaceScript = TmpDirSegFace+'/SegmentaFace.py'\n\n    homeall = expanduser(\"~\")\n\n# -------- HEIC\n\n    ConverteHEICtoJPG()\n\n# ------------\n\n    with open(SegFaceScript, \"a\") as ScriptF:\n        ScriptF.write(\"from imutils import face_utils\\n\")\n        ScriptF.write(\"import imutils\\n\")\n        ScriptF.write(\"import numpy as np\\n\")\n        ScriptF.write(\"import collections\\n\")\n        ScriptF.write(\"import dlib\\n\")\n        ScriptF.write(\"import cv2\\n\")\n        ScriptF.write(\"from os.path import expanduser\\n\")\n        ScriptF.write(\"import platform\\n\")\n        ScriptF.write(\"import os\\n\")\n        ScriptF.write(\"from os import listdir\\n\")\n        ScriptF.write(\"from os.path import isfile, join\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"def face_remap(shape):\\n\")\n        ScriptF.write(\"    remapped_image = cv2.convexHull(shape)\\n\")\n        ScriptF.write(\"    return remapped_image\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"def GeraImagemComMascara(imgOriginal, imgFinal):\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    image = cv2.imread(imgOriginal)\\n\")\n        Arquivo = os.listdir(scn.my_tool.path_photo)[0]\n        Imagem = bpy.data.images.load(scn.my_tool.path_photo+Arquivo)\n        Largura = str(Imagem.size[1])\n        print(\"A largura é:\", Largura)\n        ScriptF.write(\"    image = imutils.resize(image, width=\"+Largura+\")\\n\")\n        ScriptF.write(\"    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    out_face = np.zeros_like(image)\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    detector = dlib.get_frontal_face_detector()\\n\")\n        if platform.system() == \"Linux\":\n            ScriptF.write(\"    predictor = dlib.shape_predictor('/home/linux3dcs/Programs/OrtogOnBlender/SegmentaImagens/shape_predictor_81_face_landmarks.dat')\\n\")\n        if platform.system() == \"Windows\":\n            ScriptF.write(\"    predictor = dlib.shape_predictor('C:\\OrtogOnBlender\\SegmentaImagens\\shape_predictor_81_face_landmarks.dat')\\n\")\n        if platform.system() == \"Darwin\":\n            ScriptF.write(\"    predictor = dlib.shape_predictor('\"+homeall+\"/Programs/OrtogOnBlender/SegmentaImagens/shape_predictor_81_face_landmarks.dat')\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    rects = detector(gray, 1)\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    for (i, rect) in enumerate(rects):\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"       shape = predictor(gray, rect)\\n\")\n        ScriptF.write(\"       shape = face_utils.shape_to_np(shape)\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"       remapped_shape = np.zeros_like(shape)\\n\")\n        ScriptF.write(\"       feature_mask = np.zeros((image.shape[0], image.shape[1]))\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"       remapped_shape = face_remap(shape)\\n\")\n        ScriptF.write(\"       cv2.fillConvexPoly(feature_mask, remapped_shape[0:27], 1)\\n\")\n        ScriptF.write(\"       feature_mask = feature_mask.astype(np.bool)\\n\")\n        ScriptF.write(\"       out_face[feature_mask] = image[feature_mask]\\n\")\n        ScriptF.write(\"       cv2.imshow('mask_inv', out_face)\\n\")\n        ScriptF.write(\"       cv2.imwrite(imgFinal, out_face)\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"def AdicionaModeloDistanciaFocal(diretorioFinalFotos):\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    homeall = expanduser('~')\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    if platform.system() == 'Linux':\\n\")\n        ScriptF.write(\"        os.system('cd '+diretorioFinalFotos+' && exiftool -overwrite_original -Model=\\\"Z00AD\\\" -FocalLength=\\\"3.8 mm\\\" *')\\n\")\n        # '+homeall+'/Programs/OrtogOnBlender/openMVG/ExifTool.sh\n        # exiftool -overwrite_original -Model=\"Z00AD\" -FocalLength=\"3.8 mm\" *\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    if platform.system() == 'Darwin':\\n\")\n        ScriptF.write(\"        os.system('cd '+diretorioFinalFotos+' && /OrtogOnBlender/openMVGMACelcap/ExifTool.sh')\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"    if platform.system() == 'Windows':\\n\")\n        ScriptF.write(\"        print(mypath)\\n\")\n        ScriptF.write(\"        subprocess.call(['C:\\OrtogOnBlender\\ExitTool\\exiftool.exe', '-overwrite_original', '-Model=\\\"Z00AD\\\"', '-FocalLength=4', diretorioFinalFotos+'*'])\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"dirOrigi = '/home/linux3dcs/prj/Estudos/DLIB/ROSTO/'\\n\")\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            ScriptF.write(\"os.mkdir('\"+TmpDirSegFace+\"/SegmentedPhotos')\\n\")\n        if platform.system() == \"Windows\":\n            ScriptF.write(\"os.mkdir(r'\"+TmpDirSegFace+\"/SegmentedPhotos')\\n\")\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            ScriptF.write(\"dirFinal = '\"+TmpDirSegFace+\"/SegmentedPhotos/'\\n\")\n        if platform.system() == \"Windows\":\n            ScriptF.write(\"dirFinal = r'\"+TmpDirSegFace+\"/SegmentedPhotos/'\\n\")\n        ScriptF.write(\"\\n\")\n        if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n            ScriptF.write(\"mypath = '\"+scn.my_tool.path_photo+\"'\\n\")\n        if platform.system() == \"Windows\":\n            ScriptF.write(\"mypath = '\"+scn.my_tool.path_photo+\"\\\\'\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\\n\")\n        ScriptF.write(\"\\n\")\n        ScriptF.write(\"for i in onlyfiles:\\n\")\n        ScriptF.write(\"    GeraImagemComMascara(mypath+i, dirFinal+i)\\n\")\n        ScriptF.write(\"    print('Image '+i+' Finished!')\\n\")\n        ScriptF.write(\"AdicionaModeloDistanciaFocal(dirFinal)\\n\")\n        ScriptF.close()\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        os.system('python3 '+TmpDirSegFace+'/SegmentaFace.py')\n        scn.my_tool.path_photo = TmpDirSegFace+\"/SegmentedPhotos/\"\n        abrir_diretorio(TmpDirSegFace+\"/SegmentedPhotos/\")\n\n    if platform.system() == \"Windows\":\n        os.system('C:\\OrtogOnBlender\\Python36\\python '+TmpDirSegFace+'/SegmentaFace.py')\n        scn.my_tool.path_photo = TmpDirSegFace+\"/SegmentedPhotos/\"\n        abrir_diretorio(TmpDirSegFace+\"/SegmentedPhotos/\")\n\nclass SegmentacaoImagemFace(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.segmenta_imagem_face\"\n    bl_label = \"Imagem Segmentation\"\n\n    def execute(self, context):\n        SegmentacaoImagemFaceDef()\n        return {'FINISHED'}\n\nbpy.utils.register_class(SegmentacaoImagemFace)\n"
  },
  {
    "path": "TomoReconsRapida.py",
    "content": "import bpy\nimport os\nimport pydicom as dicom\nfrom collections import Counter\nimport tempfile\nimport shutil\nimport subprocess\nimport platform\n\ndef GeraModelo3DTomo(ossos, mole, dentes):\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    #if ReducaoTomo == \"REDUZIR\": # NÃO USAR!!!\n    #    bpy.ops.object.reduz_dimensao_dicom() # NÃO USAR!!!\n\n    bpy.ops.object.corrige_dicom()\n    bpy.ops.object.corrige_tomo_raw()\n\n    bpy.context.scene.interesse_ossos = ossos\n    bpy.context.scene.interesse_mole = mole\n    bpy.context.scene.interesse_dentes = dentes\n\n    print(\"TENTATIVA 1\")\n    try:\n        bpy.ops.object.gera_modelo_tomo_manual()\n    except:\n        print(\"\\nERROO!\")\n        print(\"TENTATIVA 2\")\n        scn.my_tool.path = tmpdirTomo\n        bpy.ops.object.gera_modelo_tomo_manual()\n\n\ndef CorrigeTomoRawDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n    os.chdir(scn.my_tool.path)\n\n    if platform.system() == \"Linux\" or platform.system() == \"Darwin\":\n        subprocess.call('for i in *; do gdcmconv -w -i $i -o '+tmpdirTomo2+'/$i; done', shell=True)\n        print(\"Tomografia corrigida!!!\")\n\n    if platform.system() == \"Windows\":\n        subprocess.call('for %f in (*) do C:\\OrtogOnBlender\\GDCM\\gdcmconv -w -i %f -o '+tmpdirTomo2+'/%f', shell=True)\n        print(\"Tomografia corrigida!!!\")\n\n    scn.my_tool.path = tmpdirTomo2\n\nclass CorrigeTomoRaw(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.corrige_tomo_raw\"\n    bl_label = \"CT-Scan fix raw\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n            CorrigeTomoRawDef()\n            return {'FINISHED'}\n\nbpy.utils.register_class(CorrigeTomoRaw)\n\n\ndef TomoRecRapidaDef():\n\n    context = bpy.context\n    obj = context.object\n    scn = context.scene\n\n\n    DirTomoOriginal = scn.my_tool.path\n\n    # Listar todos os arquivos\n\n    ListaArquivosAbs = []\n\n\n    #DiretorioDCM = '/home/linux3dcs/del/TOMOGRAFIAS_ESTUDOS/DAVI/000'\n\n    for dirname, dirnames, filenames in os.walk(scn.my_tool.path):\n\n        for filename in filenames:\n            print(os.path.join(dirname, filename))\n            ListaArquivosAbs.append(os.path.join(dirname, filename))\n\n    #print(ListaArquivosAbs)\n\n    ListaConvolutionKernel = []\n    ListaSeriesNumber = []\n    ListaArquivosDICOM = []\n    #ListaInstanceCreationTime = []\n\n    NaoEhDICOM = []\n\n    # Pesquisa os arquivos\n    for ArquivoAtual in ListaArquivosAbs:\n        try:\n            ds = dicom.dcmread(ArquivoAtual, force=True)\n\n            ListaArquivosDICOM.append(ArquivoAtual)\n\n            #print(\"SERIESSSSSS\", ds.SeriesNumber)\n            if ds.SeriesNumber == \"\":\n                try:\n                    ds.SeriesNumber = \"198291829182\"\n                    ds.save_as(str(ArquivoAtual))\n                    print(\"SALVOOOO\")\n                except:\n                    print(\"PROBLEMA NA INSERÇÃO!\")\n            #ListaInstanceCreationTime.append(ds.InstanceCreationTime)\n            try:\n                ListaSeriesNumber.append(ds.SeriesNumber)\n            except:\n                print(\"Problem com o SeriesNumer\")\n                print(\"Series:\", ArquivoAtual)\n\n            try:\n                ListaConvolutionKernel.append(ds.ConvolutionKernel)\n            except:\n                print(\"ConvKernel:\", ArquivoAtual)\n\n        except:\n           NaoEhDICOM.append(ArquivoAtual)\n    #       print(ArquivoAtual, \"Não é!\")\n\n\n    print(\"FINISHED!\")\n\n    #for i in NaoEhDICOM:\n    #    print(i, \"Não é DICOM!\")\n\n    #print(DiretorioDCM)\n    #print(Counter(ListaInstanceCreationTime))\n    print(Counter(ListaSeriesNumber))\n    try:\n        print(Counter(ListaConvolutionKernel))\n    except:\n        print(\"Problema ao imprimir o ConvKernel\")\n\n    SeriesValores = Counter(ListaSeriesNumber)\n\n    print(\"SERIES\")\n\n    print(SeriesValores)\n\n    listaSeries = []\n\n    for i in SeriesValores:\n        if i == '':\n            i = \"2312457886300\"\n        listaSeries.append([SeriesValores[i], int(i)])\n\n    print(\"ORDEM ORIGINAL\")\n    print(listaSeries)\n\n    # Calcula o número de arquivos por diretório\n    print(\"SORT\")\n    listaFinal = sorted(listaSeries, reverse=True)\n    print(sorted(listaSeries, reverse=True))\n\n    print(\"Diretório com mais arquivos:\", listaFinal[0][1])\n\n    DiretorioFinal = listaFinal[0][1]\n\n\n    # Copia os arquivos para diretório temporário\n\n    global tmpdirTomo\n    global tmpdirTomo2\n    tmpdirTomo = tempfile.mkdtemp()\n    tmpdirTomo2 = tempfile.mkdtemp()\n\n    DCMNum = 0\n\n    for ArquivoAtual in ListaArquivosDICOM:\n\n        ds = dicom.dcmread(ArquivoAtual, force=True)\n\n\n        try:\n            if ds.SeriesNumber == DiretorioFinal:\n                #print(ds.SeriesNumber )\n\n                os.chdir(tmpdirTomo)\n\n                shutil.copy(ArquivoAtual, \"Copy-\"+str(DCMNum))\n                #print(\"Copiado de: \", ArquivoAtual, \" Para: \", \"Copy-\"+str(DCMNum))\n                DCMNum += 1\n        except:\n            print(\"Erro de leitura do SeriesNumber no:\", ArquivoAtual)\n\n    scn.my_tool.path = tmpdirTomo\n\n\n    print(\"Arquivos DICOM copiados!\")\n\n    # Captura o 0018,1210 do primeiro arquivo\n\n    ArquivoTopo = os.listdir(os.getcwd())[0]\n    print(\"Arquivo topo:\", ArquivoTopo)\n\n    ds = dicom.dcmread(ArquivoTopo, force=True)\n\n    #global ReducaoTomo\n\n    try:\n        ConvKernel = ds.ConvolutionKernel\n\n        print(\"ConvolutionKernel:\", ConvKernel)\n    except:\n        ConvKernel = \"\"\n        print(\"Erro no ConvKernel!\")\n\n    try:\n        Manufacturer = ds.Manufacturer\n\n        print(\"Manufacturer\", Manufacturer)\n    except:\n        Manufacturer = \"\"\n        print(\"Erro no Manufacturer!\")\n\n    '''\n    try:\n        DimPixelsX = ds.Rows\n        DimPixelsY = ds.Columns\n\n        if DimPixelsX > 512 or DimPixelsY > 512:\n            ReducaoTomo = \"REDUZIR\"\n        else:\n            ReducaoTomo = \"NAO REDUZIR\"\n\n    except:\n        ReducaoTomo = \"Problema\"\n        print(\"Problema ao verificar as dimensões\")\n    '''\n\n    # Reconstrói tomografia HELICOIDAL\n\n\n    if not ConvKernel == \"\" and not Manufacturer == \"NewTom\":\n\n        try:\n            print(\"Há ConvKernel!\")\n\n            if ConvKernel == \"FC03\" or ConvKernel ==\"FC04\" or ConvKernel == \"STANDARD\" or ConvKernel == \"H30s\" or ConvKernel == \"SOFT\" or ConvKernel == \"UB\" or ConvKernel == \"SA\" or ConvKernel == \"FC23\" or ConvKernel == \"FC08\" or ConvKernel == ['Hr40f', '3'] or ConvKernel == \"FC21\" or ConvKernel ==\"A\" or ConvKernel ==\"FC02\" or ConvKernel ==\"B\" or ConvKernel ==\"H23s\" or ConvKernel ==\"H20s\" or ConvKernel == \"H31s\" or ConvKernel == \"H32s\" or ConvKernel == ['J30s', '3'] or ConvKernel == \"H40s\" or ConvKernel == \"H31s\" or ConvKernel == \"B41s\" or ConvKernel == \"B70s\" or ConvKernel == \"H22s\" or ConvKernel == ['J30f', '2'] or ConvKernel == \"H20f\" or ConvKernel == \"FC68\" or ConvKernel == \"FC07\" or ConvKernel == \"B30s\" or ConvKernel == \"B41s\" or ConvKernel == ['I31f', '3'] or ConvKernel == ['Br40f', '3'] or ConvKernel == \"D10f\" or ConvKernel == \"B45s\" or ConvKernel == \"B26f\" or ConvKernel == \"B30f\" or ConvKernel == \"32\" or ConvKernel == \"SB\":\n\n                GeraModelo3DTomo(\"200\", \"-300\", \"1430\")\n\n\n            if ConvKernel == \"BONE\" or ConvKernel ==\"BONEPLUS\" or ConvKernel ==\"FC30\" or ConvKernel ==\"H70s\" or ConvKernel ==\"D\" or ConvKernel ==\"EA\" or ConvKernel == ['Hr60f', '3'] or ConvKernel ==\"FC81\" or ConvKernel ==\"YC\" or ConvKernel ==\"YD\" or ConvKernel ==\"H70h\" or ConvKernel ==\"H60s\" or ConvKernel == \"H60f\" or ConvKernel == \"FC35\" or ConvKernel == \"B80s\" or ConvKernel == \"H90s\" or ConvKernel == ['I70f', '3'] or ConvKernel == \"B70f\":\n\n                GeraModelo3DTomo(\"400\", \"-300\", \"995\")\n\n        except:\n\n            # Usa o diretório FIXED em caso de erro com o gdcmconv\n\n            print(\"Problema na reconstrução... tentando outro meio:\")\n\n            DirTemporario = tempfile.gettempdir()\n\n            if os.path.isfile(DirTemporario+\"/tmpdirFIXED.txt\"):\n                arquivo = open(DirTemporario+\"/tmpdirFIXED.txt\", 'r')\n                DiretorioFIXED = arquivo.read()\n                arquivo.close()\n\n                scn.my_tool.path = DiretorioFIXED\n\n                bpy.ops.object.gera_modelo_tomo_manual()\n\n            if not os.path.isfile(DirTemporario+\"/tmpdirFIXED.txt\"):\n                print(\"Infelizmente não foi possível reconstruir, tente exportar no Slicer!\")\n\n\n    # Reconstrói tomografia CONE BEAM\n\n    # Excepcionalmente!\n    if not ConvKernel == \"\" and Manufacturer == \"NewTom\":\n            GeraModelo3DTomo(\"606\", \"-466\", \"1032\")\n\n    # Normal\n    if ConvKernel == \"\" and not Manufacturer == \"\":\n        print(\"Tentando pelo modelo...\")\n\n        if Manufacturer == \"Imaging Sciences International\":\n            GeraModelo3DTomo(\"358\", \"-629\", \"995\")\n\n        if Manufacturer == \"Xoran Technologies ®\":\n            GeraModelo3DTomo(\"331\", \"-679\", \"1052\")\n\n        if Manufacturer == \"Planmeca\":\n            GeraModelo3DTomo(\"330\", \"-548\", \"756\")\n\n        if Manufacturer == \"J.Morita.Mfg.Corp.\":\n            GeraModelo3DTomo(\"487\", \"-315\", \"787\")\n\n        if Manufacturer == \"Carestream Health\":\n            GeraModelo3DTomo(\"388\", \"-598\", \"1013\")\n\n        if Manufacturer == \"NewTom\":\n            GeraModelo3DTomo(\"606\", \"-466\", \"1032\")\n\n        if Manufacturer == \"MyRay\":\n            GeraModelo3DTomo(\"850\", \"-360\", \"1735\")\n\n        if Manufacturer == \"NIM\":\n            GeraModelo3DTomo(\"1300\", \"-1\", \"1260\")\n\n        if Manufacturer == \"PreXion\":\n            GeraModelo3DTomo(\"312\", \"-687\", \"1505\")\n\n        if Manufacturer == \"Sirona\":\n            GeraModelo3DTomo(\"590\", \"-170\", \"780\")\n\n        if Manufacturer == \"Dabi Atlante\":\n            GeraModelo3DTomo(\"575\", \"-375\", \"1080\")\n\n        if Manufacturer == \"INSTRUMENTARIUM DENTAL\":\n            GeraModelo3DTomo(\"430\", \"-480\", \"995\")\n\n\nclass TomoRecRapida(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelotomo_rec_rapida\"\n    bl_label = \"CT-Scan fast auto reconstruction\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def execute(self, context):\n            TomoRecRapidaDef()\n            return {'FINISHED'}\n\nbpy.utils.register_class(TomoRecRapida)\n"
  },
  {
    "path": "Version.py",
    "content": "import bpy\n\nVERSION = \"2020-08-18a-lin\"\n"
  },
  {
    "path": "__init__.py",
    "content": "bl_info = {\n    \"name\": \"New Object\",\n    \"author\": \"Your Name Here\",\n    \"version\": (1, 0),\n    \"blender\": (2, 80, 0),\n    \"location\": \"View3D > Add > Mesh > New Object\",\n    \"description\": \"OrtogOnBlender\",\n    \"warning\": \"\",\n    \"wiki_url\": \"\",\n    \"category\": \"Ortog\",\n}\n\nif \"bpy\" in locals():\n    import imp\n    imp.reload(ImportaArmature)\n#    imp.reload(GeraModelosTomo)\n    print(\"Reloaded multifiles\")\nelse:\n    from .SegmentaImagens import *\n    from .CompareOnBlender import *\n    from .RhinOnBlender import *\n    from .ForensicOnBlender import *\n    from .OtherOnBlender import *\n    from .NomePaciente import *\n    from .GeraModelosTomo import *\n    from .AjustaTomo import *\n    from .OrtogMeshes import *\n    from .Version import *\n    from .FerrSegmentacao import *\n    from .FerrMedidas import *\n    from .BooleanaOsteo import *\n    from .AlinhaObjetos import *\n    from .FotogrametriaOpenMVG import *\n    from . FotogrametriaOpenMVGWinWSL import * # Solcao erro Windows\n    from .FotogrametriaSMVS import *\n    from .FotogrametriaMeshroom import *\n#    from .AlinhaTresPontosNovo import *\n    from .AlinhaRedimensiona import *\n    from .DesenhaObjetos import *\n    from .FerrFisica import *\n    from .ConfOsteotomiaAuto import *\n    from .DinamicaMole import *\n    from .AtualizaScript import *\n    from .PontosAnatomicos import *\n    from .DesenhaGuia import *\n    from .RelatorioAnimacao import *\n    from .Poisson import *\n    from .FerrImgTomo import *\n    from .Cefalometria import *\n    from .GeraRelatorio import *\n    from .CriaSplint import *\n    from .FerrMalhas import *\n\n\nimport bpy\n\nfrom bpy_extras.object_utils import AddObjectHelper, object_data_add\n\nfrom bpy.props import (StringProperty,\n                       PointerProperty,\n                       BoolProperty,\n                       )\nfrom bpy.types import (Panel,\n                       Operator,\n                       AddonPreferences,\n                       PropertyGroup,\n                       )\n\n# Comandos Booleanos\n\n\n# ATUALIZA SCRIPT\nclass ORTOG_PT_AtualizaAddonSec(bpy.types.Panel):\n    bl_label = \"Upgrade Script\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"VERSION: \"+VERSION)\n\n        row = layout.row()\n        row.operator(\"object.atualiza_script\", text=\"UPGRADE ORTOG!\", icon=\"RECOVER_LAST\")\n\n\nclass ORTOG_PT_NomePaciente(bpy.types.Panel):\n    bl_label = \"Patient's Name\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        scene = context.scene\n#        rd = scene.render\n\n#        row = layout.row()\n#        row.label(text=\"CT-Scan Reconstruction:\")\n\n#        col = layout.column(align=True)\n#        col.prop(scn.my_tool, \"path\", text=\"\")\n\n        row = layout.row()\n#        row.operator(\"object.tomo_heli\", text=\"CT-Scan\")\n#        row.operator(\"object.tomo_cone\", text=\"CBCT\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"nome_paciente\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"sobrenome_paciente\")\n\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n\nclass ORTOG_UI_Local(PropertyGroup):\n\n    path = StringProperty(\n        name=\"\",\n        description=\"Path to Directory\",\n        maxlen=1024,\n        subtype='DIR_PATH')\n\n    path_slices_img = StringProperty(\n        name=\"\",\n        description=\"Path to Directory\",\n        maxlen=1024,\n        subtype='DIR_PATH')\n\n    path_photo = StringProperty(\n        name=\"\",\n        description=\"Path to Directory\",\n        maxlen=1024,\n        subtype='DIR_PATH')\n\n    filepathmha = StringProperty(\n        name=\"\",\n        description=\"Select File\",\n        maxlen=1024,\n        subtype='FILE_PATH')\n\n    filepathcsv = StringProperty(\n        name=\"\",\n        description=\"Select File\",\n        maxlen=1024,\n        subtype='FILE_PATH')\n\n    filepathobj = StringProperty(\n        name=\"\",\n        description=\"Select File\",\n        maxlen=1024,\n        subtype='FILE_PATH')\n\n    filepathvideo = StringProperty(\n        name=\"\",\n        description=\"Select File\",\n        maxlen=1024,\n        subtype='FILE_PATH')\n\n    imagem_bool = BoolProperty(\n        name=\"\",\n        description=\"Decrease picture size!\",\n        default = True\n    )\n\n\n# IMPORTA TOMO MOLDES\n\nclass ENUM_VALUES_CTSCAN:\n    MANUAL = 'Manual'\n    DEFAULT = 'Default'\n    VOXEL = 'Voxel'\n    VOXEL_FULL = 'Voxel Full'\n    AUTO = 'Auto'\n    CUSTOM = 'Custom'\n    AUTOEXP = 'Auto EXP.!!!'\n\nclass ORTOG_PT_CTScanSelect(bpy.types.Panel):\n    bl_label = \"CT-Scan Reconstruction\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.prop(scn, \"my_enum_ct\")\n\n        my_enum_ct = scn.my_enum_ct\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.MANUAL:\n            row = layout.row()\n            row.label(text=\"CT-Scan Preparing:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n    #        layout.prop(rd, \"filepath\", text=\"\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.ajusta_tomo\", text=\"Organize\", icon=\"NODETREE\")\n\n\n            row = layout.row()\n            row = layout.row()\n    #        row.label(text=\"CT-Scan Fix:\")\n    #        col = layout.column(align=True)\n    #        col.prop(scn.my_tool, \"path\", text=\"\")\n    #        row = layout.row()\n    #        row.operator(\"object.corrige_dicom\", text=\"Fix it!\", icon=\"FILE_TICK\")\n\n            row = layout.row()\n            row.label(text=\"Threshold Setup:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n            row = layout.row()\n            row.operator(\"object.abre_slicer\", text=\"Open Slicer!\", icon=\"FILE_TICK\")\n\n\n            row = layout.row()\n            row.label(text=\"CT-Scan 3D Reconstruction:\")\n\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n\n            row = layout.row()\n    #        row.operator(\"object.tomo_heli\", text=\"CT-Scan\")\n    #        row.operator(\"object.tomo_cone\", text=\"CBCT\")\n\n\n            col = self.layout.column(align = True)\n            #col.scale_y=1.5\n            col.alignment = 'CENTER'\n            col.prop(context.scene, \"interesse_ossos\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'CENTER'\n            col.prop(context.scene, \"interesse_mole\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'CENTER'\n            col.prop(context.scene, \"interesse_dentes\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n    #        row.operator(\"object.gera_modelos_tomo\", text=\"Convert DICOM to 3D\", icon=\"SNAP_FACE\")\n            row.operator(\"object.gera_modelo_tomo_manual\", text=\"Convert DICOM to 3D\", icon=\"SNAP_FACE\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_tomo\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.DEFAULT:\n\n            #row = layout.row()\n            #row.label(text=\"Default CT-Scan Reconstruction:\")\n\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelotomo_rec_rapida\", text=\"CT-Scan Reconstruction\", icon=\"SNAP_FACE\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_tomo_auto\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.VOXEL:\n\n            row = layout.row()\n            row.label(text=\"CT-Scan Preparing:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n            row = layout.row()\n            row.operator(\"object.ajusta_tomo\", text=\"Organize\", icon=\"NODETREE\")\n\n\n            row = layout.row()\n            row.label(text=\"CT-Scan Voxel Importing:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n    #        layout.prop(rd, \"filepath\", text=\"\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.importa_fatias_dcm\", text=\"Import DICOM Slices\", icon=\"ALEMBIC\")\n\n    #        row = layout.row()\n    #        prefs = context.preferences\n    #        system = prefs.system\n    #        row.prop(system, \"gl_clip_alpha\", slider=True)\n\n            row = layout.row()\n            row.label(text=\"View/Shader/Material:\")\n\n            scene = context.scene\n            props = scene.eevee\n            self.layout.prop(props, \"use_gtao\", text=\"Ambient Occlusion\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_osso\", text=\"Bone\", icon=\"NODE_MATERIAL\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_musculo\", text=\"Muscle\", icon=\"NODE_MATERIAL\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_pele\", text=\"Skin\", icon=\"NODE_MATERIAL\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_default\", text=\"Default\", icon=\"NODE_MATERIAL\")\n\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_voxel\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.VOXEL_FULL:\n\n            row = layout.row()\n            row.label(text=\"CT-Scan Preparing:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n            row = layout.row()\n            row.operator(\"object.ajusta_tomo\", text=\"Organize\", icon=\"NODETREE\")\n\n\n            row = layout.row()\n            row.label(text=\"CT-Scan Voxel Importing:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n    #        layout.prop(rd, \"filepath\", text=\"\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.importa_fatias_axial_coronal_sagital\", text=\"Import DICOM Slices\", icon=\"ALEMBIC\")\n\n    #        row = layout.row()\n    #        prefs = context.preferences\n    #        system = prefs.system\n    #        row.prop(system, \"gl_clip_alpha\", slider=True)\n\n            row = layout.row()\n            row.label(text=\"View/Shader/Material:\")\n\n            scene = context.scene\n            props = scene.eevee\n            self.layout.prop(props, \"use_gtao\", text=\"Ambient Occlusion\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_osso\", text=\"Bone\", icon=\"NODE_MATERIAL\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_musculo\", text=\"Muscle\", icon=\"NODE_MATERIAL\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_pele\", text=\"Skin\", icon=\"NODE_MATERIAL\")\n\n            row = layout.row()\n            row.operator(\"object.voxelshader_default\", text=\"Default\", icon=\"NODE_MATERIAL\")\n\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_voxel\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.AUTO:\n\n            row = layout.row()\n            row.label(text=\"Automatic Reconstruction:\")\n\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelos_tomo_auto\", text=\"AUTOMATIC DICOM TO 3D\", icon=\"SNAP_FACE\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_tomo_auto\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.CUSTOM:\n            row = layout.row()\n            row.label(text=\"CT-Scan Preparing:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n    #        layout.prop(rd, \"filepath\", text=\"\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.ajusta_tomo\", text=\"Organize\", icon=\"NODETREE\")\n\n\n            row = layout.row()\n            row = layout.row()\n    #        row.label(text=\"CT-Scan Fix:\")\n    #        col = layout.column(align=True)\n    #        col.prop(scn.my_tool, \"path\", text=\"\")\n    #        row = layout.row()\n    #        row.operator(\"object.corrige_dicom\", text=\"Fix it!\", icon=\"FILE_TICK\")\n\n            row = layout.row()\n            row.label(text=\"Threshold Setup:\")\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n            row = layout.row()\n            row.operator(\"object.abre_slicer\", text=\"Open Slicer!\", icon=\"FILE_TICK\")\n\n\n            row = layout.row()\n            row.label(text=\"CT-Scan 3D Reconstruction:\")\n\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n\n            row = layout.row()\n    #        row.operator(\"object.tomo_heli\", text=\"CT-Scan\")\n    #        row.operator(\"object.tomo_cone\", text=\"CBCT\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'CENTER'\n            col.prop(context.scene, \"interesse_geral\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'CENTER'\n            col.prop(context.scene, \"fator_simplificacao\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'CENTER'\n            col.prop(context.scene, \"nome_objeto\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n    #        row.operator(\"object.gera_modelos_tomo\", text=\"Convert DICOM to 3D\", icon=\"SNAP_FACE\")\n            row.operator(\"object.gera_modelo_tomo_custom\", text=\"Convert DICOM to 3D\", icon=\"SNAP_FACE\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_tomo\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n        if my_enum_ct == ENUM_VALUES_CTSCAN.AUTOEXP:\n\n            row = layout.row()\n            row.label(text=\"Automatic Experimental:\")\n\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelotomo_auto_mole\", text=\"AUTOMATIC DICOM TO 3D\", icon=\"SNAP_FACE\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_tomo_auto\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_OT_GeraModelosTomoArc(bpy.types.Operator):\n    \"\"\"Tooltip\"\"\"\n    bl_idname = \"object.gera_modelos_tomo_arc\"\n    bl_label = \"Gera Tomografia Molde\"\n\n    def execute(self, context):\n        GeraModelosTomoArcDef(self, context)\n        return {'FINISHED'}\n\n\nclass ORTOG_PT_ImportaArc(bpy.types.Panel):\n    bl_label = \"Import Archs\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n#        scene = context.scene\n#        rd = scene.render\n\n        row = layout.row()\n        row.label(text=\"Arch Teeth Import:\")\n\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"path\", text=\"\")\n\n        '''\n        if platform.system() == \"Windows\":\n            row = layout.row()\n            row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n        '''\n\n        row = layout.row()\n        row.operator(\"object.abre_slicer\", text=\"Open Slicer!\", icon=\"FILE_TICK\")\n\n        col = self.layout.column(align = True)\n        col.prop(context.scene, \"interesse_arco\")\n\n        row = layout.row()\n        row.operator(\"object.gera_modelos_tomo_arc\", text=\"Arch Generator\", icon=\"SNAP_FACE\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Import File:\")\n\n        row = layout.row()\n        row.operator(\"import_mesh.stl\", text=\"Import STL\", icon=\"IMPORT\")\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Alignment:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1a\", text=\"Point 1a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1b\", text=\"Point 1b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.emp2a\", text=\"Point 2a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp2b\", text=\"Point 2b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.emp3a\", text=\"Point 3a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp3b\", text=\"Point 3b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row.label(text=\"Select align object!\")\n        row = layout.row()\n        linha=row.operator(\"object.alinha_tres_pontos\", text=\"ALIGN!\", icon=\"MESH_DATA\")\n\n\n        row = layout.row()\n        row.label(text=\"Select other object!\")\n#        row = layout.row()\n#        linha=row.operator(\"object.align_icp\", text=\"ICP Align\", icon=\"TRACKING_REFINE_FORWARDS\")\n        row = layout.row()\n        linha=row.operator(\"object.force_icp\", text=\"Force ICP Align (Slow)\", icon=\"TRACKING_REFINE_FORWARDS\")\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Segmentation:\")\n\n        row = layout.row()\n        row.operator(\"object.prepara_impressao_3d\", text=\"Close Holes (Remesh)?\", icon=\"META_CUBE\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n#        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n        row.operator(\"object.linha_corte_fora_a_fora\", icon='LINE_DATA', text=\"Draw Line\")\n\n\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_dentro\", text=\"Subtract IN\", icon=\"LIGHTPROBE_CUBEMAP\")\n\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_fora\", text=\"Subtract OUT\", icon=\"MESH_CUBE\")\n\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.entra_editmode_limpo\", text=\"Edit Mode Clean\", icon=\"UV_VERTEXSEL\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.select_more\", text=\"Sel. More\", icon=\"ADD\")\n\n        linha=row.operator(\"mesh.select_less\", text=\"Sel. Less\", icon=\"REMOVE\")\n\n        row = layout.row()\n        linha=row.operator(\"object.separa_objeto\", text=\"Separate Selected!\", icon=\"MOD_BEVEL\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_union\", text=\"Union\", icon=\"MOD_CAST\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.label(text=\"Pivot Rotation:\")\n\n\n        obj = context.active_object\n        tool_settings = context.tool_settings\n\n        object_mode = 'OBJECT' if obj is None else obj.mode\n\n        if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL'} or has_pose_mode:\n            layout.prop_with_popover(\n                tool_settings,\n                \"transform_pivot_point\",\n                text=\"\",\n                icon_only=False,\n                panel=\"VIEW3D_PT_pivot_point\",\n            )\n\n\n        row = layout.row()\n        row.label(text=\"Reconstruction:\")\n\n        row = layout.row()\n        row.operator(\"object.fecha_buraco_todos\", icon='MOD_TRIANGULATE', text=\"Close All Holes\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.poisson\", text=\"Poisson Reconstruction\", icon=\"MESH_ICOSPHERE\")\n\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_arc\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_GraphicRefs(bpy.types.Panel):\n    bl_label = \"Graphic References\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.label(text=\"Frankfurt Alignment:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.oculta_mole\", text=\"Hide Face (CT-Scan)\", icon=\"HIDE_ON\")\n\n        row = layout.row()\n        linha=row.operator(\"object.orbital_right_pt\", text=\"Orbital right\")\n        linha=row.operator(\"object.orbital_left_pt\", text=\"Orbital left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.n_pt\", text=\"N point\")\n        linha=row.operator(\"object.po_left\", text=\"Po left\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.alinha_cranio_frankfurt\", text=\"Align!\", icon=\"ORIENTATION_LOCAL\")\n\n\n        row = layout.row()\n        row.label(text=\"Reference Lines:\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Vertical Center Line\", icon=\"SORT_DESC\")\n        linha.location=(0,-200,0)\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Horizontal Center Line\", icon=\"FORWARD\")\n        linha.location=(0,-200,0)\n        linha.rotation=(0,1.5708,0)\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Horizontal Side Line\", icon=\"FORWARD\")\n        linha.location=(200,30,0)\n        linha.rotation=(1.5708,0,0)\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.desagrupa_tomo\", text=\"UNGROUP!!!\", icon=\"PARTICLE_DATA\")\n\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_ref\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_Segmentation(bpy.types.Panel):\n    bl_label = \"Segmentation\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.operator(\"object.segmenta_linked\", icon='OUTLINER_DATA_CURVE', text=\"Separate Linked\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.fecha_buraco_todos\", icon='MOD_TRIANGULATE', text=\"Close All Holes\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Boolean Segmentation:\")\n\n        row = layout.row()\n#        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n        row.operator(\"object.linha_corte_fora_a_fora\", icon='LINE_DATA', text=\"Draw Line\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_dentro\", text=\"Subtract IN\", icon=\"LIGHTPROBE_CUBEMAP\")\n\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_fora\", text=\"Subtract OUT\", icon=\"MESH_CUBE\")\n\n        row = layout.row()\n        row.label(text=\"Boolean:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_geral\", text=\"Difference\", icon=\"MOD_BOOLEAN\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_union\", text=\"Union\", icon=\"MOD_CAST\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_inter\", text=\"Intersect\", icon=\"MOD_MASK\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.booleana_union_multipla\", text=\"MULTIPLE UNION\", icon=\"STICKY_UVS_LOC\")\n\n        row = layout.row()\n        row.label(text=\"Surface Cut:\")\n\n        row = layout.row()\n        row.operator(\"wm.modal_cria_pontos\", icon='CURVE_DATA', text=\"Create Points\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_unido\", icon='CURVE_BEZCIRCLE', text=\"Create Bezier Line\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta\", text=\"Cut Line!\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta_dupla\", text=\"Cut Line Double!\", icon=\"MOD_THICKNESS\")\n\n        row = layout.row()\n        row.label(text=\"Teeth Segmentation Tube:\")\n\n        row = layout.row()\n        circle=row.operator(\"wm.modal_cria_pontos_teeth\", text=\"Create Points\", icon=\"CURVE_DATA\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_unido_teeth\", icon='CURVE_BEZCIRCLE', text=\"Create Bezier Tube\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta_dupla_teeth\", text=\"Cut Line Teeth!\", icon=\"MOD_THICKNESS\")\n\n        row = layout.row()\n        row.label(text=\"Teeth Segmentation Line:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.prepara_malha_corte\", text=\"Prepare Mesh to Cut\", icon=\"ALEMBIC\")\n\n        row = layout.row()\n        circle=row.operator(\"mesh.knife_tool\", text=\"Knife Cut\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        circle=row.operator(\"object.separa_edge_split\", text=\"Edge Split Separation\", icon=\"MATSPHERE\")\n\n        row = layout.row()\n        row.label(text=\"Separated Teeth:\")\n\n        row = layout.row()\n        row.operator(\"object.weight_1\", text=\"Weight Paint 1\", icon=\"COLORSET_01_VEC\")\n\n        row = layout.row()\n        row.operator(\"object.weight_0\", text=\"Weight Paint 0\", icon=\"COLORSET_04_VEC\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mantem_pintado\", text=\"Delete Blue\", icon=\"GPBRUSH_ERASE_HARD\")\n\n        row = layout.row()\n        linha=row.operator(\"object.apaga_pintado\", text=\"Delete Red\", icon=\"GPBRUSH_ERASE_HARD\")\n\n        row = layout.row()\n        linha=row.operator(\"object.booleana_mandib\", text=\"Separate Skull-Mandible\", icon=\"FULLSCREEN_ENTER\")\n\n        row = layout.row()\n        row.label(text=\"Teeth Touched:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.condylar_process_right_pt\", text=\"Condylar Process right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.condylar_process_left_pt\", text=\"Condylar Process left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.coronoid_process_right_pt\", text=\"Coronoid Process right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.coronoid_process_left_pt\", text=\"Coronoid Process left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.go_ramus_fracure_right_pt\", text=\"Mid Go-Ramus Fracure right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.go_ramus_fracure_left_pt\", text=\"Mid Go-Ramus Fracure left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.go_right_pt\", text=\"Go right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.go_left_pt\", text=\"Go left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mid_mandibula_angle_right_pt\", text=\"Mid Mandible Angle right\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mid_mandibula_angle_left_pt\", text=\"Mid Mandible Angle left\")\n\n        row = layout.row()\n        linha=row.operator(\"object.gn_pt\", text=\"Gn point\")\n\n        row = layout.row()\n        linha=row.operator(\"object.b_pt\", text=\"B point\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mid_upper_incisors_pt\", text=\"Mid Upper Incisors\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.separacao_mandibula\", text=\"Mandible Segmentation\", icon=\"PIVOT_ACTIVE\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.separacao_mandibula_cranio\", text=\"Separate Skull from Mandible\", icon=\"MONKEY\")\n\n        row = layout.row()\n        row.label(text=\"Other Tools:\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.poisson\", text=\"Poisson Reconstruction\", icon=\"MESH_ICOSPHERE\")\n\n        row = layout.row()\n        row = layout.row()\n#        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n        row.operator(\"object.linha_corte_fora_a_fora\", icon='LINE_DATA', text=\"Draw Line\")\n\n        row = layout.row()\n        linha=row.operator(\"object.segmenta_desenho\", text=\"Cut Draw!\", icon=\"FCURVE\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.entra_editmode_limpo\", text=\"Edit Mode Clean\", icon=\"UV_VERTEXSEL\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.select_more\", text=\"Sel. More\", icon=\"ADD\")\n\n        linha=row.operator(\"mesh.select_less\", text=\"Sel. Less\", icon=\"REMOVE\")\n\n        row = layout.row()\n        linha=row.operator(\"object.separa_objeto\", text=\"Separate Selected!\", icon=\"MOD_BEVEL\")\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Pivot Rotation:\")\n\n\n        obj = context.active_object\n        tool_settings = context.tool_settings\n\n        object_mode = 'OBJECT' if obj is None else obj.mode\n\n        if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL'} or has_pose_mode:\n            layout.prop_with_popover(\n                tool_settings,\n                \"transform_pivot_point\",\n                text=\"\",\n                icon_only=False,\n                panel=\"VIEW3D_PT_pivot_point\",\n            )\n\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_seg\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_SegmentacaoFace(bpy.types.Panel):\n    bl_label = \"Photo Face Segmentation\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.segmenta_imagem_face\", text=\"Start Segmentation!\", icon=\"USER\")\n\nclass ORTOG_PT_Converte_Video(bpy.types.Panel):\n    bl_label = \"Video to Images\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        col = layout.column(align=True)\n        col.prop(scn.my_tool, \"filepathvideo\", text=\"\")\n\n        row = layout.row()\n        row.operator(\"object.converte_video_imagem\", text=\"Convert Video to Images!\", icon=\"RENDER_STILL\")\n\nclass ENUM_VALUES_PHOTOGRAMMETRY:\n    OPENMVG = 'OpenMVG+OpenMVS'\n    SMVS = 'SMVS+MeshLab'\n    MESHROOM = 'Meshroom'\n    OPENMVGWIN = 'OpenMVG Linux on Win'\n\n\nclass ORTOG_PT_Fotogrametria(bpy.types.Panel):\n    bl_label = \"Photogrammetry Start\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.operator(\"object.prepara_cena_fotogram\", text=\"Setup Scene!\", icon=\"ERROR\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Fotogrammetry Algorithm:\")\n\n        row = layout.row()\n        row.prop(scn, \"my_enum\")\n\n        my_enum = scn.my_enum\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.OPENMVG:\n#            row = layout.row()\n#            row.label(text=\"OpenMVG+OpenMVS:\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            #self.layout.prop(context.scene, \"use_gravity\", text=\"Decrease picture size!\")\n            #self.layout.prop(scn.my_tool, \"imagem_bool\", text=\"\")\n            col.prop(scn.my_tool, \"imagem_bool\", text=\"Decrease picture size!\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'RIGHT'\n            col.prop(context.scene, \"d_factor\")\n            col.prop(context.scene, \"smooth_factor\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto\", text=\"Start Photogrammetry!\", icon=\"IMAGE_DATA\")\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.SMVS:\n\n#            row = layout.row()\n#            row.label(text=\"SMVS+Meshlab:\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto_smvs\", text=\"Alternative Photogrammetry I\", icon=\"IMAGE_DATA\")\n\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.MESHROOM:\n\n#            row = layout.row()\n#            row.label(text=\"Meshroom (AliceVision):\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto_meshroom\", text=\"Alternative Photogrammetry II\", icon=\"IMAGE_DATA\")\n\n        if my_enum == ENUM_VALUES_PHOTOGRAMMETRY.OPENMVGWIN:\n#            row = layout.row()\n#            row.label(text=\"OpenMVG+OpenMVS:\")\n\n            row = layout.row()\n            col = layout.column(align=True)\n            col.prop(scn.my_tool, \"path_photo\", text=\"\")\n\n            col = self.layout.column(align = True)\n            col.alignment = 'RIGHT'\n            col.prop(context.scene, \"d_factor\")\n            col.prop(context.scene, \"smooth_factor\")\n\n            col.prop(scn.my_tool, \"imagem_bool\", text=\"Decrease picture size!\")\n\n            if platform.system() == \"Windows\":\n                row = layout.row()\n                row.operator(\"wm.console_toggle\", text=\"Open Terminal?\", icon=\"CONSOLE\")\n\n            row = layout.row()\n            row.operator(\"object.gera_modelo_foto_win\", text=\"Start Photogrammetry!\", icon=\"IMAGE_DATA\")\n\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_fotogram\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_AlinhaFace(bpy.types.Panel):\n    bl_label = \"Photogrammetry - Align & Scale\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Align Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1b\", text=\"Cantal Lateral Right\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp2b\", text=\"Cantal Lateral Left\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp3b\", text=\"Down Point\", icon=\"SORTBYEXT\")\n\n#        row = layout.row()\n#        row.operator(\"object.cria_tres_pontos\", text=\"3 Points Click\", icon=\"OUTLINER_OB_MESH\")\n\n        row = self.layout.row(align = True)\n        row.label(text=\"Real Size:\")\n        row.prop(context.scene, \"medida_real2\")\n\n        row = layout.row()\n        row.operator(\"object.alinha_forca\", text=\"Align and Resize!\", icon=\"ORIENTATION_LOCAL\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Segmentation Cut Through:\")\n\n        row = layout.row()\n        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n\n        row = layout.row()\n        linha=row.operator(\"object.segmenta_desenho\", text=\"Cut Draw!\", icon=\"FCURVE\")\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Surface Cut:\")\n\n        row = layout.row()\n        row.operator(\"wm.modal_cria_pontos\", icon='CURVE_DATA', text=\"Create Points\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier_unido\", icon='CURVE_BEZCIRCLE', text=\"Create Bezier Line\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta\", text=\"Cut Line!\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        circle=row.operator(\"object.bezier_corta_dupla\", text=\"Cut Line Double!\", icon=\"MOD_THICKNESS\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_alinha_face\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_FotogramModif(bpy.types.Panel):\n    bl_label = \"Photogrammetry - Modifiers\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Modifiers:\")\n\n        ob = context.object\n\n        layout.operator_menu_enum(\"object.modifier_add\", \"type\")\n\n        for md in ob.modifiers:\n            box = layout.template_modifier(md)\n            if box:\n                # match enum type to our functions, avoids a lookup table.\n                getattr(self, md.type)(box, ob, md)\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.convert\", text=\"APPLY ALL!\", icon=\"ERROR\").target='MESH'\n\nclass ORTOG_PT_AlinhaFaceCT(bpy.types.Panel):\n    bl_label = \"Align Face to CT-Scan\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Align Points:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1a\", text=\"Point 1a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1b\", text=\"Point 1b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.emp2a\", text=\"Point 2a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp2b\", text=\"Point 2b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.emp3a\", text=\"Point 3a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp3b\", text=\"Point 3b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Select the object to be aligned!\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alinha_tres_pontos\", text=\"ALIGN!\", icon=\"MESH_DATA\")\n\n        row = layout.row()\n        row.label(text=\"Select other object!\")\n  #      row = layout.row()\n  #      linha=row.operator(\"object.align_icp\", text=\"ICP Align\", icon=\"TRACKING_REFINE_FORWARDS\")\n        row = layout.row()\n        linha=row.operator(\"object.force_icp\", text=\"Force ICP Align (Slow)\", icon=\"TRACKING_REFINE_FORWARDS\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_alinha_foto_tomo\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ENUM_VALUES_ANATOMICAL:\n    HEAD = 'Head'\n    MAXILLA = 'Maxilla'\n    MANDIBLE = 'Mandible'\n    TEETH = 'Teeth'\n    SOFTTISSUE = 'SoftTissue'\n\n\nclass ORTOG_PT_PontosAnatomicos(bpy.types.Panel):\n    bl_label = \"Anatomical Points\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.prop(scn, \"my_enum_ana\")\n\n        my_enum_ana = scn.my_enum_ana\n\n        if my_enum_ana == ENUM_VALUES_ANATOMICAL.HEAD:\n\n            row = layout.row()\n            linha=row.operator(\"object.orbital_right_pt\", text=\"Orbital right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.orbital_left_pt\", text=\"Orbital left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.n_pt\", text=\"N point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.po_right\", text=\"Po right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.po_left\", text=\"Po left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.pt_right\", text=\"Pt right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.pt_left\", text=\"Pt left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.ba_pt\", text=\"Ba point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.s_pt\", text=\"S point\")\n\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_points_head\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n        if my_enum_ana == ENUM_VALUES_ANATOMICAL.MAXILLA:\n\n            row = layout.row()\n            linha=row.operator(\"object.u1_tip_pt\", text=\"U1 Tip\")\n\n            row = layout.row()\n            linha=row.operator(\"object.u1_labgenbor_pt\", text=\"U1 Labial Gengival Border\")\n\n            row = layout.row()\n            linha=row.operator(\"object.u1_lingenbor_pt\", text=\"U1 Lingual Gengival Border\")\n\n            row = layout.row()\n            linha=row.operator(\"object.u1_root_pt\", text=\"U1 Root\")\n\n            row = layout.row()\n            linha=row.operator(\"object.m_u6_pt\", text=\"M U6\")\n\n            row = layout.row()\n            linha=row.operator(\"object.d_u6_pt\", text=\"D U6\")\n\n            row = layout.row()\n            linha=row.operator(\"object.u6_occlusal_pt\", text=\"U6 Occlusal\")\n\n            row = layout.row()\n            linha=row.operator(\"object.pns_pt\", text=\"PNS point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.a_pt\", text=\"A point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.ans_pt\", text=\"ANS point\")\n\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_points_maxilla\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n        if my_enum_ana == ENUM_VALUES_ANATOMICAL.MANDIBLE:\n\n            row = layout.row()\n            linha=row.operator(\"object.l1_tip_pt\", text=\"L1 Tip\")\n\n            row = layout.row()\n            linha=row.operator(\"object.l1_labgenbor_pt\", text=\"L1 Labial Gengival Border\")\n\n            row = layout.row()\n            linha=row.operator(\"object.l1_lingenbor_pt\", text=\"L1 Lingual Gengival Border\")\n\n            row = layout.row()\n            linha=row.operator(\"object.l1_root_pt\", text=\"L1 Root\")\n\n            row = layout.row()\n            linha=row.operator(\"object.b_pt\", text=\"B point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.m_l6_pt\", text=\"M L6\")\n\n            row = layout.row()\n            linha=row.operator(\"object.l6_occlusal_pt\", text=\"L6 Occlusal\")\n\n            row = layout.row()\n            linha=row.operator(\"object.d_l6_pt\", text=\"D L6\")\n\n            row = layout.row()\n            linha=row.operator(\"object.mid_ramus_right_pt\", text=\"Mid Ramus right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.mid_ramus_left_pt\", text=\"Mid Ramus left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.r_right_pt\", text=\"R right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.r_left_pt\", text=\"R left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.go_right_pt\", text=\"Go right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.go_left_pt\", text=\"Go left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.ar_right_pt\", text=\"Ar right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.ar_left_pt\", text=\"Ar left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.sigmoid_right_pt\", text=\"Sigmoid right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.sigmoid_left_pt\", text=\"Sigmoid left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.co_right_pt\", text=\"Co right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.co_left_pt\", text=\"Co left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.pg_pt\", text=\"Pg point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.gn_pt\", text=\"Gn point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.me_pt\", text=\"Me point\")\n\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_points_mandible\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n        if my_enum_ana == ENUM_VALUES_ANATOMICAL.TEETH:\n\n            row = layout.row()\n            row.label(text=\"Upper Teeth:\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_8_pt\", text=\"Tooth 8 (11)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_9_pt\", text=\"Tooth 9 (21)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_6_pt\", text=\"Tooth 6 (13)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_11_pt\", text=\"Tooth 11 (23)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_3_pt\", text=\"Tooth 3 (16)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_14_pt\", text=\"Tooth 14 (26)\")\n\n            row = layout.row()\n            row = layout.row()\n            row.label(text=\"Lower Teeth:\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_24_pt\", text=\"Tooth 24 (31)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_25_pt\", text=\"Tooth 25 (41)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_22_pt\", text=\"Tooth 22 (33)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_27_pt\", text=\"Tooth 27 (43)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_19_pt\", text=\"Tooth 19 (36)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_30_pt\", text=\"Tooth 30 (46)\")\n\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_points_teeth\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n        if my_enum_ana == ENUM_VALUES_ANATOMICAL.SOFTTISSUE:\n\n            row = layout.row()\n            linha=row.operator(\"object.st_glabella_pt\", text=\"ST Glabella\")\n\n            row = layout.row()\n            linha=row.operator(\"object.st_nasion_pt\", text=\"ST Nasion\")\n\n            row = layout.row()\n            linha=row.operator(\"object.bridge_nose_pt\", text=\"Bridge of Nose\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tip_nose_pt\", text=\"Tip of Nose\")\n\n            row = layout.row()\n            linha=row.operator(\"object.columella_pt\", text=\"Columella\")\n\n            row = layout.row()\n            linha=row.operator(\"object.subnasale_pt\", text=\"Subnasale\")\n\n            row = layout.row()\n            linha=row.operator(\"object.st_a_point_pt\", text=\"ST A point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.upper_lip_pt\", text=\"Upper Lip\")\n\n            row = layout.row()\n            linha=row.operator(\"object.stomion_superius_pt\", text=\"Stomion Superius\")\n\n            row = layout.row()\n            linha=row.operator(\"object.stomion_inferius_pt\", text=\"Stomion Inferius\")\n\n            row = layout.row()\n            linha=row.operator(\"object.lower_lip_pt\", text=\"Lower Lip\")\n\n            row = layout.row()\n            linha=row.operator(\"object.st_b_point_pt\", text=\"ST B point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.st_pogonion_pt\", text=\"ST Pogonion\")\n\n            row = layout.row()\n            linha=row.operator(\"object.st_gnathion_pt\", text=\"ST Gnathion\")\n\n            row = layout.row()\n            linha=row.operator(\"object.st_menton_pt\", text=\"ST Menton\")\n\n            row = layout.row()\n            linha=row.operator(\"object.throat_point_pt\", text=\"Throat point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.cb_right_pt\", text=\"CB right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.cb_left_pt\", text=\"CB left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.or_right_pt\", text=\"OR' right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.or_left_pt\", text=\"OR' left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.subpupil_right_pt\", text=\"Subpupil right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.subpupil_left_pt\", text=\"Subpupil left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.cheekbone_right_pt\", text=\"Cheekbone right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.cheekbone_left_pt\", text=\"Cheekbone left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.sp_right_pt\", text=\"SP right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.sp_left_pt\", text=\"SP left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.ab_right_pt\", text=\"AB right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.ab_left_pt\", text=\"AB left\")\n\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.5\n            row.alignment = 'CENTER'\n            row.operator(\"object.gera_dir_nome_paciente_points_soft\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\nclass ENUM_VALUES_CEFALOMETRIA:\n    USP = 'USP'\n    ARNETT = 'ARNETT'\n\nclass ORTOG_PT_Cefalometria(bpy.types.Panel):\n    bl_label = \"Cephalometry\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        MaxOcPlane = \"NONE\"\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.prop(scn, \"my_enum_cefalometria\")\n\n        my_enum_cefalometria = scn.my_enum_cefalometria\n\n        if my_enum_cefalometria == ENUM_VALUES_CEFALOMETRIA.USP:\n\n            # Plano oclusal maxila\n\n            row = layout.row()\n            circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n            row = layout.row()\n            circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n            row = layout.row()\n            row.operator(\"object.calcula_tudo_usp\", text=\"Calculate!!!\", icon=\"PREFERENCES\")\n\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.operator(\"object.tooth_8_pt\", text=\"Tooth 8 (11)\")\n            linha=row.operator(\"object.tooth_9_pt\", text=\"Tooth 9 (21)\")\n            row = col.row()\n            linha=row.operator(\"object.tooth_3_pt\", text=\"Tooth 3 (16)\")\n            linha=row.operator(\"object.tooth_14_pt\", text=\"Tooth 14 (26)\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"plano_oclusal_maxila_classico\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"4º-(8º)-12º\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            linha=row.operator(\"object.s_pt\", text=\"S point\")\n            linha=row.operator(\"object.n_pt\", text=\"N point\")\n            linha=row.operator(\"object.a_pt\", text=\"A point\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"angulo_sna\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"> 82º Prognathic Maxilla (Class 2)\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"< 82º Retrognathic Maxilla (Class 3)\")\n\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            linha=row.operator(\"object.s_pt\", text=\"S point\")\n            linha=row.operator(\"object.n_pt\", text=\"N point\")\n            linha=row.operator(\"object.b_pt\", text=\"B point\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"angulo_snb\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"> 80º Prognathic Mandible\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"< 80º Retrognathic Mandible\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            linha=row.operator(\"object.a_pt\", text=\"A point\")\n            linha=row.operator(\"object.n_pt\", text=\"N point\")\n            linha=row.operator(\"object.b_pt\", text=\"B point\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"angulo_anb\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"0º-(2º)-4º\")\n\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            linha=row.operator(\"object.s_pt\", text=\"S point\")\n            linha=row.operator(\"object.n_pt\", text=\"N point\")\n            linha=row.operator(\"object.gn_pt\", text=\"Gn point\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"angulo_sngn\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"65º-(67º)-69º\")\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            linha=row.operator(\"object.go_right_pt\", text=\"Go right\")\n            linha=row.operator(\"object.go_left_pt\", text=\"Go left\")\n            linha=row.operator(\"object.me_pt\", text=\"Me point\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"plano_mandibula_usp\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"28º-(32º)-36º\")\n\n\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            linha=row.operator(\"object.s_pt\", text=\"S point\")\n            linha=row.operator(\"object.n_pt\", text=\"N point\")\n            row = col.row()\n            linha=row.operator(\"object.go_right_pt\", text=\"Go right\")\n            linha=row.operator(\"object.go_left_pt\", text=\"Go left\")\n            linha=row.operator(\"object.gn_pt\", text=\"Gn point\")\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'CENTER'\n            row.prop(context.scene, \"angulo_sngogn\")\n            row = col.row()\n            row.alignment = 'CENTER'\n            row.label(text=\"28º-(32º)-36º\")\n\n\n        if my_enum_cefalometria == ENUM_VALUES_CEFALOMETRIA.ARNETT:\n\n            row = layout.row()\n            linha=row.operator(\"object.calcula_tudo_cefalo\", text=\"Calculate All!!!\", icon=\"PREFERENCES\")\n\n            row = layout.row()\n            row = layout.row()\n\n\n            row = layout.row()\n            row.label(text=\"Angles:\")\n\n            # Plano oclusal maxila\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"plano_oclusal_maxila\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: 90º-120º Men: 85º-105º\")\n\n            # Ângulo nasolabial\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"angulo_nasolabial\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: 97.7º - 110.3º    Men: 98.7º - 114.1º\") # Calculado\n\n            # Ângulo Gn', Sn, Pog'\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"angulo_GbSnPog\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: 90º-120º Men: 85º-105º\")\n\n            row = layout.row()\n            row.label(text=\"Distances:\")\n\n            # Glabella - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_glabella_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Rima Orbital - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_rima_or_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Mole malar - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_cheekbone_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Subpupilar - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_subpupil_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Proj. Nasal - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_proj_nasal_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Base Nasal - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_base_nasal_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # A' - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_a_mole_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Upper Lip - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_labio_superior_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # L1 - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_l1_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # U1 - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_u1_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Lábio inferior - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_labio_inferior_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # B' - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_b_mole_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Pog' - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_pog_mole_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\n            # Pescoço-Garganta - LVV\n            row = layout.row()\n            row = layout.row()\n            box = layout.box()\n            col = box.column(align=True)\n            row = col.row()\n            row.scale_y=1.0\n            row.alignment = 'RIGHT'\n            row.prop(context.scene, \"dist_pescoco_garganta_tvl\")\n            row = col.row()\n            row.alignment = 'RIGHT'\n            row.label(text=\"Women: -1 to 3 Men: -1 to 3\")\n\nbpy.types.Scene.angulo_sngogn = bpy.props.StringProperty \\\n    (\n        name = \"SNGoGn Angle\",\n        description = \"SNGoGn Angle\",\n        default = \"NONE\"\n    )\nbpy.types.Scene.angulo_sna = bpy.props.StringProperty \\\n    (\n        name = \"SNA Angle\",\n        description = \"SNA Angle\",\n        default = str(\"NONE\"),\n    )\n\nbpy.types.Scene.angulo_snb = bpy.props.StringProperty \\\n    (\n        name = \"SNB Angle\",\n        description = \"SNB Angle\",\n        default = str(\"NONE\")\n    )\n\nbpy.types.Scene.angulo_anb = bpy.props.StringProperty \\\n    (\n        name = \"ANB Angle\",\n        description = \"ANB Angle\",\n        default = \"NONE\"\n    )\nprint(\"Falta algum ponto anatômico (ANB)!\")\n\nbpy.types.Scene.angulo_sngn = bpy.props.StringProperty \\\n    (\n        name = \"SNGn Angle\",\n        description = \"SNGn Angle\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_pescoco_garganta_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Throat point - TVL\",\n        description = \"Throat point - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_pog_mole_tvl = bpy.props.StringProperty \\\n    (\n        name = \"ST Pogonion - TVL\",\n        description = \"ST Pogonion - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_b_mole_tvl = bpy.props.StringProperty \\\n    (\n        name = \"ST B point - TVL\",\n        description = \"ST B point - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_labio_inferior_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Lower Lip - TVL\",\n        description = \"Lower Lip - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_u1_tvl = bpy.props.StringProperty \\\n    (\n        name = \"U1 Tip - TVL\",\n        description = \"U1 Tip - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_l1_tvl = bpy.props.StringProperty \\\n    (\n        name = \"L1 Tip - TVL\",\n        description = \"L1 Tip - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_labio_superior_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Upper Lip - TVL\",\n        description = \"Upper Lip - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_a_mole_tvl = bpy.props.StringProperty \\\n    (\n        name = \"A' - TVL\",\n        description = \"A' - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_base_nasal_tvl = bpy.props.StringProperty \\\n    (\n        name = \"AB - TVL\",\n        description = \"AB - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_proj_nasal_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Tip of Nose - TVL\",\n        description = \"Tip of Nose - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_subpupil_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Subpupil - TVL\",\n        description = \"Subpupil - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_cheekbone_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Cheekbone - TVL\",\n        description = \"Cheekbone - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_rima_or_tvl = bpy.props.StringProperty \\\n    (\n        name = \"OR' - TVL\",\n        description = \"OR' - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.dist_glabella_tvl = bpy.props.StringProperty \\\n    (\n        name = \"Glabella - TVL\",\n        description = \"Glabella - TVL\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.plano_oclusal_maxila = bpy.props.StringProperty \\\n    (\n        name = \"Maxillary Occlusal Plane\",\n        description = \"Maxillary Occlusal Plane\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.angulo_nasolabial = bpy.props.StringProperty \\\n    (\n        name = \"Nasolabial Angle\",\n        description = \"Nasolabial Angle\",\n        default = \"NONE\"\n    )\n\nbpy.types.Scene.angulo_GbSnPog = bpy.props.StringProperty \\\n\t(\n        name = \"Gb', Sn, Pog' Angle\",\n        description = \"Gb', Sn, Pog' Angle\",\n        default = str(\"NONE\")\n    )\n\nclass ENUM_VALUES_OSTEOTOMY:\n    AUTO = 'Auto'\n    MANUAL = 'Manual'\n    BOOLEAN = 'Boolean'\n    DRAW = 'Draw'\n\nclass ORTOG_PT_Osteotomia(bpy.types.Panel):\n    bl_label = \"Osteotomy\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.prop(scn, \"my_enum_osteotomy\")\n\n        my_enum_ct = scn.my_enum_osteotomy\n\n        if my_enum_ct == ENUM_VALUES_OSTEOTOMY.AUTO:\n\n            row = layout.row()\n            circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n            row = layout.row()\n            circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n            row = layout.row()\n            linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n            linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n            row = layout.row()\n            linha=row.operator(\"object.orbital_right_pt\", text=\"Orbital right\")\n            linha=row.operator(\"object.orbital_left_pt\", text=\"Orbital left\")\n            linha=row.operator(\"object.a_pt\", text=\"A point\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tooth_30_pt\", text=\"Tooth 30 (46)\")\n            linha=row.operator(\"object.go_right_pt\", text=\"Go right\")\n            linha=row.operator(\"object.tooth_19_pt\", text=\"Tooth 19 (36)\")\n\n            row = layout.row()\n            linha=row.operator(\"object.go_left_pt\", text=\"Go left\")\n            linha=row.operator(\"object.b_pt\", text=\"B point\")\n            linha=row.operator(\"object.me_pt\", text=\"Me point\")\n\n            row = layout.row()\n            row = layout.row()\n            circle=row.operator(\"object.adiciona_planos_corte_auto\", text=\"Create Cut Planes!\", icon=\"AXIS_TOP\")\n\n\n            row = layout.row()\n            row.label(text=\"Pivot:\")\n\n\n            obj = context.active_object\n            tool_settings = context.tool_settings\n\n            object_mode = 'OBJECT' if obj is None else obj.mode\n\n            if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_PAINT'} or has_pose_mode:\n                layout.prop_with_popover(\n                    tool_settings,\n                    \"transform_pivot_point\",\n                    text=\"\",\n                    icon_only=False,\n                    panel=\"VIEW3D_PT_pivot_point\",\n                )\n\n            row = layout.row()\n            row = layout.row()\n            row.label(text=\"Boolean:\")\n\n            row = layout.row()\n            circle=row.operator(\"object.booleana_union_multipla\", text=\"Join All (Union)\", icon=\"GROUP\")\n\n            row = layout.row()\n            circle=row.operator(\"object.booleana_osteo_geral\", text=\"Cut Boolean\", icon=\"MOD_BOOLEAN\")\n\n\n        if my_enum_ct == ENUM_VALUES_OSTEOTOMY.MANUAL:\n\n            row = layout.row()\n            circle=row.operator(\"mesh.add_mento\", text=\"Chin Plane\", icon=\"TRIA_DOWN\")\n            circle.location=(0,-35,-81)\n\n            row = layout.row()\n            circle=row.operator(\"mesh.add_ramo\", text=\"Left Ramus Plane\", icon=\"TRIA_RIGHT\")\n            circle.location=(36, -4, -45)\n\n            row = layout.row()\n            circle=row.operator(\"mesh.add_ramo\", text=\"Right Ramus Plane\", icon=\"TRIA_LEFT\")\n            circle.location=(-36, -4, -45)\n\n            row = layout.row()\n            circle=row.operator(\"mesh.add_maxila\", text=\"Maxilla Plane\", icon=\"TRIA_UP\")\n            circle.location=(0, -45, -31)\n\n            row = layout.row()\n            row = layout.row()\n            row.label(text=\"Boolean:\")\n\n            row = layout.row()\n            circle=row.operator(\"object.booleana_union_multipla\", text=\"Join All (Union)\", icon=\"GROUP\")\n\n            row = layout.row()\n            circle=row.operator(\"object.booleana_osteo_geral\", text=\"Cut Boolean\", icon=\"MOD_BOOLEAN\")\n\n        if my_enum_ct == ENUM_VALUES_OSTEOTOMY.BOOLEAN:\n            row = layout.row()\n    #        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n            row.operator(\"object.linha_corte_fora_a_fora\", icon='LINE_DATA', text=\"Draw Line\")\n\n            row = layout.row()\n            row = layout.row()\n            circle=row.operator(\"object.desenha_booleana_dentro\", text=\"Subtract IN\", icon=\"LIGHTPROBE_CUBEMAP\")\n\n            row = layout.row()\n            circle=row.operator(\"object.desenha_booleana_fora\", text=\"Subtract OUT\", icon=\"MESH_CUBE\")\n\n\n        if my_enum_ct == ENUM_VALUES_OSTEOTOMY.DRAW:\n\n            row = layout.row()\n            row.operator(\"object.linha_corte\", icon='LINE_DATA', text=\"Draw Surface Line\")\n\n            row = layout.row()\n            circle=row.operator(\"object.desenha_linha_vertex\", text=\"View Cut Line\", icon=\"RESTRICT_VIEW_OFF\")\n\n            row = layout.row()\n            circle=row.operator(\"object.desenha_linha_vertex_fin\", text=\"Cut Visible Line\", icon=\"SCULPTMODE_HLT\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_osteotomy\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\n\n\n\nclass ENUM_VALUES_DYNAMIC:\n    DEFAULT = 'Default'\n    NOSE = 'Nose'\n    EXPERIMENTAL = 'Experimental'\n\nclass ORTOG_PT_ArmatureDynamic(bpy.types.Panel):\n    bl_label = \"Dynamic\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.prop(scn, \"my_enum_dynamic\")\n\n        my_enum_dynamic = scn.my_enum_dynamic\n\n        if my_enum_dynamic == ENUM_VALUES_DYNAMIC.DEFAULT:\n\n            row = layout.row()\n            row.label(text=\"Configure Armature (Classic):\")\n\n            row = layout.row()\n            row.operator(\"object.conf_osteo_auto\", text=\"Setup Osteotomy Auto\", icon=\"FILE_TICK\")\n\n            row = layout.row()\n            row.label(text=\"Soft Tissue:\")\n\n            row = layout.row()\n            circle=row.operator(\"object.configura_dinamica_mole\", text=\"Setup Soft Tissue Dynamics\", icon=\"STYLUS_PRESSURE\")\n\n            row = layout.row()\n            circle=row.operator(\"view3d.clip_border\", text=\"Clipping Border\", icon=\"UV_FACESEL\")\n\n        if my_enum_dynamic == ENUM_VALUES_DYNAMIC.NOSE:\n\n            row = layout.row()\n            row.operator(\"object.conf_osteo_auto\", text=\"Setup Osteotomy Auto\", icon=\"FILE_TICK\")\n\n            row = layout.row()\n            row.label(text=\"Mode:\")\n\n            row = layout.row()\n            linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n            linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n            row = layout.row()\n            row = layout.row()\n            row.label(text=\"Anatomical Points:\")\n\n            row = layout.row()\n            linha=row.operator(\"object.trichion_pt\", text=\"Trichion\")\n\n            row = layout.row()\n            linha=row.operator(\"object.radix_pt\", text=\"Radix\")\n\n            row = layout.row()\n            linha=row.operator(\"object.tip_nose_pt\", text=\"Tip of Nose\")\n\n            row = layout.row()\n            linha=row.operator(\"object.alar_groove_right_pt\", text=\"Alar Groove right\")\n\n            row = layout.row()\n            linha=row.operator(\"object.alar_groove_left_pt\", text=\"Alar Groove left\")\n\n            row = layout.row()\n            linha=row.operator(\"object.submental_pt\", text=\"Submental\")\n\n            row = layout.row()\n            row = layout.row()\n            row.label(text=\"Soft Tissue:\")\n\n            row = layout.row()\n            circle=row.operator(\"object.configura_dinamica_mole\", text=\"Setup Soft Tissue Dynamics\", icon=\"STYLUS_PRESSURE\")\n\n            row = layout.row()\n            circle=row.operator(\"view3d.clip_border\", text=\"Clipping Border\", icon=\"UV_FACESEL\")\n\n        if my_enum_dynamic == ENUM_VALUES_DYNAMIC.EXPERIMENTAL:\n\n            row = layout.row()\n            row.label(text=\" Auto Osteo+Soft Setup (Experimental):\")\n\n            row = layout.row()\n            row.operator(\"object.nome_face_malha\", text=\"Set Face and Hide\", icon=\"USER\")\n\n            row = layout.row()\n            row.operator(\"object.conf_osteo_mole_auto\", text=\"Setup Auto!\", icon=\"BONE_DATA\")\n\n       \trow = layout.row()\n        row = layout.row()\n        row.label(text=\"Parent Points:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.parenteia_emp\", text=\"Parent Points\", icon=\"LINKED\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_dynamic\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_CinematicaPanel(bpy.types.Panel):\n    bl_label = \"Kinematic\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        obj = context.object\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        row.label(text=\"Pivot Rotation:\")\n\n\n        obj = context.active_object\n        tool_settings = context.tool_settings\n\n        object_mode = 'OBJECT' if obj is None else obj.mode\n\n        if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_PAINT'} or has_pose_mode:\n            layout.prop_with_popover(\n                tool_settings,\n                \"transform_pivot_point\",\n                text=\"\",\n                icon_only=False,\n                panel=\"VIEW3D_PT_pivot_point\",\n            )\n\n        row = layout.row()\n        row.label(text=\"Reference Lines:\")\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Vertical Center Line\", icon=\"SORT_DESC\")\n        linha.location=(0,-200,0)\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Horizontal Center Line\", icon=\"FORWARD\")\n        linha.location=(0,-200,0)\n        linha.rotation=(0,1.5708,0)\n\n        row = layout.row()\n        linha=row.operator(\"mesh.add_linhabase\", text=\"Horizontal Side Line\", icon=\"FORWARD\")\n        linha.location=(200,30,0)\n        linha.rotation=(1.5708,0,0)\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Upper Teeth:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.tooth_8_pt\", text=\"Tooth 8 (11)\")\n        linha=row.operator(\"object.tooth_9_pt\", text=\"Tooth 9 (21)\")\n\n        row = layout.row()\n        linha=row.operator(\"object.tooth_6_pt\", text=\"Tooth 6 (13)\")\n        linha=row.operator(\"object.tooth_11_pt\", text=\"Tooth 11 (23)\")\n\n        row = layout.row()\n        linha=row.operator(\"object.tooth_3_pt\", text=\"Tooth 3 (16)\")\n        linha=row.operator(\"object.tooth_14_pt\", text=\"Tooth 14 (26)\")\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Vertical Measurements:\")\n\n        row = layout.row()\n        row.operator(\"object.medverhor_dentes\", text=\"Create Vertical Measurements\", icon=\"DRIVER_DISTANCE\")\n\n        row = layout.row()\n        row.operator(\"measureit.runopengl\", text=\"Show/Hide Measurements\", icon=\"GHOST_ENABLED\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.apaga_pontos_objetos\", text=\"Delete Measure\", icon=\"CANCEL\")\n\n       \trow = layout.row()\n        row = layout.row()\n        row.label(text=\"Parent Points:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.parenteia_emp\", text=\"Parent Points\", icon=\"LINKED\")\n\n#        row = layout.row()\n#        row.operator(\"object.transforms_to_deltas\", text=\"PUT Loc/Rot/Scale TO ZERO\", icon=\"EMPTY_AXIS\").mode='ALL'\n#        bpy.ops.object.transforms_to_deltas(mode='ALL')\n\n        try:\n            cursor = context.active_object\n\n            layout.column().prop(cursor, \"location\", text=\"Location\")\n            rotation_mode = cursor.rotation_mode\n            if rotation_mode == 'QUATERNION':\n                layout.column().prop(cursor, \"rotation_quaternion\", text=\"Rotation\")\n            elif rotation_mode == 'AXIS_ANGLE':\n                layout.column().prop(cursor, \"rotation_axis_angle\", text=\"Rotation\")\n            else:\n                layout.column().prop(cursor, \"rotation_euler\", text=\"Rotation\")\n            layout.prop(cursor, \"rotation_mode\", text=\"\")\n        except:\n            print(\"Selectione objeto!\")\n\n#bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'\n#bpy.context.scene.tool_settings.transform_pivot_point = 'MEDIAN_POINT'\n\n        row = layout.row()\n        row.label(text=\"Custom Anatomical Point:\")\n\n        context = bpy.context\n        obj = context.object\n        scn = context.scene\n\n        row = layout.row()\n        row.label(text=\"Select an object before!\")\n\n        row = layout.row()\n        if context.window_manager.measureit_run_opengl is False:\n            icon = 'PLAY'\n            txt = 'Show'\n        else:\n            icon = \"PAUSE\"\n            txt = 'Hide'\n        row.operator(\"measureit.runopengl\", text=txt, icon=icon)\n        row.prop(scn, \"measureit_gl_ghost\", text=\"\", icon='GHOST_ENABLED')\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        col = self.layout.column(align = True)\n        col.alignment = 'CENTER'\n        col.prop(context.scene, \"nome_ponto_customizado\")\n\n        row = layout.row()\n        row.operator(\"object.cria_ponto_medida\", text=\"Create Custom Point!\", icon=\"SHADING_RENDERED\")\n\n\n        row = layout.row()\n        row.label(text=\"Controllers:\")\n\n        row = layout.row()\n        row.operator(\"screen.frame_jump\", text=\"Start\", icon=\"TRIA_LEFT_BAR\").end=False\n        row.operator(\"screen.animation_play\", text=\"\", icon=\"PLAY_REVERSE\").reverse=True\n        row.operator(\"anim.ortog_loc_rot\", text=\"\", icon=\"VIEW_CAMERA\")\n        row.operator(\"screen.animation_play\", text=\"\", icon=\"PLAY\")\n        row.operator(\"screen.frame_jump\", text=\"End\", icon=\"TRIA_RIGHT_BAR\").end=True\n\n        row = layout.row()\n        row.label(text=\"Align with Models:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.prepara_mandibula_cm\", text=\"Prepare Mandible\", icon=\"MESH_DATA\")\n\n        row = layout.row()\n        row.operator(\"import_mesh.stl\", text=\"Import STL\", icon=\"IMPORT\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1a\", text=\"Point 1a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp1b\", text=\"Point 1b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.emp2a\", text=\"Point 2a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp2b\", text=\"Point 2b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.emp3a\", text=\"Point 3a - Origin\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.emp3b\", text=\"Point 3b - Align\", icon=\"SORTBYEXT\")\n\n        row = layout.row()\n        linha=row.operator(\"object.alinha_tres_pontos\", text=\"ALIGN!\", icon=\"MESH_DATA\")\n\n        row = layout.row()\n        linha=row.operator(\"object.force_icp\", text=\"Force ICP Align (Slow)\", icon=\"TRACKING_REFINE_FORWARDS\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.finaliza_mandibula_cm\", text=\"Finish Mandible\", icon=\"MESH_DATA\")\n\n\n\n        row = layout.row()\n        row.label(text=\"Mandible Collision:\")\n\n        row = layout.row()\n        row.operator(\"object.prepara_maxila_mandibula\", text=\"Prepares Maxilla & Mandible\", icon=\"SHADERFX\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.colisao_arcos_inverso\", text=\"Solve Collision Inverted\", icon=\"STYLUS_PRESSURE\")\n\n        row = layout.row()\n        linha=row.operator(\"object.aplica_anima_cor\", text=\"Contact Color\", icon=\"COLORSET_01_VEC\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.finaliza_colisao_max_mand\", text=\"Apply!!!\", icon=\"FREEZE\")\n\n\n\n        row = layout.row()\n        row.label(text=\"Piggyback:\")\n\n        row = layout.row()\n        row.label(text=\"1) Select son(s)\")\n        row = layout.row()\n        row.label(text=\"2) Select father\")\n\n        row = layout.row()\n        row.operator(\"object.parenteia_objetos\", text=\"MAKE PARENT\", icon=\"RESTRICT_VIEW_OFF\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.desparenteia_objetos\", text=\"Clear Parent\", icon=\"UNLINKED\")\n\n        row = layout.row()\n        row.label(text=\"Capturing:\")\n\n        row = layout.row()\n        row.operator(\"object.gera_deslocamento_todos\", text=\"Generate Data Action\", icon=\"FULLSCREEN_ENTER\")\n\n        row = layout.row()\n        row.label(text=\"Spreadsheet:\")\n\n        row = layout.row()\n        row.operator(\"object.gera_relatorio\", text=\"GENERATE REPORT\", icon=\"SHORTDISPLAY\")\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_kinematic\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\nclass ORTOG_PT_FechaLabios(bpy.types.Panel):\n    bl_label = \"Close Lips\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n#        row = layout.row()\n#        row.label(text=\"Close Lips:\")\n\n        row = layout.row()\n        row.operator(\"object.cria_shape_keys\", text=\"Create Shape Keys\", icon=\"MOD_SIMPLEDEFORM\")\n\n        row = layout.row()\n        ob = context.object\n        key = ob.data.shape_keys\n        kb = ob.active_shape_key\n\n        enable_edit = ob.mode != 'EDIT'\n        enable_edit_value = False\n\n        if ob.show_only_shape_key is False:\n            if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode):\n                enable_edit_value = True\n\n        if key.use_relative:\n            if ob.active_shape_key_index != 0:\n                layout.use_property_split = True\n\n                row = layout.row()\n                row.active = enable_edit_value\n                row.prop(kb, \"value\")\n\n                row = layout.row()\n                linha=row.operator(\"object.escultura_grab\", text=\"Grab\", icon=\"BRUSH_GRAB\")\n\n                row = layout.row()\n                linha=row.operator(\"object.escultura_smooth\", text=\"Smooth\", icon=\"BRUSH_SMOOTH\")\n\n                row = layout.row()\n                linha=row.operator(\"object.escultura_mask\", text=\"Mask\", icon=\"BRUSH_MASK\")\n\n                row = layout.row()\n                linha=row.operator(\"object.mode_set\", text=\"OK! (Object Mode)\", icon=\"META_CUBE\").mode='OBJECT'\n\nclass ENUM_VALUES_ARCHSCOLLISION:\n    DEFAULT = 'Default'\n    INVERTED = 'Inverted'\n\nclass ORTOG_PT_GuideCreation(bpy.types.Panel):\n    bl_label = \"Guide and Splint Creation\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_options = {'DEFAULT_CLOSED'}\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n\n        context = bpy.context\n        scn = context.scene\n\n        layout = self.layout\n\n        row = layout.row()\n        row.label(text=\"Free Draw Solid:\")\n\n        row = layout.row()\n        row.operator(\"object.linha_corte\", icon='LINE_DATA', text=\"Draw Surface Line\")\n\n        row = layout.row()\n        row.operator(\"object.desenha_guia\", text=\"Create Solid by Line\", icon=\"META_ELLIPSOID\")\n\n        row = layout.row()\n        row.label(text=\"Draw Line Tube:\")\n\n        row = layout.row()\n        row.operator(\"wm.modal_cria_pontos\", icon='CURVE_DATA', text=\"Create Points\")\n\n#        row = layout.row()\n#        row.operator(\"mesh.add_linha_pontos\", icon='LINE_DATA', text=\"Create Object\")\n\n        row = layout.row()\n        row.operator(\"mesh.add_curva_bezier\", icon='MESH_CYLINDER', text=\"Create Bezier Volume\")\n\n        row = layout.row()\n        row.label(text=\"Boolean:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_geral\", text=\"Difference\", icon=\"MOD_BOOLEAN\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_union\", text=\"Union\", icon=\"MOD_CAST\")\n\n        row = layout.row()\n        circle=row.operator(\"object.booleana_osteo_inter\", text=\"Intersect\", icon=\"MOD_MASK\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.booleana_union_multipla\", text=\"MULTIPLE UNION\", icon=\"STICKY_UVS_LOC\")\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Boolean Segmentation:\")\n\n        row = layout.row()\n#        row.operator(\"gpencil.annotate\", icon='LINE_DATA', text=\"Draw Line\").mode = 'DRAW_POLY'\n        row.operator(\"object.linha_corte_fora_a_fora\", icon='LINE_DATA', text=\"Draw Line\")\n\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_dentro\", text=\"Subtract IN\", icon=\"LIGHTPROBE_CUBEMAP\")\n\n        row = layout.row()\n        circle=row.operator(\"object.desenha_booleana_fora\", text=\"Subtract OUT\", icon=\"MESH_CUBE\")\n\n        row = layout.row()\n        row.label(text=\"Sculpture:\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_grab\", text=\"Grab\", icon=\"BRUSH_GRAB\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_smooth\", text=\"Smooth\", icon=\"BRUSH_SMOOTH\")\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_escultura_clay_strips\", text=\"Clay Strips\", icon=\"BRUSH_CLAY_STRIPS\")\n\n        row = layout.row()\n        linha=row.operator(\"object.mode_set\", text=\"OK! (Object Mode)\", icon=\"META_CUBE\").mode='OBJECT'\n\n        row = layout.row()\n        row.label(text=\"Teeth Points:\")\n\n        row = layout.row()\n        circle=row.operator(\"object.oculta_pontos_anatomicos\", text=\"Hide Anatomical Points\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        circle=row.operator(\"object.mostra_pontos_anatomicos\", text=\"Show Anatomical Points\", icon=\"GHOST_ENABLED\")\n\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.pontos_oculta_nomes\", text=\"Hide Names\", icon=\"GHOST_DISABLED\")\n\n        row = layout.row()\n        linha=row.operator(\"object.pontos_mostra_nomes\", text=\"Show Names\", icon=\"GHOST_ENABLED\")\n\n        row = layout.row()\n        row.label(text=\"Mode:\")\n\n        row = layout.row()\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Cursor\", icon=\"PIVOT_CURSOR\").name=\"builtin.cursor\"\n        linha=row.operator(\"wm.tool_set_by_id\", text=\"Select\", icon=\"RESTRICT_SELECT_OFF\").name=\"builtin.select_box\"\n\n        row = layout.row()\n        linha=row.operator(\"object.tooth_8_pt\", text=\"Tooth 8 (11)\")\n        linha=row.operator(\"object.tooth_9_pt\", text=\"Tooth 9 (21)\")\n        row = layout.row()\n        linha=row.operator(\"object.tooth_6_pt\", text=\"Tooth 6 (13)\")\n        linha=row.operator(\"object.tooth_11_pt\", text=\"Tooth 11 (23)\")\n        row = layout.row()\n        linha=row.operator(\"object.tooth_3_pt\", text=\"Tooth 3 (16)\")\n        linha=row.operator(\"object.tooth_14_pt\", text=\"Tooth 14 (26)\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        linha=row.operator(\"object.tooth_24_pt\", text=\"Tooth 24 (31)\")\n        linha=row.operator(\"object.tooth_25_pt\", text=\"Tooth 25 (41)\")\n\n        row = layout.row()\n        linha=row.operator(\"object.tooth_22_pt\", text=\"Tooth 22 (33)\")\n        linha=row.operator(\"object.tooth_27_pt\", text=\"Tooth 27 (43)\")\n\n        row = layout.row()\n        linha=row.operator(\"object.tooth_19_pt\", text=\"Tooth 19 (36)\")\n        linha=row.operator(\"object.tooth_30_pt\", text=\"Tooth 30 (46)\")\n\n        row = layout.row()\n        linha=row.operator(\"object.head_of_condyle_pt\", text=\"Condyle Rotation Point\")\n\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        circle=row.operator(\"object.parenteia_emp\", text=\"Parent Points\", icon=\"LINKED\")\n\n        row = layout.row()\n        row.label(text=\"Splint:\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"object.splint_maxila_origi_mand_final\", text=\"Maxilla-Origin Mandible-Final\", icon=\"GROUP_BONE\")\n        row = layout.row()\n        row.operator(\"object.splint_mand_origi_maxila_final\", text=\"Mandible-Origin Maxilla-Final\", icon=\"GROUP_BONE\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"screen.frame_jump\", text=\"Start\", icon=\"TRIA_LEFT_BAR\").end=False\n        row.operator(\"screen.animation_play\", text=\"\", icon=\"PLAY_REVERSE\").reverse=True\n        row.operator(\"anim.ortog_loc_rot\", text=\"\", icon=\"VIEW_CAMERA\")\n        row.operator(\"screen.animation_play\", text=\"\", icon=\"PLAY\")\n        row.operator(\"screen.frame_jump\", text=\"End\", icon=\"TRIA_RIGHT_BAR\").end=True\n\n        row = layout.row()\n        row.operator(\"object.cria_splint\", text=\"Create Splint\", icon=\"OUTLINER_OB_CURVE\")\n\n#        row = layout.row()\n#        row.operator(\"object.duplica_max_mand\", text=\"Prepares Maxilla & Mandible\", icon=\"SHADERFX\")\n\n        row = layout.row()\n        circle=row.operator(\"object.boolean_splint\", text=\"Boolean Difference\", icon=\"MOD_BOOLEAN\")\n\n        row = layout.row()\n        row.operator(\"object.visualiza_max_mand\", text=\"View Maxilla & Mandible\", icon=\"VISIBLE_IPO_ON\")\n\n# ----------------------\n        row = layout.row()\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Collision Test:\")\n\n        row = layout.row()\n        row.prop(scn, \"my_enum_archscollision\")\n\n        my_enum_ct = scn.my_enum_archscollision\n\n        if my_enum_ct == ENUM_VALUES_ARCHSCOLLISION.DEFAULT:\n\n            row = layout.row()\n            linha=row.operator(\"object.colisao_arcos\", text=\"Solve Collision Default\", icon=\"STYLUS_PRESSURE\")\n\n            row = layout.row()\n            row = layout.row()\n            linha=row.operator(\"object.aplica_anima_cor\", text=\"Contact Color\", icon=\"COLORSET_01_VEC\")\n\n            row = layout.row()\n            row.label(text=\"Press ESC to enable Apply!\")\n\n            row = layout.row()\n            linha=row.operator(\"object.trava_arco\", text=\"Apply!\", icon=\"FREEZE\")\n\n\n        if my_enum_ct == ENUM_VALUES_ARCHSCOLLISION.INVERTED:\n\n            row = layout.row()\n            linha=row.operator(\"object.colisao_arcos_inverso\", text=\"Solve Collision Inverted\", icon=\"STYLUS_PRESSURE\")\n\n            row = layout.row()\n            row = layout.row()\n            linha=row.operator(\"object.aplica_anima_cor\", text=\"Contact Color\", icon=\"COLORSET_01_VEC\")\n\n            row = layout.row()\n            row.label(text=\"Press ESC to enable Apply!\")\n\n            row = layout.row()\n            linha=row.operator(\"object.trava_arco\", text=\"Apply!\", icon=\"FREEZE\")\n\n# ----------------------\n\n\n        row = layout.row()\n        row = layout.row()\n        row.label(text=\"Finishing\")\n\n        row = layout.row()\n        row.operator(\"object.prepara_impressao_3d\", text=\"Prepares 3D Printing\", icon=\"META_CUBE\")\n\n        row = layout.row()\n\n        row.operator(\"export_mesh.stl\", text=\"Export STL\", icon=\"TRACKING_REFINE_FORWARDS\").use_selection=True#.use_mesh_modifiers=True\n\n        row = layout.row()\n        row = layout.row()\n        box = layout.box()\n        col = box.column(align=True)\n        row = col.row()\n        row.scale_y=1.5\n        row.alignment = 'CENTER'\n        row.operator(\"object.gera_dir_nome_paciente_guide\", text=\"SAVE!\", icon=\"FILE_TICK\")\n\n\nclass ORTOG_PT_ImportTomoImg(bpy.types.Panel):\n    bl_label = \"Importing & Editing CT-Scan\"\n    bl_space_type = 'IMAGE_EDITOR'\n    bl_region_type = 'UI'\n    bl_category = \"Ortog\"\n#    bl_category = \"Image\"\n\n    def draw(self, context):\n        layout = self.layout\n#        layout.use_property_split = True\n\n#        row = layout.row()\n#        row.label(text=\"Free Draw Solid:\")\n\n        row = layout.row()\n        row.operator(\"object.importa_img_tomo\", text=\"Import CT-Scan IMG Slices\", icon=\"IMAGE_DATA\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"IMGPathSeq\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"SliceThickness\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"PixelSpacingX\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"PixelSpacingY\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"IMGDimX\")\n\n        row = layout.row(align = True)\n        row.prop(context.scene, \"IMGDimY\")\n\n        row = layout.row()\n        row = layout.row()\n        row.operator(\"image.save_sequence\", text=\"Save Sequence\", icon=\"EXPORT\")\n\n        row = layout.row()\n        row.operator(\"object.exporta_img_tomo\", text=\"Export DICOM Slices\", icon=\"EXPORT\")\n\nclass ORTOG_PT_Render(bpy.types.Panel):\n    bl_label = \"Render\"\n    bl_region_type = 'UI'\n    bl_space_type = 'VIEW_3D'\n    bl_category = \"Ortog\"\n\n    def draw(self, context):\n        layout = self.layout\n\n        row = layout.row()\n        linha=row.operator(\"object.forensic_importa_luzes\", text=\"ILLUMINATE!\", icon=\"LIGHT_DATA\")\n\n\ndef register():\n    bpy.utils.register_class(EMP1a)\n    bpy.utils.register_class(EMP2a)\n    bpy.utils.register_class(EMP3a)\n    bpy.utils.register_class(EMP1b)\n    bpy.utils.register_class(EMP2b)\n    bpy.utils.register_class(EMP3b)\n    bpy.utils.register_class(Orbital_right_pt)\n    bpy.utils.register_class(Orbital_left_pt)\n    bpy.utils.register_class(N_pt)\n    bpy.utils.register_class(Po_right_pt)\n    bpy.utils.register_class(Po_left_pt)\n    bpy.utils.register_class(Pt_right_pt)\n    bpy.utils.register_class(Pt_left_pt)\n    bpy.utils.register_class(Ba_pt)\n    bpy.utils.register_class(S_pt)\n    bpy.utils.register_class(U1_Tip_pt)\n    bpy.utils.register_class(U1_LabGenBor_pt)\n    bpy.utils.register_class(U1_LinGenBor_pt)\n    bpy.utils.register_class(M_U6_pt)\n    bpy.utils.register_class(D_U6_pt)\n    bpy.utils.register_class(U6_Occlusal_pt)\n    bpy.utils.register_class(PNS_pt)\n    bpy.utils.register_class(A_pt)\n    bpy.utils.register_class(ANS_pt)\n    bpy.utils.register_class(U1_Root_pt)\n    bpy.utils.register_class(L1_Tip_pt)\n    bpy.utils.register_class(L1_Root_pt)\n    bpy.utils.register_class(L1_LabGenBor_pt)\n    bpy.utils.register_class(L1_LinGenBor_pt)\n    bpy.utils.register_class(B_pt)\n    bpy.utils.register_class(M_L6_pt)\n    bpy.utils.register_class(L6_Occlusal_pt)\n    bpy.utils.register_class(ORTOG_UI_Local)\n    bpy.utils.register_class(D_L6_pt)\n    bpy.utils.register_class(MidRamusRight_pt)\n    bpy.utils.register_class(MidRamusLeft_pt)\n    bpy.utils.register_class(R_right_pt)\n    bpy.utils.register_class(R_left_pt)\n    bpy.utils.register_class(Go_right_pt)\n    bpy.utils.register_class(Go_left_pt)\n    bpy.utils.register_class(Ar_right_pt)\n    bpy.utils.register_class(Ar_left_pt)\n    bpy.utils.register_class(Sigmoid_right_pt)\n    bpy.utils.register_class(Sigmoid_left_pt)\n    bpy.utils.register_class(Co_right_pt)\n    bpy.utils.register_class(Co_left_pt)\n    bpy.utils.register_class(Pg_pt)\n    bpy.utils.register_class(Gn_pt)\n    bpy.utils.register_class(Me_pt)\n    bpy.types.Scene.my_tool = PointerProperty(type=ORTOG_UI_Local)\n    bpy.utils.register_class(ORTOG_PT_AtualizaAddonSec)\n    bpy.utils.register_class(ORTOG_PT_NomePaciente)\n    bpy.types.Scene.nome_paciente = bpy.props.StringProperty \\\n      (\n        name = \"Name\",\n        description = \"Patient's name\",\n        default = \"\"\n      )\n    bpy.types.Scene.sobrenome_paciente = bpy.props.StringProperty \\\n      (\n        name = \"Surname\",\n        description = \"Patient's surname\",\n        default = \"\"\n      )\n    bpy.utils.register_class(AtualizaScript)\n    bpy.utils.register_class(AreasInfluencia)\n    bpy.utils.register_class(CriaAreasDeformacao)\n    bpy.utils.register_class(ConfiguraDinamicaMole)\n    bpy.utils.register_class(ConfiguraMento)\n    bpy.utils.register_class(ConfiguraCorpoMand)\n    bpy.utils.register_class(ConfiguraRamoEsq)\n    bpy.utils.register_class(ConfiguraRamoDir)\n    bpy.utils.register_class(ConfiguraMaxila)\n    bpy.utils.register_class(ConfiguraCabeca)\n    bpy.utils.register_class(ImportaArmature)\n    bpy.utils.register_class(ConfOsteotomiaAuto)\n    bpy.utils.register_class(BooleanaOsteoGeral)\n    bpy.utils.register_class(CriaMaxila)\n    bpy.utils.register_class(CriaRamo)\n    bpy.utils.register_class(CriaMento)\n    bpy.utils.register_class(DesenhaLinhaVertex)\n    bpy.utils.register_class(DesenhaLinhaVertexFin)\n    bpy.utils.register_class(BooleanaOsteoClass)\n    bpy.utils.register_class(DesenhaLinhaCorte)\n    bpy.utils.register_class(LinhaCorte)\n    bpy.utils.register_class(SegmentaDesenho)\n    bpy.utils.register_class(BooleanaMand)\n    bpy.utils.register_class(MantemPintado)\n    bpy.utils.register_class(ApagaPintado)\n    bpy.utils.register_class(Weight0)\n    bpy.utils.register_class(Weight1)\n    bpy.utils.register_class(SegmentaLinked)\n    bpy.utils.register_class(LinhaBase)\n    bpy.utils.register_class(ORTOG_PT_CTScanSelect)\n#    bpy.utils.register_class(ORTOG_PT_CTScanOrgFIX)\n    bpy.utils.register_class(CorrigeDicom)\n    bpy.utils.register_class(AjustaTomo)\n    bpy.types.Scene.my_enum_ct = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_CTSCAN.MANUAL, \"MANUAL\", \"Manual CT-Scan Reconstruction\"), (ENUM_VALUES_CTSCAN.DEFAULT, \"DEFAULT\", \"Default CT-Scan Reconstruction\"), (ENUM_VALUES_CTSCAN.VOXEL, \"VOXEL\", \"Voxel Data CT-Scan Reconstruction\"), (ENUM_VALUES_CTSCAN.VOXEL_FULL, \"VOXEL-FULL!\", \"Voxel Axial + Coronal + Sagital\"), (ENUM_VALUES_CTSCAN.AUTO, \"AUTOMATIC\", \"Automatic CT-Scan Reconstruction\"), (ENUM_VALUES_CTSCAN.CUSTOM, \"CUSTOM\", \"Customized CT-Scan Reconstruction\"), (ENUM_VALUES_CTSCAN.AUTOEXP, \"AUTO EXP.!!!\", \"Manual CT-Scan Reconstruction\")],)\n    bpy.utils.register_class(GeraModelosTomo)\n#    bpy.utils.register_class(ORTOG_PT_CTScanFerrImg)\n#    bpy.utils.register_class(ORTOG_PT_CTScanRec)\n\n\n    bpy.types.Scene.interesse_geral = bpy.props.StringProperty \\\n      (\n        name = \"Reconst. Factor\",\n        description = \"Reconstruction Factor\",\n        default = \"NONE\"\n      )\n\n    bpy.types.Scene.fator_simplificacao = bpy.props.StringProperty \\\n      (\n        name = \"Decimate Factor\",\n        description = \"Decimate Factor\",\n        default = \"0.90\"\n      )\n\n    bpy.types.Scene.nome_objeto = bpy.props.StringProperty \\\n      (\n        name = \"Object Name\",\n        description = \"Object Name\",\n        default = \"CT-Scan Reconstructed\"\n      )\n\n    bpy.types.Scene.interesse_ossos = bpy.props.StringProperty \\\n      (\n        name = \"Bone Factor\",\n        description = \"Fatos interesse ossos\",\n        default = \"200\"\n      )\n    bpy.types.Scene.interesse_mole = bpy.props.StringProperty \\\n      (\n        name = \"Soft Factor\",\n        description = \"Fatos interesse mole\",\n        default = \"-300\"\n      )\n    bpy.types.Scene.interesse_dentes = bpy.props.StringProperty \\\n      (\n        name = \"Teeth Factor\",\n        description = \"Fatos interesse dentes\",\n        default = \"1430\"\n      )\n    bpy.utils.register_class(ORTOG_PT_GraphicRefs)\n\n    bpy.types.Scene.interesse_arco = bpy.props.StringProperty \\\n      (\n        name = \"Factor\",\n        description = \"Fatos interesse arco\",\n        default = \"226\"\n      )\n\n    bpy.types.Scene.my_enum_archscollision = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_ARCHSCOLLISION.DEFAULT, \"DEFAULT\", \"Default gravity.\"), (ENUM_VALUES_ARCHSCOLLISION.INVERTED, \"INVERTED\", \"Inverted gravity.\")],)\n\n    bpy.utils.register_class(ORTOG_PT_ImportaArc)\n#    bpy.data.scenes['Scene'].render.filepath\n    bpy.utils.register_class(AlinhaTresPontos)\n    bpy.utils.register_class(ORTOG_OT_GeraModelosTomoArc)\n    bpy.utils.register_class(ORTOG_PT_Segmentation)\n    bpy.utils.register_class(ORTOG_PT_SegmentacaoFace)\n    bpy.utils.register_class(ORTOG_PT_Converte_Video)\n    bpy.types.Scene.d_factor = bpy.props.StringProperty \\\n      (\n        name = \"D Factor\",\n        description = \"D Factor\",\n        default = \"6\"\n      )\n    bpy.types.Scene.smooth_factor = bpy.props.StringProperty \\\n      (\n        name = \"Smooth Factor\",\n        description = \"Smooth Factor\",\n        default = \"16\"\n      )\n\n    bpy.types.Scene.my_enum = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_PHOTOGRAMMETRY.OPENMVG, \"OpenMVG+OpenMVS\", \"Standard Photogrammetry\"), (ENUM_VALUES_PHOTOGRAMMETRY.SMVS, \"SMVS+MeshLab\", \"Alternative Photogrammetry I\"), (ENUM_VALUES_PHOTOGRAMMETRY.MESHROOM, \"Meshroom (AliceVision)\", \"Alternative Photogrammetry II\"), (ENUM_VALUES_PHOTOGRAMMETRY.OPENMVGWIN, \"OpenMVS Linux on Win\", \"Alternative Photogrammetry III\")],)\n\n    bpy.utils.register_class(ORTOG_PT_Fotogrametria)\n    bpy.utils.register_class(ORTOG_PT_AlinhaFace)\n    bpy.utils.register_class(ORTOG_PT_FotogramModif)\n    bpy.utils.register_class(ORTOG_PT_AlinhaFaceCT)\n    bpy.utils.register_class(ORTOG_PT_PontosAnatomicos)\n    bpy.types.Scene.plano_oclusal_maxila_classico = bpy.props.StringProperty \\\n        (\n            name = \"Maxillary Occlusal Angle\",\n            description = \"Maxilla Occlusal\",\n            default = \"NONE\"\n        )\n    bpy.types.Scene.my_enum_ana = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_ANATOMICAL.HEAD, \"HEAD\", \"Head Points\"), (ENUM_VALUES_ANATOMICAL.MAXILLA, \"MAXILLA\", \"Maxilla Points\"), (ENUM_VALUES_ANATOMICAL.MANDIBLE, \"MANDIBLE\", \"Mandible Points\"), (ENUM_VALUES_ANATOMICAL.TEETH, \"TEETH\", \"Teeth Points\"), (ENUM_VALUES_ANATOMICAL.SOFTTISSUE, \"SOFT TISSUE\", \"Soft Tissue Points\")],)\n#    bpy.utils.register_class(ORTOG_PT_PontosAnatomicosCabeca)\n#    bpy.utils.register_class(ORTOG_PT_PontosAnatomicosMaxila)\n#    bpy.utils.register_class(ORTOG_PT_PontosAnatomicosMandibula)\n#    bpy.utils.register_class(ORTOG_PT_PontosAnatomicosDentes)\n#    bpy.utils.register_class(ORTOG_PT_PontosAnatomicosMole)\n    bpy.types.Scene.my_enum_cefalometria = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_CEFALOMETRIA.USP, \"USP\", \"USP Cephalometry.\"), (ENUM_VALUES_CEFALOMETRIA.ARNETT, \"ARNETT\", \"ARNETT Cephalometry.\")],)\n    bpy.types.Scene.plano_mandibula_usp = bpy.props.StringProperty \\\n        (\n            name = \"Mandibular Plane\",\n            description = \"Mandibular Plane\",\n            default = \"NONE\"\n        )\n    bpy.utils.register_class(ORTOG_PT_Cefalometria)\n    bpy.types.Scene.my_enum_osteotomy = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_OSTEOTOMY.AUTO, \"AUTO\", \"Automatic Ostetotomy Cut Planes\"), (ENUM_VALUES_OSTEOTOMY.MANUAL, \"MANUAL\", \"Manual Ostetotomy Cut Planes\"), (ENUM_VALUES_OSTEOTOMY.BOOLEAN, \"BOOLEAN\", \"Boolean Ostetotomy Cut\"), (ENUM_VALUES_OSTEOTOMY.DRAW, \"DRAW\", \"Draw Ostetotomy\")],)\n    bpy.utils.register_class(ORTOG_PT_Osteotomia)\n    bpy.types.Scene.medida_real2 = bpy.props.StringProperty \\\n      (\n        name = \"\",\n        description = \"Real size distance between eyes\",\n        default = \"None\"\n      )\n    bpy.types.Scene.my_enum_dynamic = bpy.props.EnumProperty(\n        name=\"Select\",\n        description= \"\",\n        items=[(ENUM_VALUES_DYNAMIC.DEFAULT, \"DEFAULT\", \"Default dynamic.\"), (ENUM_VALUES_DYNAMIC.NOSE, \"NOSE EXP.\", \"Better deformation of nose.\"), (ENUM_VALUES_DYNAMIC.EXPERIMENTAL, \"EXPERIMENTAL SLICES\", \"Dynamic with indetermined slices.\")],)\n    bpy.utils.register_class(ORTOG_PT_ArmatureDynamic)\n\n    bpy.types.Scene.nome_ponto_customizado = bpy.props.StringProperty \\\n      (\n        name = \"Object Name\",\n        description = \"Object Name\",\n        default = \"MeasurePoint\"\n      )\n\n    bpy.utils.register_class(ORTOG_PT_CinematicaPanel)\n    bpy.utils.register_class(ORTOG_PT_FechaLabios)\n    bpy.utils.register_class(ORTOG_PT_GuideCreation)\n    bpy.utils.register_class(ORTOG_PT_ImportTomoImg)\n    bpy.utils.register_class(ORTOG_PT_Render)\n    bpy.types.Scene.IMGPathSeq = bpy.props.StringProperty \\\n      (\n        name = \"IMGPathSeq\",\n        description = \"IMGPathSeq\",\n        default = \"NONE\"\n      )\n    bpy.types.Scene.SliceThickness = bpy.props.StringProperty \\\n      (\n        name = \"SliceThickness\",\n        description = \"Slice Thickness\",\n        default = \"NONE\"\n      )\n\n    bpy.types.Scene.PixelSpacingX = bpy.props.StringProperty \\\n      (\n        name = \"PixelSpacingX\",\n        description = \"Pixel SpacingX\",\n        default = \"NONE\"\n      )\n\n    bpy.types.Scene.PixelSpacingY = bpy.props.StringProperty \\\n      (\n        name = \"PixelSpacingY\",\n        description = \"Pixel SpacingY\",\n        default = \"NONE\"\n      )\n\n    bpy.types.Scene.IMGDimX = bpy.props.StringProperty \\\n      (\n        name = \"IMGDimX\",\n        description = \"IMGDimX\",\n        default = \"NONE\"\n      )\n\n    bpy.types.Scene.IMGDimY = bpy.props.StringProperty \\\n      (\n        name = \"IMGDimY\",\n        description = \"IMGDimY\",\n        default = \"NONE\"\n      )\n\n\n\ndef unregister():\n    bpy.utils.unregister_class(NomePaciente)\n    bpy.utils.unregister_class(NomePacienteTomo)\n    bpy.utils.unregister_class(NomePacienteArc)\n    bpy.utils.unregister_class(NomePacienteRef)\n    bpy.utils.unregister_class(NomePacienteSeg)\n    bpy.utils.unregister_class(NomePacienteFotogram)\n    bpy.utils.unregister_class(ORTOG_PT_NomePaciente)\n    bpy.utils.unregister_class(Orbital_right_pt)\n    bpy.utils.unregister_class(Orbital_left_pt)\n    bpy.utils.unregister_class(N_pt)\n    bpy.utils.unregister_class(Po_right_pt)\n    bpy.utils.unregister_class(Po_left_pt)\n    bpy.utils.unregister_class(Pt_right_pt)\n    bpy.utils.unregister_class(Pt_left_pt)\n    bpy.utils.unregister_class(Ba_pt)\n    bpy.utils.unregister_class(S_pt)\n    bpy.utils.unregister_class(U1_Tip_pt)\n    bpy.utils.unregister_class(U1_LabGenBor_pt)\n    bpy.utils.unregister_class(U1_LinGenBor_pt)\n    bpy.utils.unregister_class(M_U6_pt)\n    bpy.utils.unregister_class(D_U6_pt)\n    bpy.utils.unregister_class(U6_Occlusal_pt)\n    bpy.utils.unregister_class(PNS_pt)\n    bpy.utils.unregister_class(A_pt)\n    bpy.utils.unregister_class(ANS_pt)\n    bpy.utils.unregister_class(L1_Tip_pt)\n    bpy.utils.register_class(U1_Root_pt)\n    bpy.utils.unregister_class(L1_LabGenBor_pt)\n    bpy.utils.unregister_class(L1_LinGenBor_pt)\n    bpy.utils.unregister_class(B_pt)\n    bpy.utils.unregister_class(M_L6_pt)\n    bpy.utils.unregister_class(L6_Occlusal_pt)\n    bpy.utils.unregister_class(D_L6_pt)\n    bpy.utils.unregister_class(MidRamusRight_pt)\n    bpy.utils.unregister_class(MidRamusLeft_pt)\n    bpy.utils.unregister_class(R_right_pt)\n    bpy.utils.unregister_class(R_left_pt)\n    bpy.utils.unregister_class(Go_right_pt)\n    bpy.utils.unregister_class(Go_left_pt)\n    bpy.utils.unregister_class(Ar_right_pt)\n    bpy.utils.unregister_class(Ar_left_pt)\n    bpy.utils.unregister_class(Sigmoid_right_pt)\n    bpy.utils.unregister_class(Sigmoid_left_pt)\n    bpy.utils.unregister_class(Co_right_pt)\n    bpy.utils.unregister_class(Co_left_pt)\n    bpy.utils.unregister_class(Pg_pt)\n    bpy.utils.unregister_class(Gn_pt)\n    bpy.utils.unregister_class(Me_pt)\n    bpy.utils.unregister_class(ORTOG_PT_AtualizaAddonSec)\n    bpy.utils.unregister_class(AtualizaScript)\n    bpy.utils.unregister_class(AreasInfluencia)\n    bpy.utils.unregister_class(CriaAreasDeformacao)\n    bpy.utils.unregister_class(ConfiguraDinamicaMole)\n    bpy.utils.unregister_class(ConfiguraMento)\n    bpy.utils.unregister_class(ConfiguraCorpoMand)\n    bpy.utils.unregister_class(ConfiguraRamoEsq)\n    bpy.utils.unregister_class(ConfiguraRamoDir)\n    bpy.utils.unregister_class(ConfiguraMaxila)\n    bpy.utils.unregister_class(ConfiguraCabeca)\n    bpy.utils.unregister_class(ImportaArmature)\n    bpy.utils.unregister_class(ConfOsteotomiaAuto)\n    bpy.utils.unregister_class(BooleanaOsteoGeral)\n    bpy.utils.unregister_class(CriaMaxila)\n    bpy.utils.unregister_class(CriaRamo)\n    bpy.utils.unregister_class(CriaMento)\n    bpy.utils.unregister_class(DesenhaLinhaVertex)\n    bpy.utils.unregister_class(DesenhaLinhaVertexFin)\n    bpy.utils.unregister_class(BooleanaOsteoClass)\n    bpy.utils.unregister_class(DesenhaLinhaCorte)\n    bpy.utils.unregister_class(LinhaCorte)\n    bpy.utils.unregister_class(AlinhaTresPontos)\n    bpy.utils.unregister_class(SegmentaDesenho)\n    bpy.utils.unregister_class(BooleanaMand)\n    bpy.utils.unregister_class(MantemPintado)\n    bpy.utils.unregister_class(ApagaPintado)\n    bpy.utils.unregister_class(Weight0)\n    bpy.utils.unregister_class(Weight1)\n    bpy.utils.unregister_class(SegmentaLinked)\n    bpy.utils.unregister_class(LinhaBase)\n#    bpy.utils.unregister_class(ORTOG_PT_CTScanOrgFIX)\n    bpy.utils.unregister_class(CorrigeDicom)\n    bpy.utils.unregister_class(AjustaTomo)\n    bpy.utils.unregister_class(GeraModelosTomo)\n#    bpy.utils.unregister_class(ORTOG_PT_CTScanFerrImg)\n#    bpy.utils.unregister_class(CTScanRec)\n    bpy.utils.unregister_class(ORTOG_PT_ImportaArc)\n    bpy.utils.unregister_class(ORTOG_UI_CapturaLocal)\n    bpy.utils.unregister_class(ORTOG_OT_GeraModelosTomoArc)\n    bpy.utils.unregister_class(ORTOG_PT_GraphicRefs)\n    bpy.utils.unregister_class(ORTOG_PT_Segmentation)\n    bpy.utils.unregister_class(ORTOG_PT_Fotogrametria)\n    bpy.utils.unregister_class(ORTOG_PT_AlinhaFace)\n    bpy.utils.unregister_class(ORTOG_PT_FotogramModif)\n    bpy.utils.unregister_class(ORTOG_PT_AlinhaFaceCT)\n#    bpy.utils.unregister_class(ORTOG_PT_PontosAnatomicosCabeca)\n#    bpy.utils.unregister_class(ORTOG_PT_PontosAnatomicosMaxila)\n#    bpy.utils.unregister_class(ORTOG_PT_PontosAnatomicosMandibula)\n#    bpy.utils.unregister_class(ORTOG_PT_PontosAnatomicosDentes)\n#    bpy.utils.unregister_class(ORTOG_PT_PontosAnatomicosMole)\n    bpy.utils.unregister_class(ORTOG_PT_Cefalometria)\n    bpy.utils.unregister_class(ORTOG_PT_Osteotomia)\n    del bpy.types.Scene.medida_real2\n    bpy.utils.unregister_class(EMP1a)\n    bpy.utils.unregister_class(EMP2a)\n    bpy.utils.unregister_class(EMP3a)\n    bpy.utils.unregister_class(EMP1b)\n    bpy.utils.unregister_class(EMP2b)\n    bpy.utils.unregister_class(EMP3b)\n    bpy.utils.unregister_class(ORTOG_PT_ArmatureDynamic)\n    bpy.utils.unregister_class(ORTOG_PT_CinematicaPanel)\n    bpy.utils.unregister_class(ORTOG_PT_GuideCreation)\n    bpy.utils.unregister_class(ORTOG_PT_ImportTomoImg)\n\nif __name__ == \"__main__\":\n    register()\n"
  }
]