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

Create Export functionality #6

Closed
2 tasks done
PhilMFischer opened this issue Aug 7, 2019 · 2 comments
Closed
2 tasks done

Create Export functionality #6

PhilMFischer opened this issue Aug 7, 2019 · 2 comments
Labels
feature New feature or request

Comments

@PhilMFischer
Copy link
Member

PhilMFischer commented Aug 7, 2019

  • Export dialog to select a location for export
  • Functionality to export the current design into the proper json format for virtual satellite
@PhilMFischer PhilMFischer added the feature New feature or request label Aug 7, 2019
ghost pushed a commit that referenced this issue Dec 5, 2019
@ghost
Copy link

ghost commented Dec 5, 2019

For the export functionality I can think of the following approach:

  • first, we have to be able to parse the FreeCAD objects into our classes, so they should implement a read_from_freecad function

  • every class that can be written to FreeCAD (probably except sheets) knows how to be written into json format, so it has a write_to_json function that returns a python dictionary representing the object

  • (at some point we have to differ if a FreeCAD object is a part or a product: this could be done over the source file name, but maybe we should also add the identifiers into the object name)

  • the exporter then would look like this:

    filter active document: only objects that have a sheet
    
    for part_ in active_doc:
      part = AJsonPart().read_from_freecad()
      parts.append(part.write_to_json())
    for assembly_ in active_doc:
      root_product = JsonProductAssembly().read_from_freecad()
      products = root_product.write_to_json()
    

    and in JsonProductAssembly().write_to_json() check for subassemblies and also parse them like above

ghost pushed a commit that referenced this issue Dec 9, 2019
- Add function get_objects_of_active_document
- Add test file test_json_exporter and first test case

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 9, 2019
- Move logic from exporter to the JsonProductAssembly
- Add read_from_freecad empty function in AJsonProduct
- Implement functionality to recursively traverse the tree using
JsonProductAssembly and for each object open the FreeCAD document and
call read_from_freecad

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 9, 2019
In AJsonProduct and ProductAssembly
- Update read_from_freecad
- Add parse_to_json function

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 12, 2019
Now returns a list of the parsed parts, when calling read_from_freecad
on the root assembly.

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 12, 2019
In AJsonPart:
- Add read_from_freecad, parse_to_json and empty _get_freecad_properties
functions
In specific parts:
- overwrite _get_freecad_properties for the shape

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 12, 2019
Add tests for box, cone, cylinder, sphere and geometry.
Also minor fixes.

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 12, 2019
Test reading from FreeCAD object

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 16, 2019
Add _ignore_static function to test_setup to ignore a static key in a
whole JSON object.

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 16, 2019
- Use sheet in json_part and json_product
- Add function in json_spread_sheet to read from the FreeCAD sheet
object, not the active_document
- Add a test case for that function

---
Task #6: Create Export functionality
ghost pushed a commit that referenced this issue Dec 18, 2019
- Fix command_export and close document in the UI after the export
- Resolve TODOs
- Add test case for rotations in test_json_product and test case for
parsing to JSON in test_json_product_assembly
- Add test_get_products_of_active_document and test_read_from_freecad in
test_json_product_assembly
- Replace print with Log statements

---
Task #6: Create Export functionality
@ghost
Copy link

ghost commented Dec 18, 2019

Some shapes couldn't be tested, because they are missing in the importer too
Opened #20 for this issue

@ghost ghost closed this as completed Jan 27, 2020
@ghost ghost added this to the Relese_0.1.0_Beta milestone Feb 5, 2020
@ghost ghost mentioned this issue Apr 1, 2020
This issue was closed.
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

No branches or pull requests

1 participant