-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write FCStd node should create a FreeCAD file. #4432
Comments
https://wiki.freecadweb.org/FreeCAD_API https://github.com/nortikin/sverchok/blob/master/nodes/exchange/FCStd_write.py |
I see the
|
i propose we add a button to the FCStd_write node, which lets you
yay/nay ? |
Hmm...I thought what happened when I tried the node was I could indeed select a path and filename (note: it by default offered .blend as the extension not .FCStd). |
yeah OK. that makes a lot more sense. FilePath node allows you to type an arbitrary filename into the FileName text box, and it will pass the |
perhaps something like this try:
from os.path import exists
Fname = bpy.path.display_name_from_filepath(fc_file)
if not exists(fc_file):
doc = F.newDocument(Fname)
doc.FileName = fc_file
doc.recompute()
doc.save()
F.open(fc_file)
except Exception as err:
info(f'FCStd open error, {err}')
return
F.setActiveDocument(Fname)
fc_root = F.getDocument(Fname) |
This seems good. I don't know if there is a way to do it. When I click on the socket and it creates a File path node, it would be nice if it defaulted to .FCStd rather than .blend. But, the code you show would at least help to prevent and accidental overwrite. |
yeah, it may be possible to coerce the instance of the FileOpen dialogue to do that. |
@macdroid53 i can make a branch for you and you can tell me if you like how that works.
|
Sure, I can have a look. |
yeah, that'll work.. or you could even just replace the |
Which branch? |
sorry. just added : #4437 |
it is untested as I can not get freecad currently |
but for now i only implemented the feature that tells the FCStd_write node to create the FCStd file on-the-fly if it doesn't exist. |
CC |
Note that If you need a defautl value, usually what many exporters do is take the path of the current blend file, strip the .blend extension and replace it with .FCStd... |
implemented. seems to work, thanks @yorikvanhavre ! |
Nice! What's the next task? |
a solution will need to be found for forcing the FilePath node to look specifically for certain kinds of files, and automatically suffix |
but that's an issue with FilePath node, rather than FreeCAD =) |
Apropos #4446 |
Expected:
When Write FCStd node is executed creates file with specified name.
Actual:
When node is executed no file is created. If an empty FCStd file by the specified name exists, the data is written.
The text was updated successfully, but these errors were encountered: