FreeCAD/FreeCAD

Core: `FreeCAD.closeDocument(name)` if name contains minus symbol ie `-`

Aberta

#15.966 aberto em 19 de ago. de 2024

 (11 comentários) (0 reação) (0 responsável)C++ (5.550 forks)batch import
Good first issueHelp wantedMod: CoreStatus: ConfirmedType: Bug

Métricas do repositório

Stars
 (30.913 estrelas)
Métricas de merge de PR
 (Mesclagem média 24d 7h) (217 fundiu PRs em 30d)

Description

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

Code below reproduces. Found trying write macro requested by @sliptonic to update all CAM Tool shape files, where error occurred with both "v-bit" and "thread-mill" shapes.

Also possible related is V-bit problem with 3Dsurface

def file_test(name):
	FreeCAD.newDocument(name)
	FreeCAD.ActiveDocument.saveAs("/home/spanner888/Documents/" + name)
	FreeCAD.closeDocument(name)
	
f_names = ["something", "some_thing", "some-thing"]

for f in f_names:
	file_test(f)
	print("finished: ", f)`
21:08:14  finished:  something
21:08:14  finished:  some_thing
21:08:14  pyException: Traceback (most recent call last):
  File "/home/spanner888/.local/share/FreeCAD/CamScripts/minus_in_filename.FCMacro", line 10, in <module>
    file_test(f)
  File "/home/spanner888/.local/share/FreeCAD/CamScripts/minus_in_filename.FCMacro", line 5, in file_test
    FreeCAD.closeDocument(name)
<class 'NameError'>: Unknown document 'some-thing'`

Full version info

OS: Debian GNU/Linux 12 (bookworm) (XFCE/xfce)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.38459 (Git)
Build type: Release
Branch: main
Hash: 58729b3ab0060a1525fc45c87beabfd4b3d5e22e
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: English/Australia (en_AU)

Subproject(s) affected?

Core

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Guia do colaborador