Retouches des dessins 2D

This commit is contained in:
Youen 2023-11-08 18:12:22 +01:00
parent cbaa3c7cf7
commit 91a85e0f26
56 changed files with 252 additions and 230 deletions

View file

@ -11,15 +11,32 @@ verbose = False
project_folder = os.getcwd()
def apply_styles(page):
modified = False
dim_font_size = 3.0
for view in page.Views:
if view.TypeId == 'TechDraw::DrawViewDimension':
if view.ViewObject.Fontsize != dim_font_size:
view.ViewObject.Fontsize = dim_font_size
modified = True
return modified
async def generate_2d_drawing(file_name):
doc = App.open(project_folder + '/' + file_name)
modified = False
page_name = doc.Name + '_Drawing'
if doc.getObject(page_name) is not None:
page = doc.getObject(page_name)
if page is not None:
print('2D drawing already exists - skipped')
return
else:
modified = True
template_file_name = project_folder + '/lib/A4_Landscape_VSPT.svg'
root_objects = []
@ -249,9 +266,14 @@ async def generate_2d_drawing(file_name):
await vspt_coroutine.get_main_loop().wait(1)
await addDimensions()
if apply_styles(page):
modified = True
if modified:
if verbose: print("Saving...")
page.recompute(True)
page.ViewObject.Visibility = False # don't save the document with the page open or it will automatically reopen on load
await vspt_coroutine.get_main_loop().wait(1)
doc.save()
if verbose: print("Closing...")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.