diff --git a/yj_local_build/config.json b/yj_local_build/config.json index ae82af5..4423757 100644 --- a/yj_local_build/config.json +++ b/yj_local_build/config.json @@ -1,8 +1,8 @@ { "workdir": "D://", - "local_need_build": "/\\172.31.1.253/modeling/local_need_build", - "local_complate_build":"/\\172.31.1.253/modeling/local_complate_build", - "rcbin": "'C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe'", + "local_need_build": "D://local_need_build", + "local_complate_build":"D://local_complate_build", + "rcbin": "'C:\\Program Files\\Epic Games\\RealityCapture_1.5\\AppProxy.exe'", "urls": { "update_status_modelsuccess_url": "http://172.16.20.13:8383/update_take_photo" }, diff --git a/yj_local_build/detectMarkers_1.5.config.xml b/yj_local_build/detectMarkers_1.5.config.xml new file mode 100644 index 0000000..8f436f7 --- /dev/null +++ b/yj_local_build/detectMarkers_1.5.config.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/yj_local_build/exportXMP.1.5.draft.config.xml b/yj_local_build/exportXMP.1.5.draft.config.xml new file mode 100644 index 0000000..8f7ebb6 --- /dev/null +++ b/yj_local_build/exportXMP.1.5.draft.config.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/yj_local_build/exportXMP.1.5.lock.config.xml b/yj_local_build/exportXMP.1.5.lock.config.xml new file mode 100644 index 0000000..c073e91 --- /dev/null +++ b/yj_local_build/exportXMP.1.5.lock.config.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index f2cd11b..c499f69 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -73,11 +73,18 @@ def filter_dark_texture_image(pid): def detect_markers(psid, pid): def fix_region(): - region_filename = os.path.join(config['workdir'], pid, f'{pid}.rcbox') - with open(region_filename, 'r') as f: - lines = f.readlines() - lines = [line.replace('"NONE" globalCoordinateSystemWkt="NONE" globalCoordinateSystemName="NONE"', '"+proj=geocent +ellps=WGS84 +no_defs" globalCoordinateSystemName="local:1 - Euclidean"') for line in lines] - + #判断是否存在rcbox + region_filename = os.path.join(config["workdir"], pid, f"{pid}.rcbox") + while True: + if os.path.exists(region_filename): + print("region_filename",region_filename) + with open(region_filename, 'r') as f: + lines = f.readlines() + lines = [line.replace('"NONE" globalCoordinateSystemWkt="NONE" globalCoordinateSystemName="NONE"', '"+proj=geocent +ellps=WGS84 +no_defs" globalCoordinateSystemName="local:1 - Euclidean"') for line in lines] + break + else: + time.sleep(10) + print(f"不存在{region_filename}") start_time = time.time() textpicCmd ='-selectImage "'+os.path.join(config['workdir'],pid,'photo2')+'\*" -enableTexturingAndColoring true' @@ -88,9 +95,9 @@ def detect_markers(psid, pid): -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -align -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" \ -align -selectAllImages \ - -detectMarkers "{dirCurr}\detectMarkers.config.xml" \ + -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ -defineDistance 36h11:001 36h11:002 1 -defineDistance 36h11:002 36h11:004 1 -defineDistance 36h11:004 36h11:003 1 -defineDistance 36h11:003 36h11:001 1 -align -align -update {config["r2"]["setRegion"]} \ - -exportXMP "{dirCurr}\exportXMP.config.xml" \ + -exportXMP "{dirCurr}\exportXMP.1.5.draft.config.xml" \ -exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ -exportReconstructionRegion "{os.path.join(config["workdir"], pid, f"{pid}.rcbox")}" \ {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' @@ -126,18 +133,27 @@ def step2(pid,headsCount): print(cmd) cmd = shlex.split(cmd) res = subprocess.run(cmd) + print("res",res) #阻塞判断是否导出完成 while True: - #判断 output 目录下是否存在 三个文件 - files = os.listdir(os.path.join(config['workdir'], pid, "output")) - if len(files) >= 3: - break + try: + #判断 output 目录下是否存在 三个文件 + files = os.listdir(os.path.join(config['workdir'], pid, "output")) + if len(files) >= 3: + time.sleep(5) + break + except Exception as e: + time.sleep(5) + continue + #将导出的文件移动到指定目录 sourceDir = config["local_complate_build"] #判断目录是否存在,不存在就创建 - if not os.path.exists(sourceDir): - os.makedirs(sourceDir) + if os.path.exists(os.path.join(sourceDir,pid)): + #删除 + os.removedirs(os.path.join(sourceDir,pid)) + os.makedirs(os.path.join(sourceDir,pid)) #将 output 目录里的文件移动到指定目录 shutil.move(os.path.join(config['workdir'], pid, "output"),os.path.join(sourceDir,pid)) @@ -152,7 +168,9 @@ def step2(pid,headsCount): def main(pid,headsCount): step1(pid, headsCount) -if __name__ == '__main__': +if __name__ == '__main__': + # step1("235558",1) + # exit() try: url = config['urls']['update_status_modelsuccess_url'] if url == "": @@ -191,13 +209,15 @@ if __name__ == '__main__': try: while True: time.sleep(5) - print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 建模任务循环开始') + print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 建模任务循环开始,{needBuildDir}') for pid in os.listdir(needBuildDir): + print("pid=",pid) if not os.path.isdir(os.path.join(needBuildDir,pid)): continue - + #判断是否存在 canDo.txt 文件,如果不存在就跳过 if not os.path.exists(os.path.join(needBuildDir,pid,"canDo.txt")): + print(f'不存在 canDo.txt- {os.path.join(needBuildDir,pid,"canDo.txt")}') continue #读取 canDo.txt 文件内容 @@ -208,6 +228,7 @@ if __name__ == '__main__': #判断文件夹里是否存在 do.txt , 如果存在就跳过,不存在就创建 if os.path.exists(os.path.join(needBuildDir,pid,"do.txt")): + print("存在 do.txt 。则跳过处理") continue else: with open(os.path.join(needBuildDir,pid,"do.txt"),"w") as f: