Impossible to open a project with cyclic dependencies

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
micrenda
Posts: 8
Joined: Sun May 29, 2016 5:51 am

Impossible to open a project with cyclic dependencies

Postby micrenda » Sun May 29, 2016 5:58 am

I managed somehow to save a document with a cyclic dependency. When I try to open it with freecad 0.16 I receive the message in the screenshot below. In this situation it is impossible to access the created document.

Attached you can find the document which is causing this problem. I think FreeCad should open the document and let me to correct the mistake.

Thank you very much and I wish you a very nice day.
Attachments
screenshot.png
screenshot.png (142.98 KiB) Viewed 1344 times
phone_holder.fcstd
(26.5 KiB) Downloaded 20 times
User avatar
DeepSOIC
Posts: 7015
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Impossible to open a project with cyclic dependencies

Postby DeepSOIC » Sun May 29, 2016 9:43 am

True. It opens and immediately closes.
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7668 (Git)
Build type: Release
Branch: BodyBase3
Hash: ef872d37a8a365aeb04567d80616b28a826ed41c
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17


however, I can open the document with:
OS: Windows 8
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6219 (Git)
Build type: Release
Branch: FreeCAD-DeepSOIC6
Hash: 1aff8d612e303501d401891e75aae8680b8c130f
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1

Even though it opened, it fails to force-recompute. It also fails to show me dependency graph ("Gui::Command::activated(0): Unknown C++ exception thrown"), so I can't even find a circular dependency to break the loop. So, it looks like you have to edit your project in text editor if you want to recover it (hint: FCStd file is actually just a zip file)

PS. it'd be great if you find a reproducible way to make such a circular dependency, since expressions should not allow it to happen.
ulrich1a
Posts: 1875
Joined: Sun Jul 07, 2013 12:08 pm

Re: Impossible to open a project with cyclic dependencies

Postby ulrich1a » Sun May 29, 2016 11:17 am

DeepSOIC wrote:So, it looks like you have to edit your project in text editor if you want to recover it (hint: FCStd file is actually just a zip file)
I thought, I could just unzip the document and edit it, but it was not that easy. You need to use a FreeCAD tool in order to do this:
http://www.freecadweb.org/wiki/index.ph ... ile_.FCStd

At trying to do this by editing the Document.xml, I got the cyclic references also with sep.Height and sep.Placement.Base.x.

At this point I gave up. The creator may have an idea how to fix this.

PS: FreeCAD creates backup documents. Opening one of these may also solve the issue in this case.

Ulrich
User avatar
quick61
Posts: 3793
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Impossible to open a project with cyclic dependencies

Postby quick61 » Sun May 29, 2016 1:58 pm

OK, I cracked open the old 0.15.4671 Release, and after dumping all the expressions, the model opened and gave me a DAG dependency graph, so no help identifying where the cyclic dependency was. Though I am suspecting, by way of a SWAG, that the problem lies somewhere with -rnd_cut1/sup_ext

I must say though, I can think of several simpler ways to of creating the parts your using. In the end, the extra steps you're taking to create these parts may very well of led to the creation of the cyclic dependency.

May I ask why you are using Draft and Part instead of Sketcher/Part Design? Nothing wrong with doing things that way, just curious is all.

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
micrenda
Posts: 8
Joined: Sun May 29, 2016 5:51 am

Re: Impossible to open a project with cyclic dependencies

Postby micrenda » Mon May 30, 2016 6:53 am

Hello everybody.
First of all thank you for all your answers!
I don't know how to recreate such file. It was created with the current official 0.16 release:
https://github.com/FreeCAD/FreeCAD/releases

In my case I will resolve it unzipping the archive and manual editing the faulty dependency. I reported here just to let the developer know about this issue (I think it can be resolved with a proper try catch section).

Best regards

PS. I forgot to report which version is showing the issue (but also the last version from git has the same problem)

OS: Debian GNU/Linux 8.4 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6703 (Git)
Build type: Unknown
Branch: releases/FreeCAD-0-16
Hash: 2ce5c8d2e3020d05005ed71f710e09e9aa561f40
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
eivindkvedalen
Posts: 598
Joined: Tue Jan 29, 2013 10:35 pm

Re: Impossible to open a project with cyclic dependencies

Postby eivindkvedalen » Mon May 30, 2016 7:51 am

micrenda wrote:Hello everybody.
First of all thank you for all your answers!
I don't know how to recreate such file. It was created with the current official 0.16 release:
https://github.com/FreeCAD/FreeCAD/releases

In my case I will resolve it unzipping the archive and manual editing the faulty dependency. I reported here just to let the developer know about this issue (I think it can be resolved with a proper try catch section).
Could you please open a Mantis ticket for this one? Do you remember how you managed to create this dependency? There is no try/catch statement in the code, because you are not supposed to be able to create such dependencies in the first place, so the root cause must be somewhere else.

Eivind
micrenda
Posts: 8
Joined: Sun May 29, 2016 5:51 am

Re: Impossible to open a project with cyclic dependencies

Postby micrenda » Mon May 30, 2016 11:15 am

Hello,

I managed to produce a reproducible case. Just follow these instructions:

1) Open the attached FreeCAD project (it is a very simple project with 3 shapes)
2) Rename "c2" to "c3"
3) Rename "c1" to "c2"
4) Rename "c3" to "c1"

Save the document and try to open it.
I will create a Mantis ticket.

I would like to take the occasion to thanks all the developer that made FreeCad a so good and nice program and because they implemented the "calculated properties", a functionality I really like a lot.

Regards
Michele Renda
Attachments
test_case.fcstd
(4.53 KiB) Downloaded 19 times
micrenda
Posts: 8
Joined: Sun May 29, 2016 5:51 am

Re: Impossible to open a project with cyclic dependencies

Postby micrenda » Mon May 30, 2016 11:23 am

This is the mantis ticket:
http://www.freecadweb.org/tracker/view.php?id=2569

Thank you
wmayer
Site Admin
Posts: 14869
Joined: Thu Feb 19, 2009 10:32 am

Re: Impossible to open a project with cyclic dependencies

Postby wmayer » Mon May 30, 2016 4:28 pm

git commit 007a00b causes the closure of the document. So, one has to distinguish between different exception types to leave it open for certain types.

Edit:
This fixes one part of the problem:
git commit 76548e9
wmayer
Site Admin
Posts: 14869
Joined: Thu Feb 19, 2009 10:32 am

Re: Impossible to open a project with cyclic dependencies

Postby wmayer » Mon May 30, 2016 5:22 pm

In the attached project there is no object "c3". But it suffices to
1) Rename "c2" to "c3"
2) Rename "c1" to "c2"
Save the document and try to open it.

With the original file there are these dependencies:
1) r1.Height depends on c2.Radius (Circle001)
2) c1.Radius (Circle) depends on r1.Height

After the renaming and save&restore r1.Height doesn't depend on c3.Radius any more.