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

Feature/task 5 implement import functi #17

Merged
merged 21 commits into from
Dec 4, 2019

Conversation

ghost
Copy link

@ghost ghost commented Nov 27, 2019

Add import functionality:

  • Add JSON file selection and full importing that file to the import command
  • Add full import functionality
  • Add inheritance
  • Add testcases for full import

CRUD will be tested later in #18

Closes #5

JAmmermann-DLR added 10 commits November 14, 2019 10:24
- Fixed naming in the dialogs
- Switched command positions in InitGui
- Added file open dialog with JSON filter to import command

---
Task #5: Implement Import Functionality
Use the JsonImporter in the CommandImport

---
Task #5: Implement Import Functionality
- Add full import function in JsonImporter
- Use that function in CommandImport
- Add test function for full import
- Add test fixture json file

---
Task #5: Implement Import Functionality
- Add JsonProductAssembly call
- Add json product tests

---
Task #5: Implement Import Functionality
Also:
- Add test data in test_json_data
- Add test case with that data in test_json_product_assembly
- Update test_full_import

---
Task #5: Implement Import Functionality
Importing twice should result in the same output as importing once.
json_importer: Create FreeCAD filename from JSON filename
test_json_importer: Add testcase for importing twice
json_product:
- Add function to compare AJsonProducts
- Only create a part if it doesn't exist already
- Clear the placement when reimporting

---
Task #5: Implement Import Functionality
Add a simple solution in json_product_child to propagate values from
parent to children and also test this behavior.

The current method results in children only having an absolute position
(and rotation) instead of a relative one to their parent. This should be
reconsidered with usability and the export functionality in mind.

---
Task #5: Implement Import Functionality
Because of CRUD assume that a change from Virtual Satellite side has
always newer information, so we can simply clear the first imported file
and use the newer file. For that:

- Add a function to clear a file in active_document
- Call that function in full_import
- Get FreeCAD document from ProductRoot instead of filename (so
different versions can easily be saved in different files)
- Add new test fixture

---
Task #5: Implement Import Functionality
- Add a module directory in FreeCAD Appdata:
	- Create directory in Init
	- Provide it with Environment
	- Use it in CommandImport
- Update documentation and Log Messages
- Update part update in json_product: Now deletes and recreates existing
parts

---
Task #5: Implement Import Functionality
Also add the Mod directory

---
Task #5: Implement Import Functionality
@ghost ghost added the feature New feature or request label Nov 27, 2019
@ghost ghost requested a review from PhilMFischer November 27, 2019 11:18
@ghost ghost self-assigned this Nov 27, 2019
Copy link
Member

@PhilMFischer PhilMFischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks in general quite fine to me. I think we should sit down together to have a look into some details before merging into development.

if filename != '':
FreeCAD.Console.PrintMessage(f"Selected file '{filename}'\n")

json_importer = JsonImporter(Environment.get_appdata_module_path() + os.sep)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to hand over this appdata_module_path?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created an issue for this: #19

@ghost ghost changed the title Feature/task 5 implement import functi WIP: Feature/task 5 implement import functi Nov 28, 2019
JAmmermann-DLR and others added 11 commits November 28, 2019 16:10
---
Task #5: Implement Import Functionality
Add:
- test_create_part_product_subassembly_with_root_part
- test_create_part_product_assembly_and_subassembly_with_root_part
- test_create_part_product_assembly_with_root_part_with_traverser (empty
test)

---
Task #5: Implement Import Functionality
---
Task #5: Implement Import Functionality
- Add first test cases
- Add the test class to TestVirtualSatelliteApp
- Update traverser
- Update product assembly test
---
Task #5: Implement Import Functionality
---
Task #5: Implement Import Functionality
Try to use the traverser in the importer and reactivating the
full_import test case showed problems with assemblies having the same
name and uuid as their part.
To further investigate that, test cases were added in the traverser.

---
Task #5: Implement Import Functionality
These solve the problem of having a part and an assembly with the same
name and uuid.

- Add the identifiers to json_definitions
- Update the names in part and product files and corresponding test
files

---
Task #5: Implement Import Functionality
---
Task #5: Implement Import Functionality
---
Task #5: Implement Import Functionality
---
Task #5: Implement Import Functionality
@ghost ghost changed the title WIP: Feature/task 5 implement import functi Feature/task 5 implement import functi Dec 3, 2019
@ghost ghost requested a review from PhilMFischer December 3, 2019 15:48
@PhilMFischer PhilMFischer merged commit 50087a9 into development Dec 4, 2019
@PhilMFischer PhilMFischer deleted the feature/task_5-Implement_Import_Functi branch December 4, 2019 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Import Functionality
1 participant