Save option fcstd files without the Brep representation

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
GlouGlou
Posts: 3212
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Save option fcstd files without the Brep representation

Postby GlouGlou » Mon May 24, 2021 2:21 pm

Saving without any representation, I know could be an heavy duty for re computation, but small files could be saved in a tiny space (as the forum).
Any thoughts?
Attachments
Capture.JPG
Capture.JPG (130 KiB) Viewed 929 times
User avatar
onekk
Posts: 1019
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Save option fcstd files without the Brep representation

Postby onekk » Mon May 24, 2021 4:15 pm

No you are speaking of eliminate the base foundation of FreeCAD.

Brep representations are stored as they are the "foundation data" to create objects.


if you see how the document is created, (and if you have this screenshoot you have expanded the fcstd file).

try to see Document.XML file and you will se that the solids are defined in the brp files, names and properties are saved in the document.xml, but no data about "solid creation" are stored in the file.

I have tried to explain what I've found in:

https://forum.freecadweb.org/viewtopic. ... 84#p505984



Regards

Carlo D.
Il mio Blog: https://onekk-maker.blogspot.com/

Introduzione a FreeCAD in Italiano: https://github.com/onekk/freecad-doc
mario52
Posts: 3560
Joined: Wed May 16, 2012 2:13 pm

Re: Save option fcstd files without the Brep representation

Postby mario52 » Mon May 24, 2021 5:50 pm

Hi

for split (et reconstruire) the FCStd file use Menu > Outils > Utilitaire de projet

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
GlouGlou
Posts: 3212
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Save option fcstd files without the Brep representation

Postby GlouGlou » Mon May 24, 2021 9:05 pm

mario52 wrote: Mon May 24, 2021 5:50 pm Hi

for split (et reconstruire) the FCStd file use Menu > Outils > Utilitaire de projet

mario
Can make working. Its easier to use 7zip. :roll:
GeneFC
Posts: 2310
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Save option fcstd files without the Brep representation

Postby GeneFC » Mon May 24, 2021 11:16 pm

onekk wrote: Mon May 24, 2021 4:15 pm No you are speaking of eliminate the base foundation of FreeCAD.

Brep representations are stored as they are the "foundation data" to create objects.
Actually the Brep files can be removed, and they will be recreated when the file is reopened. This was discussed in some detail on the forum a few months ago.

I just tried removing the Brep files from one of my projects, and it seemed to work fine.

HOWEVER, there may be problems in some cases, so I do not recommend this without further information and/or study.

Gene
User avatar
onekk
Posts: 1019
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Save option fcstd files without the Brep representation

Postby onekk » Tue May 25, 2021 3:23 pm

I suspect that the affirmation that a brp file could be deleted from the FCStd file, is wrong.

Or better, it depends on which method is used to create the object.

A quick search seems to confirm what GeneFC is saying, but a better look of some file shown in discussion that talk about on deleting such file, show that the objects are created using Sketcher or Draft.

In other word, this object are not shapes, and shapes could be regenerated using the information contained in Document.XML as .brp files are the result of an internal calculations.

It seems that using Part or better creating objects using scripting, in Document.xml there is no trace of such informations as there is only references to .brp files.

Code: Select all

    <Objects Count="2" Dependencies="1">
        <ObjectDeps Name="line" Count="0"/>
        <ObjectDeps Name="circle" Count="0"/>
        <Object type="Part::Feature" name="line" id="3588" />
        <Object type="Part::Feature" name="circle" id="3589" />
    </Objects>
This is the stanza defining the Objects in the TreeView, as simple to have two objects, created with this code:

Code: Select all

import FreeCAD
from FreeCAD import Rotation, Vector

p1 = Vector(5,10,0)
p2 = Vector(10,10,0)

line = Part.LineSegment(p1,p2)

circle = Part.makeCircle(10)

Part.show(line.toShape(), "line")
Part.show(circle,"circle")

Code: Select all

    <ObjectData Count="2">
        <Object name="line">
            <Properties Count="6" TransientCount="0">
                <Property name="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="line"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </Property>
                <Property name="Placement" type="App::PropertyPlacement" status="8388608">
                    <PropertyPlacement Px="0.0000000000000000" Py="0.0000000000000000" Pz="0.0000000000000000" Q0="0.0000000000000000" Q1="0.0000000000000000" Q2="0.0000000000000000" Q3="1.0000000000000000" A="0.0000000000000000" Ox="0.0000000000000000" Oy="0.0000000000000000" Oz="1.0000000000000000"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape.brp"/>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="648">
                    <Bool value="true"/>
                </Property>
            </Properties>
        </Object>
        <Object name="circle">
            <Properties Count="6" TransientCount="0">
                <Property name="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="circle"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </Property>
                <Property name="Placement" type="App::PropertyPlacement" status="8388608">
                    <PropertyPlacement Px="0.0000000000000000" Py="0.0000000000000000" Pz="0.0000000000000000" Q0="0.0000000000000000" Q1="0.0000000000000000" Q2="0.0000000000000000" Q3="1.0000000000000000" A="0.0000000000000000" Ox="0.0000000000000000" Oy="0.0000000000000000" Oz="1.0000000000000000"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape1.brp"/>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="648">
                    <Bool value="true"/>
                </Property>
            </Properties>
        </Object>
    </ObjectData>
