FreeCAD internal file format XML use

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Post Reply
User avatar
mmiscool
Posts: 73
Joined: Sun Dec 18, 2016 9:07 pm
Location: Connecticut
Contact:

FreeCAD internal file format XML use

Post by mmiscool »

Hello,

I am currently working on an importer for .fcstd files for the JSketcher project. JSketcher uses OpenCASCADE and I have been able to load the individual brp items from with in the fcstd archive file but am running in to a bit of trouble understanding specifically what brp are relevant.

The example file I am using to do my first testing has 2 objects as result.
importTest.FCStd
(7.87 KiB) Downloaded 4 times
If I look at the XML I don't see a clear way to figure out what specif brp files are the final results vs what are intermediate steps. It appears to me that there are 4 separate brp file present in the example attached.
Screenshot 2022-07-03 6.29.59 PM.png
Screenshot 2022-07-03 6.29.59 PM.png (62.12 KiB) Viewed 272 times
Is there a way for me to extract from the XML what the list of specific final brp files are?

Code: Select all

<?xml version='1.0' encoding='utf-8'?>
<!--
 FreeCAD Document, see https://www.freecadweb.org for more information...
-->
<Document SchemaVersion="4" ProgramVersion="0.19R14555 (Git shallow)" FileVersion="1">
    <Properties Count="15" TransientCount="3">
        <_Property name="FileName" type="App::PropertyString" status="50331649"/>
        <_Property name="Tip" type="App::PropertyLink" status="33554433"/>
        <_Property name="TransientDir" type="App::PropertyString" status="50331649"/>
        <Property name="Comment" type="App::PropertyString">
            <String value=""/>
        </Property>
        <Property name="Company" type="App::PropertyString">
            <String value=""/>
        </Property>
        <Property name="CreatedBy" type="App::PropertyString">
            <String value=""/>
        </Property>
        <Property name="CreationDate" type="App::PropertyString" status="16777217">
            <String value="2022-07-03T22:07:58Z"/>
        </Property>
        <Property name="Id" type="App::PropertyString">
            <String value=""/>
        </Property>
        <Property name="Label" type="App::PropertyString" status="1">
            <String value="importTest"/>
        </Property>
        <Property name="LastModifiedBy" type="App::PropertyString">
            <String value=""/>
        </Property>
        <Property name="LastModifiedDate" type="App::PropertyString" status="16777217">
            <String value="2022-07-03T22:13:09Z"/>
        </Property>
        <Property name="License" type="App::PropertyString" status="1">
            <String value="All rights reserved"/>
        </Property>
        <Property name="LicenseURL" type="App::PropertyString" status="1">
            <String value="http://en.wikipedia.org/wiki/All_rights_reserved"/>
        </Property>
        <Property name="Material" type="App::PropertyMap">
            <Map count="0">
            </Map>
        </Property>
        <Property name="Meta" type="App::PropertyMap">
            <Map count="0">
            </Map>
        </Property>
        <Property name="ShowHidden" type="App::PropertyBool" status="1">
            <Bool value="false"/>
        </Property>
        <Property name="TipName" type="App::PropertyString" status="83886080">
            <String value=""/>
        </Property>
        <Property name="Uid" type="App::PropertyUUID" status="16777217">
            <Uuid value="92e6ae5b-eed3-4bb5-87ec-8b8e65767606"/>
        </Property>
    </Properties>
    <Objects Count="4" Dependencies="1">
        <ObjectDeps Name="Box" Count="0"/>
        <ObjectDeps Name="Cylinder" Count="0"/>
        <ObjectDeps Name="Cut" Count="2">
            <Dep Name="Cylinder"/>
            <Dep Name="Box"/>
        </ObjectDeps>
        <ObjectDeps Name="Cone" Count="0"/>
        <Object type="Part::Box" name="Box" id="263" />
        <Object type="Part::Cylinder" name="Cylinder" id="264" />
        <Object type="Part::Cut" name="Cut" id="265" />
        <Object type="Part::Cone" name="Cone" id="266" />
    </Objects>
    <ObjectData Count="4">
        <Object name="Box" 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::AttachEngine3D"/>
                </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="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Height" type="App::PropertyLength">
                    <Float value="10.0000000000000000"/>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="Cube"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </Property>
                <Property name="Length" type="App::PropertyLength">
                    <Float value="10.0000000000000000"/>
                </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="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="Support" type="App::PropertyLinkSubList">
                    <LinkSubList count="0">
                    </LinkSubList>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="649">
                    <Bool value="false"/>
                </Property>
                <Property name="Width" type="App::PropertyLength">
                    <Float value="10.0000000000000000"/>
                </Property>
            </Properties>
        </Object>
        <Object name="Cylinder" Extensions="True">
            <Extensions Count="1">
                <Extension type="Part::AttachExtension" name="AttachExtension">
                </Extension>
            </Extensions>
            <Properties Count="15" TransientCount="0">
                <Property name="Angle" type="App::PropertyAngle">
                    <Float value="360.0000000000000000"/>
                </Property>
                <Property name="AttacherType" type="App::PropertyString" status="8">
                    <String value="Attacher::AttachEngine3D"/>
                </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="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Height" type="App::PropertyLength">
                    <Float value="10.0000000000000000"/>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="Cylinder"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </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="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="Radius" type="App::PropertyLength">
                    <Float value="2.0000000000000000"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape1.brp"/>
                </Property>
                <Property name="Support" type="App::PropertyLinkSubList">
                    <LinkSubList count="0">
                    </LinkSubList>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="649">
                    <Bool value="false"/>
                </Property>
            </Properties>
        </Object>
        <Object name="Cut">
            <Properties Count="9" TransientCount="1">
                <_Property name="History" type="Part::PropertyShapeHistory" status="234881024"/>
                <Property name="Base" type="App::PropertyLink">
                    <Link value="Cylinder"/>
                </Property>
                <Property name="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="Cut"/>
                </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="Refine" type="App::PropertyBool">
                    <Bool value="false"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape2.brp"/>
                </Property>
                <Property name="Tool" type="App::PropertyLink">
                    <Link value="Box"/>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="648">
                    <Bool value="true"/>
                </Property>
            </Properties>
        </Object>
        <Object name="Cone" Extensions="True">
            <Extensions Count="1">
                <Extension type="Part::AttachExtension" name="AttachExtension">
                </Extension>
            </Extensions>
            <Properties Count="16" TransientCount="0">
                <Property name="Angle" type="App::PropertyAngle">
                    <Float value="360.0000000000000000"/>
                </Property>
                <Property name="AttacherType" type="App::PropertyString" status="8">
                    <String value="Attacher::AttachEngine3D"/>
                </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="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Height" type="App::PropertyLength">
                    <Float value="10.0000000000000000"/>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="Cone"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </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="10.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="Radius1" type="App::PropertyLength">
                    <Float value="2.0000000000000000"/>
                </Property>
                <Property name="Radius2" type="App::PropertyLength">
                    <Float value="4.0000000000000000"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape3.brp"/>
                </Property>
                <Property name="Support" type="App::PropertyLinkSubList">
                    <LinkSubList count="0">
                    </LinkSubList>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="648">
                    <Bool value="true"/>
                </Property>
            </Properties>
        </Object>
    </ObjectData>
</Document>
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
vm4dim
Posts: 83
Joined: Tue Nov 23, 2021 1:05 am

Re: FreeCAD internal file format XML use

Post by vm4dim »

Cut & Cone:
Visibility = true

Box/Cube & Cylinder:
Visibility = false
User avatar
mmiscool
Posts: 73
Joined: Sun Dec 18, 2016 9:07 pm
Location: Connecticut
Contact:

Re: FreeCAD internal file format XML use

Post by mmiscool »

Thanks @vm4dim for the help understanding the XML data.

I was able to get it working.
My main project is https://autodrop3d.com
Effort on https://github.com/mmiscool/FC-Docker FreeCAD for cloud with browser based access has been discontinued in favor of focused development on https://github.com/xibyte/jsketcher
Post Reply