FCTeleport - project porting utility (being born)

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

FCTeleport - project porting utility (being born)

Post by DeepSOIC »

It happens occasionally, that a breaking change is introduced into FreeCAD, that breaks older project. Such a thing happened to v0.17, and all Body objects became broken.

I have a few projects remaining that are broken, and at least one of them I want repaired. Of course I could repair it manually... but, I decided to give a start to FCTeleport, a python module aimed at repairing such broken projects

https://github.com/DeepSOIC/FCTeleport

The goals:
* function to convert a project given two revision numbers (one comes from project itself, the other can come from FreeCAD.Version)
* Basic functionality should be stand-alone. That is, this module may be used without FreeCAD at all.
* when mature, it can be merged into FreeCAD, and integrated into its UI.
* when merged, get rid of burden of maintaining backwards compatibility inside FreeCAD the hard way, and let FreeCAD improve even faster!

So far.
I wrote a simple module that can read FC project and extract some info from it.

Code: Select all

>>> from FCTeleport import FCProject
>>> p = FCProject.FCProject()
>>> p.readFile(r"C:\_vt\dev\3DPrint\87 - grinder\grinder v02.FCStd")
>>> p.findObjectsOfType("Sketcher::SketchObject")
['Sketch', 'Sketch001', 'Sketch002', 'Sketch003', 'Sketch006', 'Sketch008', 'Sketch009', 'Sketch010', 'Sketch011', 'Sketch013', 'Sketch014', 'Sketch015']
>>> 
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FCTeleport - project porting utility (being born)

Post by DeepSOIC »

I have a first successful conversion!! :mrgreen: :ugeek:

I wrote a converter to upgrade projects through commit #9518, which broke all PartDesign Bodies made in versions before 9518.

How to: run this in py console

Code: Select all

import FCTeleport
FCTeleport.Teleport.convertProject(r"C:\path\to\project.FCStd")
This will create a ported file named "C:\path\to\project_ported10665.FCStd". Necessary conversions to apply are automatically determined by comparing version signatures in the file and of FreeCAD. The function also accepts a target version as optional parameter (commit sequential number aka revision), and downgrading projects is possible.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FCTeleport - project porting utility (being born)

Post by DeepSOIC »

Just added some Gui! It's simple, annoying and limited, but does do something...
Attachments
FCTeleport-first-gui.png
FCTeleport-first-gui.png (474.95 KiB) Viewed 1635 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: FCTeleport - project porting utility (being born)

Post by Kunda1 »

issue #2507 could be a test candidate?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FCTeleport - project porting utility (being born)

Post by DeepSOIC »

Kunda1 wrote:issue #2507 could be a test candidate?
Well, yes and no. FCTeleport is not aiming at replacing PartDesign migration, although it potentially can.
The primary goal is recover information that will be otherwise lost. Most of the time, due to changed type of property, or a renamed property, or a renamed C++ type, or a C++ type removed altogether. For example, I plan to add backward converter for being able to open 0.17 files in 0.16 yet keeping sketches attached if possible (as of now, sketch attachment is lost completely when doing so).

As of now, there is only one teleporter implemented, that fixes PartDesign Bodies that were broken by commit #9518 (git commit 9a3b952fb9a2d2d98f5bd33db3a9c7975033a4be). You can use file from this post as an example of a broken project.

I will take a look on the case you pointed anyway, maybe there's something interesting there...
Post Reply