Analyzing the code above there is no indication from where the two object are deriving, so no single measure to be able to recostruct them without the data in .brp files.

Creating a file with Draft, a similar file containing a line and a circle, this Object for the line is created:

Code: Select all

        <Object name="Line" Extensions="True">
            <Extensions Count="1">
                <Extension type="Part::AttachExtension" name="AttachExtension">
                </Extension>
            </Extensions>
            <Properties Count="25" TransientCount="0">
                <Property name="Area" type="App::PropertyArea" group="Draft" doc="The area of this object" attr="0" ro="0" hide="0" status="2097152">
                    <Float value="0.0000000000000000"/>
                </Property>
                <Property name="AttacherType" type="App::PropertyString" status="8">
                    <String value="Attacher::AttachEnginePlane"/>
                </Property>
                <Property name="AttachmentOffset" type="App::PropertyPlacement" status="8">
                    <PropertyPlacement Px="0.0000000000000000" Py="0.0000000000000000" Pz="0.0000000000000000" Q0="0.0000000000000000" Q1="0.0000000000000000" Q2="0.0000000000000000" Q3="1.0000000000000000" A="0.0000000000000000" Ox="0.0000000000000000" Oy="0.0000000000000000" Oz="1.0000000000000000"/>
                </Property>
                <Property name="Base" type="App::PropertyLink" group="Draft" doc="The base object is the wire, it&apos;s formed from 2 objects" attr="0" ro="0" hide="0" status="2097152">
                    <Link value=""/>
                </Property>
                <Property name="ChamferSize" type="App::PropertyLength" group="Draft" doc="Size of the chamfer to give to the corners" attr="0" ro="0" hide="0" status="2097152">
                    <Float value="0.0000000000000000"/>
                </Property>
                <Property name="Closed" type="App::PropertyBool" group="Draft" doc="If the wire is closed or not" attr="0" ro="0" hide="0" status="2097152">
                    <Bool value="false"/>
                </Property>
                <Property name="End" type="App::PropertyVectorDistance" group="Draft" doc="The end point of this line" attr="0" ro="0" hide="0" status="2097152">
                    <PropertyVector valueX="56.0000000000000000" valueY="6.0000000000000000" valueZ="0.0000000000000000"/>
                </Property>
                <Property name="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="FilletRadius" type="App::PropertyLength" group="Draft" doc="Radius to use to fillet the corners" attr="0" ro="0" hide="0" status="2097152">
                    <Float value="0.0000000000000000"/>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="Line"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </Property>
                <Property name="Length" type="App::PropertyLength" group="Draft" doc="The length of this line" attr="0" ro="0" hide="0" status="2097152">
                    <Float value="121.4948558581802587"/>
                </Property>
                <Property name="MakeFace" type="App::PropertyBool" group="Draft" doc="Create a face if this object is closed" attr="0" ro="0" hide="0" status="2097152">
                    <Bool value="false"/>
                </Property>
                <Property name="MapMode" type="App::PropertyEnumeration">
                    <Integer value="0"/>
                </Property>
                <Property name="MapPathParameter" type="App::PropertyFloat" status="8">
                    <Float value="0.0000000000000000"/>
                </Property>
                <Property name="MapReversed" type="App::PropertyBool" status="8">
                    <Bool value="false"/>
                </Property>
                <Property name="Placement" type="App::PropertyPlacement" status="8388608">
                    <PropertyPlacement Px="-64.0000000000000000" Py="24.9999999999999964" Pz="0.0000000000000000" Q0="0.0000000000000000" Q1="0.0000000000000000" Q2="0.0000000000000000" Q3="1.0000000000000000" A="0.0000000000000000" Ox="0.0000000000000000" Oy="0.0000000000000000" Oz="1.0000000000000000"/>
                </Property>
                <Property name="Points" type="App::PropertyVectorList" group="Draft" doc="The vertices of the wire" attr="0" ro="0" hide="0" status="2097152">
                    <VectorList file="Points"/>
                </Property>
                <Property name="Proxy" type="App::PropertyPythonObject">
                    <Python value="IldpcmUi" encoded="yes" module="draftobjects.wire" class="Wire"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape.brp"/>
                </Property>
                <Property name="Start" type="App::PropertyVectorDistance" group="Draft" doc="The start point of this line" attr="0" ro="0" hide="0" status="2097152">
                    <PropertyVector valueX="-64.0000000000000000" valueY="24.9999999999999964" valueZ="0.0000000000000000"/>
                </Property>
                <Property name="Subdivisions" type="App::PropertyInteger" group="Draft" doc="The number of subdivisions of each edge" attr="0" ro="0" hide="0" status="2097152">
                    <Integer value="0"/>
                </Property>
                <Property name="Support" type="App::PropertyLinkSubList">
                    <LinkSubList count="0">
                    </LinkSubList>
                </Property>
                <Property name="Tool" type="App::PropertyLink" group="Draft" doc="The tool object is the wire, it&apos;s formed from 2 objects" attr="0" ro="0" hide="0" status="2097152">
                    <Link value=""/>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="648">
                    <Bool value="true"/>
                </Property>
            </Properties>
        </Object>

