carlopav wrote: ↑Sat May 16, 2020 9:24 pm
onekk wrote: ↑Sat May 16, 2020 12:28 pm
1) using the same approach of the BRP files, and sotre the 2D drawing and maybe annotations data in external files.
Let me try to understand better what you envision (I'm not a developer and I never studied programming, so sorry but i need some basic explanations). I repeat it to check if I got it:
- FCStd format is an archive that can store multiple files as a compressed format;
Yes it si an archive, a normal zip file, but someone, maybe realthunder as told me that is not very manageable as it is treated like a CVS file, (a sort of Github container), but is is easily inspected, it suffice that you copy a FCstd file and modify the extension in zip and deompress.
this a partial directory structure of a FCstd file decompressed, I have retained only some files to inspect them.
- fcstd_file.png (25.28 KiB) Viewed 1892 times
carlopav wrote: ↑Sat May 16, 2020 9:24 pm
- The document itself is an xml like file, that represent sequentially each object;
Yes it the Document.xml file
Code: Select all
<?xml version='1.0' encoding='utf-8'?>
<!--
FreeCAD Document, see http://www.freecadweb.org for more information...
-->
<Document SchemaVersion="4" ProgramVersion="0.16R6703 (Git)" FileVersion="1">
and with a structure like:
Code: Select all
<Objects Count="117">
<Object type="Part::Compound" name="Compound" />
<Object type="Sketcher::SketchObject" name="Sketch001" />
<Object type="PartDesign::Pad" name="Pad001" />
<Object type="Sketcher::SketchObject" name="Sketch002" />
<Object type="PartDesign::Pad" name="Pad002" />
<Object type="Sketcher::SketchObject" name="Sketch003" />
or
Code: Select all
<ObjectData Count="117">
<Object name="Compound">
<Properties Count="5">
<Property name="ExpressionEngine" type="App::PropertyExpressionEngine">
<ExpressionEngine count="0">
</ExpressionEngine>
</Property>
<Property name="Label" type="App::PropertyString">
<String value="extruder-motor"/>
</Property>
<Property name="Links" type="App::PropertyLinkList">
<LinkList count="0">
</LinkList>
</Property>
<Property name="Placement" type="App::PropertyPlacement">
<PropertyPlacement Px="109.650000000000" Py="-100.500000000000" Pz="-442.000000000000" Q0="0.000000000000" Q1="0.000000000000" Q2="0.000000000000" Q3="1.000000000000"/>
</Property>
<Property name="Shape" type="Part::PropertyPartShape">
<Part file="PartShape.brp"/>
</Property>
</Properties>
</Object>
And the properties, not the Placement that is internally stored as a Quaternion and the Shape that has the reference to the
brp file that you could see in the directory image,
Code: Select all
<Object name="Sketch001">
<Properties Count="8">
<Property name="Constraints" type="Sketcher::PropertyConstraintList">
<ConstraintList count="29">
<Constrain Name="" Type="2" Value="0.000000000000" First="0" FirstPos="0" Second="-2000" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10.000000000000" LabelPosition="0.000000000000" IsDriving="1" />
<Constrain Name="" Type="2" Value="0.000000000000" First="2" FirstPos="0" Second="-2000" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10.000000000000" LabelPosition="0.000000000000" IsDriving="1" />
<Constrain Name="" Type="3" Value="0.000000000000" First="1" FirstPos="0" Second="-2000" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10.000000000000" LabelPosition="0.000000000000" IsDriving="1" />
<Constrain Name="" Type="3" Value="0.000000000000" First="3" FirstPos="0" Second="-2000" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10.000000000000" LabelPosition="0.000000000000" IsDriving="1" />
<Constrain Name="" Type="13" Value="0.000000000000" First="0" FirstPos="1" Second="4" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10.000000000000" LabelPosition="0.000000000000" IsDriving="1" />
<Constrain Name="" Type="13" Value="0.000000000000" First="0" FirstPos="2" Second="4" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10.000000000000" LabelPosition="0.000000000000" IsDriving="1" />
This is a partial part of a sketcher object.
carlopav wrote: ↑Sat May 16, 2020 9:24 pm
- Each object shape is represented in an attached binary file in the BREP format;
Yes but the file is not binary, is a normal ascii file:
Code: Select all
DBRep_DrawableShape
CASCADE Topology V1, (c) Matra-Datavision
Locations 7
1
1 0 0 109.65
0 1 0 -100.5
0 0 1 -442
1
6.07291994469961e-014 -7.04991620636974e-015 1 -109.653354136413
1 -1.149080830487e-014 -6.07291994469962e-014 100.500689864652
1.14908083048704e-014 1 7.04991620636904e-015 465.263548454841
2 1 -1 2 -1 0
1
6.07291994469961e-014 -7.04991620636974e-015 1 -109.653354136413
1 -1.149080830487e-014 -6.07291994469962e-014 100.500689864652
1.14908083048704e-014 1 7.04991620636904e-015 465.263548454841
2 1 -1 4 -1 0
The format is explained in one link in one of my past post, directly from the OCCT documentation
carlopav wrote: ↑Sat May 16, 2020 9:24 pm
- We can use the same approach with DXF: a document object that do not have a BREP representation, but a DXF one;
- This object can load in memory the DXF content and display it in the 3d view, letting us perform editing it;
- The object communicate directly with the stored DXF or save it when document is saved;
Is that something like that? If not, can you correct this ordered list, so we have a kind of trace of the backend workflow?
I think that for not reinventing the wheel, if the internal sketch format could be used, so no other libraries are involved, simple the part of the "floorplan" sketch could be "moved" in the external file and reference in a similar manner
f maybe the floorplan could be represented as:
Code: Select all
<Object name="Floor1">
<Properties Count="2">
<Property name="Label" type="App::PropertyString">
<String value="floor1"/>
</Property>
<Property name="ExtSketch type="App::ExtSketch">
<Part file="Floorplan1.dxf"/>
</Property>
</Properties>
</Object>
Properties names are clearly imagined, following the internal scheme, but maybe this could be a soft approach.
Maybe the annotations if they are belonging to the floorplan could be inserted in the "external sketch" , if the external sketch is kept in a format that the internal library (maybe with some little modification) could manage, no big work is needed.
Each "external sketch" has it's own annotations, and if not needed to be displayed, they are not using the horsepower, loading the whole document.xml will be less time consuming as the external sketch are loaded "on demand".
Hope to have been almost clear, if yorick will sponsor this approach, a better discussion has to be made on the format of this external file.
Regards
Carlo D.