建模相关功能的修改

This commit is contained in:
dongchangxi committed 2024-02-05 16:04:17 +08:00
1 parent e1a7647fcb
commit 04852e95cd
7 files changed
+280 -7

No files matched your search

+27
View File
@@ -138,6 +138,27 @@ def change_rcbox_deepth(pid,new_value):
with open(rcbox_path, 'w') as f:
f.write(new_content)
def change_rcbox_center(pid,new_value):
rcbox_path = os.path.join(config.workdir, pid, f"{pid}.rcbox")
old_value_pattern = r'<center>(.*?)</center>'
#读取文件内容
with open(rcbox_path, 'r') as f:
content = f.read()
#使用正则表达式进行匹配
match = re.search(old_value_pattern,content)
if match:
old_value = match.group(1)
if old_value == "":
return
#分割字符串
arrStr = old_value.split(" ")
#重新拼接字符串
strs = arrStr[0]+" "+arrStr[1]+" "+str(new_value)
new_content = re.sub(old_value_pattern,f'<center>{strs}</center>',content)
#重新写入进去
with open(rcbox_path, 'w') as f:
f.write(new_content)
#修改rcproj文件,删除没有模型的component,保留最多model 的component
def changeRcprojFile(pid):
# 解析XML文件
@@ -224,6 +245,12 @@ def uploadControlPointsOss(pid):
#截屏保存
def saveScreenImg(pid):
#判断pid 是否是数字
if str(pid).isdigit() == False:
return
if pid == 0 or pid == "":
return "pid 等于空"
#获取当前的日志
if not os.path.exists(os.path.join(config.workdir,"screen", time.strftime("%y%m%d",time.localtime()))):
os.makedirs(os.path.join(config.workdir,"screen", time.strftime("%y%m%d",time.localtime())))