Skip to content
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

QoL Improvement: Make CfdAnalysis' "Output Directory" dynamic based on the Project Name, instead of "/tmp/case" as default #148

Open
eduncan911 opened this issue Sep 7, 2023 · 12 comments

Comments

@eduncan911
Copy link

eduncan911 commented Sep 7, 2023

CfdOF WB v1.24.4
FreeCAD 0.21.1 (and LinkStage Tip, which is 0.21)

Problem:
The current function of the Properties for CfdOF allows you to manually specify a folder for writing meshes. However, if you are analyzing several different projects, this becomes a problem with data being constantly overwritten.

Suggested Resolution
This request is to allow project variables to be used here instead. Such as the Project Label (name). For example:

  • Project is named "cfd.example"
  • CfdOF WB Settings could have "/tmp" like it does now.
  • Default would be the open root tree's "Label", aka Project Name.

image

Work Around
Currently, this can be set manually from with each project's CfdAnalysis's Property window on a per project basis. And that works. However, most user's workflows in FreeCAD doesn't include, "New project, go edit Property Settings before starting." However, you still have drop to shell to create the freakin' directory.

So this is kind out of the normal workflow for end-users.

image

@oliveroxtoby
Copy link
Collaborator

This is a good idea. I'll try to put it in soon, or you're welcome to submit a pull request.

@eduncan911
Copy link
Author

eduncan911 commented Sep 15, 2023

@oliveroxtoby nice! as a follow-up, I dove deep into FEM recently. And, it has everything I mentioned above as well as "smarter than me" logic with even more options.

Maybe follow this Workbench?

image

The "Custom directory" option being the same as CfdOF's Properties View current option.

But note the other two dynamic ones. I especially like the "beside FCStd file" option.

@eduncan911
Copy link
Author

eduncan911 commented Sep 15, 2023

There's also something else... the FEM workbench also defaults to "search in known binary directories" for all the dependencies, instead of requiring their location.

This makes the FEM workbench work out of the box with CAE Linux - since everything is installed. For CfdOF, I have to go find each binary and specify them.

Just some suggestions to improve the the user's experience. :)

image

@icojb25
Copy link
Contributor

icojb25 commented Mar 15, 2024

hi @oliveroxtoby any idea what the call is to get the project base label is? Is this accessible via the obj passed to the CfdAnalysis.py class?

def makeCfdAnalysis(name):
""" Create a Cfd Analysis group object """
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython", name)
CfdAnalysis(obj)

@oliveroxtoby
Copy link
Collaborator

hi @oliveroxtoby any idea what the call is to get the project base label is? Is this accessible via the obj passed to the CfdAnalysis.py class?

FreeCAD.ActiveDocument.Label ?

@oliveroxtoby
Copy link
Collaborator

oliveroxtoby commented Mar 17, 2024

But note the other two dynamic ones. I especially like the "beside FCStd file" option.

@icojb25 just a note in case you end up implementing this aspect of it. CfdOF does currently store files in this location if the user enters a relative path in the analysis object properties - see CfdTools.getOutputPath(). So probably this code can be reused.

@oliveroxtoby
Copy link
Collaborator

oliveroxtoby commented Mar 17, 2024

There's also something else... the FEM workbench also defaults to "search in known binary directories" for all the dependencies, instead of requiring their location.

This makes the FEM workbench work out of the box with CAE Linux - since everything is installed. For CfdOF, I have to go find each binary and specify them.

@eduncan911 CfdOF does actually have default locations for the dependencies, which are searched if no location is given on the Preferences page. However I don't know what these are for CAE Linux, so if you could supply these we can simply add them to the defaults.

@icojb25
Copy link
Contributor

icojb25 commented Mar 17, 2024

But note the other two dynamic ones. I especially like the "beside FCStd file" option.

@icojb25 just a note in case you end up implementing this aspect of it. CfdOF does currently store files in this location if the user enters a relative path in the analysis object properties - see CfdTools.getOutputPath(). So probably this code can be reused.

Hi @oliveroxtoby i can chip away at it over the week. Do we want to add these options in the Preferences panel?

@oliveroxtoby
Copy link
Collaborator

Hi @oliveroxtoby i can chip away at it over the week. Do we want to add these options in the Preferences panel?

Thank you, that would be great.I don't think we need to have the distinction between custom directory and tmp directories (I think we can just have the custom directory defaulting to tmp directory as we do now), but adding an option in preferences like the 'Beside .FCStd file' one would be nice. And then also saving in a subdirectory with the name of the document label, as the first post alludes to.

@icojb25
Copy link
Contributor

icojb25 commented Mar 23, 2024

hi @oliveroxtoby
I am nearly finished this implementation, however notice that in CfdPreferences.py, the function loadSettings() is actually never called, which is kind of weird. One would assume this is used to persist the changes (not working for this Feature Request yet, assume because of this).

Can you confirm? I dont see this method called anywhere in the code ... yet it seems to be the persistence method that should be used.

@oliveroxtoby
Copy link
Collaborator

hi @oliveroxtoby I am nearly finished this implementation, however notice that in CfdPreferences.py, the function loadSettings() is actually never called, which is kind of weird. One would assume this is used to persist the changes (not working for this Feature Request yet, assume because of this).

It's not called by CfdOF but it is called by FreeCAD when the preferences page is loaded.

@icojb25
Copy link
Contributor

icojb25 commented Mar 29, 2024

@eduncan911 @oliveroxtoby Take a look at this and see if it works as intended. Enjoy the long weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants