SOLVED! Part vanished... or not?

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!
Koemi
Posts: 108
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

SOLVED! Part vanished... or not?

Postby Koemi » Thu Oct 10, 2019 2:13 pm

Working for two years now with FC, but this is new to me. I guess I did 'something', but what?

1. I created a part, based on a scaled jpg file and saved it.
2. Restarted FC (version description below, yes it's older, but it normally works fine).
3. Opened the file, but it seems 'broken'?

Combo view shows Sketches, Pads an Pockets. The file is 243kB, which is big for an 'empty' file...

FCStd1 file could not help me. Tried FC V0.18 : same issue. Tried other files but they seemed fine. Restarted PC and FC, nothing.

It is not the biggest issue, but I would like to have the file 'repaired'. It would also be nice to know what happened with the file?

Anyone who recognises this?

THE SOLUTION
The imported image which I use as a 'carbon paper' to create a 3D part is called: "P&T_MAD_Topper_2D.jpg"

When I try the same with an image called: "PandT_MAD_Topper_2D.jpg" the problem is gone...

And another discovery: if the filename is ok, but somewhere in the path an "&" is present, it also does not function!
For instance: C:\&\file.jpg will NOT work

:idea: Parts can be used with an "&" in the filename, but image (jpg) files are a different story :idea:


OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
.
Attachments
P&T_MAD_Topper_Koppelplaat_origineel_side.FCStd
(243.48 KiB) Downloaded 11 times
Last edited by Koemi on Fri Oct 11, 2019 12:55 pm, edited 3 times in total.
User avatar
Willem
Posts: 1351
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: Part vanished... or not?

Postby Willem » Thu Oct 10, 2019 2:38 pm

I have mo idea what happened, but your sketches are empty and according the dependency graph the pads and pockets have no relations to the sketches, so there is nothing that can be repaired
chrisb
Posts: 25155
Joined: Tue Mar 17, 2015 9:14 am

Re: Part vanished... or not?

Postby chrisb » Thu Oct 10, 2019 5:42 pm

I had a look at the packed contents of the FreeCAD file (unzipped and opened Document.xml). The sketches seem still to be there. I cannot get them back, a guru may be required, but there is still hope.
chrisb
Posts: 25155
Joined: Tue Mar 17, 2015 9:14 am

Re: Part vanished... or not?

Postby chrisb » Thu Oct 10, 2019 5:59 pm

I created a new Document and created an empty sketch from Sketcher workbench (not PartDesign!). Saved it and opened the Document.xml from the zip file. Then I replaced the "<properties>" of the new sketch with those found from the first sketch in your corrupted file. This is the result:
Attachments
recover.FCStd
(5.13 KiB) Downloaded 9 times
Snip macro screenshot-6adc08.png
Snip macro screenshot-6adc08.png (39.59 KiB) Viewed 276 times
Koemi
Posts: 108
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Part vanished... or not?

Postby Koemi » Fri Oct 11, 2019 7:15 am

chrisb is a guru, so it seems :geek:

Unfortunately I failed trying to reproduce your workaround, using winRAR. Still, I am curious how you managed this?

I opened both Document.xml files, but then? The original contains quite a lot of "<properties>". Which one to choose? Just overwriting Document.xml files doesn't work, obviously...

Lucky me you attached the 'recover'-file (which looks quite familiar), great!
Koemi
Posts: 108
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Part vanished... or not?

Postby Koemi » Fri Oct 11, 2019 7:31 am

Tried to proceed with the 'recover'-file.

- Placed the image back again, scaled and repositioned;
- Created a pad of the sketch;
- Saved and closed the file;
- Reopened the file again, but it seems it is still corupted: I get the same results as before.

I will make a fresh startfrom scratch and see what happens
chrisb
Posts: 25155
Joined: Tue Mar 17, 2015 9:14 am

Re: Part vanished... or not?

Postby chrisb » Fri Oct 11, 2019 8:16 am

I would recommend to recover only the sketches, pads and pockets may be easy to rebuild. Note: I did not repair the old file, I created a new one, which contains the relevant data.

This is what can be done:
  • Unzip the old file and open Document.xml
  • Search for "Sketch". This is the first match:

    Code: Select all

        <Objects Count="7">
            <Object type="Image::ImagePlane" name="ImagePlane" />
            <Object type="Sketcher::SketchObject" name="Sketch" />
            <Object type="PartDesign::Pad" name="Pad" />
            <Object type="Sketcher::SketchObject" name="Sketch001" />
            <Object type="PartDesign::Pad" name="Pad001" />
            <Object type="Sketcher::SketchObject" name="Sketch002" />
            <Object type="PartDesign::Pocket" name="Pocket" />
        </Objects>
    
    You can see that it contains three sketches. So I recommend to
  • Create a new document and create in Sketcher three new sketches. Save the document.
  • Searching further for "Sketch" in the old document you find this:

    Code: Select all

            <Object name="Sketch">
                <Properties Count="8">
                    <Property name="Constraints" type="Sketcher::PropertyConstraintList">
                        <ConstraintList count="115">
                            <Constrain Name="" Type="13" Value="0.000000000000" First="0" FirstPos="1" Second="-2" SecondPos="0" ...
                            <Constrain Name="" Type="1" Value="0.000000000000" First="0" FirstPos="2" Second="-1" SecondPos="1" ...
                            <Constrain Name="" Type="1" Value="0.000000000000" First="0" FirstPos="2" Second="1" SecondPos="1" ...
    
    The indentation indicates the block which belongs to "Sketch", i.e. the end of the Sketch is

    Code: Select all

                </Properties>
            </Object>
    
  • In the new file you find

    Code: Select all

            <Object name="Sketch" Extensions="True">
                <Extensions Count="1">
                    <Extension type="Part::AttachExtension" name="AttachExtension">
                    </Extension>
                </Extensions>
                <Properties Count="15" TransientCount="0">
                    <Property name="AttacherType" type="App::PropertyString" status="8">
                        <String value="Attacher::AttachEnginePlane"/>
                    </Property>
    
  • I did this in a current 0.19 version, where the object doesn't start with <Properties>, but with an <Extensions> section. That's the reason why I transferred only the properties. But you can very well try to copy the whole object. That means:

    Copy everything between

    Code: Select all

            <Object name="Sketch">
                  ...
                  ...
            </Object>
    
    and replace the corresponding section in the new file.
  • if this doesn't work copy the next <Properties> level below <object> and replace the corresponding section in the new file.
Koemi
Posts: 108
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Part vanished... or not?

Postby Koemi » Fri Oct 11, 2019 9:00 am

Thanks chrisb. Crystal clear :D
Koemi
Posts: 108
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Part vanished... or not?

Postby Koemi » Fri Oct 11, 2019 9:01 am

I think I have found the source of the vanishing parts.

The imported image which I use as a 'carbon paper' to create a 3D part is called: "P&T_MAD_Topper_2D.jpg"

When I try the same with an image called: "PandT_MAD_Topper_2D.jpg" the problem is gone...

:idea: Parts can be used with an "&" in the filename, but image (jpg) files are a different story :idea:
chrisb
Posts: 25155
Joined: Tue Mar 17, 2015 9:14 am

Re: Part vanished... or not?

Postby chrisb » Fri Oct 11, 2019 10:06 am

Good find! I had already renamed the file (because I need fancy characters in filenames as urgent as pimples in the face) and I had removed the whole image, but this did not show the sketches again.
With your find I will give it another try.