Add API covnertv3tov2
This commit is contained in:
@@ -35,6 +35,9 @@ from .s27_backdrop import inp_in_backdrop
|
||||
from .s32_region import inp_in_region,inp_in_bound,inp_in_regionnodes
|
||||
from .s32_region_util import from_postgis_polygon,to_postgis_polygon
|
||||
|
||||
#DingZQ, 2024-12-28, export inp
|
||||
from .inp_out import export_inp
|
||||
|
||||
_S = 'S'
|
||||
_L = 'L'
|
||||
|
||||
@@ -371,6 +374,29 @@ def read_inp(project: str, inp: str, version: str = '3') -> bool:
|
||||
close_project(project)
|
||||
return True
|
||||
|
||||
#DingZQ, 2024-12-28, convert v3 to v2
|
||||
def convert_inp_v3_to_v2(inp: str) -> ChangeSet:
|
||||
project = 'v3Tov2'
|
||||
|
||||
if is_project_open(project):
|
||||
close_project(project)
|
||||
|
||||
if have_project(project):
|
||||
delete_project(project)
|
||||
|
||||
create_project(project)
|
||||
open_project(project)
|
||||
|
||||
parse_file(project, inp, '3')
|
||||
|
||||
'''try:
|
||||
parse_file(project, inp, version)
|
||||
except:
|
||||
close_project(project)
|
||||
delete_project(project)
|
||||
return False'''
|
||||
|
||||
return export_inp(project, '2')
|
||||
|
||||
def import_inp(project: str, cs: ChangeSet, version: str = '3') -> bool:
|
||||
if version != '3' and version != '2':
|
||||
|
||||
Reference in New Issue
Block a user