Code: Select all

               <Property name="End" type="App::PropertyVectorDistance" group="Draft" doc="The end point of this line" attr="0" ro="0" hide="0" status="2097152">
                    <PropertyVector valueX="56.0000000000000000" valueY="6.0000000000000000" valueZ="0.0000000000000000"/>
                </Property>

and

Code: Select all

                <Property name="Start" type="App::PropertyVectorDistance" group="Draft" doc="The start point of this line" attr="0" ro="0" hide="0" status="2097152">
                    <PropertyVector valueX="-64.0000000000000000" valueY="24.9999999999999964" valueZ="0.0000000000000000"/>
                </Property>
That hold the starting and ending point of the line traced.

I suppose that in this case, deleting the .brp objects, the drawing could be recreated, but in the first case (part created using Part module scripting) I think that is near impossible to recreate things, as no clue of what there is in the .brp files, specifically starting and ending point of the line and at leas, radius and center of the circle are not found in the Document.XML file.

As usual, as in many fields of computer science, the answer is "It depends ...."


Regards

Carlo D.
Il mio Blog: https://onekk-maker.blogspot.com/

Introduzione a FreeCAD in Italiano: https://github.com/onekk/freecad-doc
GeneFC
Posts: 2310
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Save option fcstd files without the Brep representation

Postby GeneFC » Tue May 25, 2021 3:52 pm

onekk wrote: Tue May 25, 2021 3:23 pm As usual, as in many fields of computer science, the answer is "It depends ...."
You used a lot of words to repeat what I said. :lol: :lol: :lol: :lol: :lol:
GeneFC wrote: Mon May 24, 2021 11:16 pm HOWEVER, there may be problems in some cases, so I do not recommend this without further information and/or study.
Gene
User avatar
onekk
Posts: 1019
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Save option fcstd files without the Brep representation

Postby onekk » Tue May 25, 2021 4:00 pm

:D yes I tend to be "verbose".

Not to criticize, but "it depends" what the "correct answer" to most of the "complicated things".

As I'm a "intermediate learner" and not "an expert" i tend to to "argument" my "sayings" as there is some base on which discuss on, so if I'm wrong, maybe a more skilled user or maybe "a developer" or "an expert" will answer me saying where I'm wrong.

Consider my post as "Requests for comments" and not "the Truth".

Thanks for you kindness.

Regards

Carlo D.
Il mio Blog: https://onekk-maker.blogspot.com/

Introduzione a FreeCAD in Italiano: https://github.com/onekk/freecad-doc
User avatar
GlouGlou
Posts: 3212
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Save option fcstd files without the Brep representation

Postby GlouGlou » Tue May 25, 2021 6:10 pm

GeneFC wrote: Mon May 24, 2021 11:16 pm HOWEVER, there may be problems in some cases, so I do not recommend this without further information and/or study.
I'm agree with that. My suggestion is to use this option to send a huge by email or post on this forum. It better to test it before send.
User avatar
onekk
Posts: 1019
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Save option fcstd files without the Brep representation

Postby onekk » Wed May 26, 2021 3:00 pm

I have noted that using the GUI and preserving intermediate components is very consuming in term of space, generally I use scripting also because a script is very concise and coul recreate all the shapes on the fly resulting in a more efficient way to do things.

Creating many "Document Objects" the thingd you see in TreeView will consume a lot of memory and slow things. storing toposhapes are most efficient but this could be done using scripting as a toposhape don't go in the TreeView unless it is explicitly needed creating a "document object".

Code: Select all

Part.show(shape, "description")
the use of Boolean operation or CSG if you want use a more elegant term is more consuming in term of space than using BREP but using BREP with GUI is not do immediate.

Regards

Carlo D.
Il mio Blog: https://onekk-maker.blogspot.com/

Introduzione a FreeCAD in Italiano: https://github.com/onekk/freecad-doc