File Format FCStd

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!
Post Reply
Hubi

File Format FCStd

Post by Hubi »

Does someone know something about the File Format FCStd?
Is there a specification about it? Is it open?
An open CAD-file-format would be nice.

see also
http://groups.fsf.org/wiki/OpenDWG_Repl ... le_Formats
Yorik

Re: File Format FCStd

Post by Yorik »

Freecad supports fully and natively two other formats listed on that page: iges and step...
About the .Fcstd format, it is actually a zip file (you can rename its extension to .zip and unzip it)
Inside, you'll find xml files describing the app and gui documents, a thumbnail image and several brep files for the shapes contained in the document.
brep format is also a standard:
http://en.wikipedia.org/wiki/Boundary_representation
and the brep file format is part of opencascade which is open-source... So I think we can say the .Fcstd is open ;)
http://www.opencascade.org/org/forum/thread_11606/
and since freecad is importable as a python module inside other applications, it is also fairly easy to make an application able to import .fcstd files:
http://sourceforge.net/apps/mediawiki/f ... ng_FreeCAD
http://wiki.blender.org/index.php/Exten ... rt_freecad

but IMHO (and I think it's also the opinion of many others here) the best candidate for a "standard" cad (and bim) format would be step...
In fact I think one of the first "serious" use people have made of freecad was as a step viewer...
wmayer
Founder
Posts: 20320
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: File Format FCStd

Post by wmayer »

Maybe some more useful information about the FCStd structure:
  • the file Document.xml must be the very first file inside the archive. It contains information about which object types must be created, the values of their properties and optionally the related datafile names which come later in the archive. E.g. for shape properties we use the brep format, for points the asc format and for meshes or own, binary mesh format (bms).
  • if required here are the data files (brep, asc, bms). They must be in the same order as they're mentioned in Document.xml
  • the thumbnail and GuiDocument.xml files are optional. GuiDocument.xml comes after the data files and the last file is thumbnails/Thumbnail.png

Code: Select all

<?xml version='1.0' encoding='utf-8'?>
<!--
 FreeCAD Document, see http://free-cad.sourceforge.net for more informations...
-->
<Document SchemaVersion="4">
	<Properties Count="9">
		<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">
			<String value="Fri Jan 29 15:14:38 2010 "/>
		</Property>
		<Property name="FileName" type="App::PropertyString">
			<String value="/tmp/test.FCStd"/>
		</Property>
		<Property name="Id" type="App::PropertyString">
			<String value="201b746f-a1ed-4297-bf3d-65d5ec11abe0"/>
		</Property>
		<Property name="Label" type="App::PropertyString">
			<String value="names"/>
		</Property>
		<Property name="LastModifiedBy" type="App::PropertyString">
			<String value=""/>
		</Property>
		<Property name="LastModifiedDate" type="App::PropertyString">
			<String value="Fri Jan 29 15:15:21 2010 "/>
		</Property>
	</Properties>
	<Objects Count="2">
		<Object type="Mesh::Cube" name="Cube" />
		<Object type="Part::Box" name="Box" />
	</Objects>
	<ObjectData Count="2">
		<Object name="Cube">
			<Properties Count="7">
				<Property name="Height" type="App::PropertyFloatConstraint">
					<Float value="10"/>
				</Property>
				<Property name="Label" type="App::PropertyString">
					<String value="Cube"/>
				</Property>
				<Property name="Length" type="App::PropertyFloatConstraint">
					<Float value="10"/>
				</Property>
				<Property name="Mesh" type="Mesh::PropertyMeshKernel">
					<Mesh file="MeshKernel.bms"/>
				</Property>
				<Property name="Placement" type="App::PropertyPlacement">
					<PropertyPlacement Px="0" Py="0" Pz="0" Q0="0" Q1="0" Q2="0" Q3="1"/>
				</Property>
				<Property name="Pos" type="App::PropertyPlacementLink">
					<Link value=""/>
				</Property>
				<Property name="Width" type="App::PropertyFloatConstraint">
					<Float value="10"/>
				</Property>
			</Properties>
		</Object>
		<Object name="Box">
			<Properties Count="7">
				<Property name="Height" type="App::PropertyLength">
					<Float value="10"/>
				</Property>
				<Property name="Label" type="App::PropertyString">
					<String value="Box2"/>
				</Property>
				<Property name="Length" type="App::PropertyLength">
					<Float value="10"/>
				</Property>
				<Property name="Placement" type="App::PropertyPlacement">
					<PropertyPlacement Px="0" Py="0" Pz="0" Q0="0" Q1="0" Q2="0" Q3="1"/>
				</Property>
				<Property name="Pos" type="App::PropertyPlacementLink">
					<Link value=""/>
				</Property>
				<Property name="Shape" type="Part::PropertyPartShape">
					<Part file="PartShape.brp2"/>
				</Property>
				<Property name="Width" type="App::PropertyLength">
					<Float value="10"/>
				</Property>
			</Properties>
		</Object>
	</ObjectData>
</Document>
is an example of the Document.xml structure. First set the document properties and the scheme version which should be 4. Actually you can omit all the properties and just <Properties Count="0"></Properties>, then. Then with

Code: Select all

	<Objects Count="2">
		<Object type="Mesh::Cube" name="Cube" />
		<Object type="Part::Box" name="Box" />
	</Objects>
you must specify which objects should be created, i.e. of what type they are and what their names are.In the ObjectData tag you define the values of the object properties. Again, you can drop some properties but must define the number of set properties.
Hubi

Re: File Format FCStd

Post by Hubi »

This is interesting. Thany you very much for the fast and extensive information.
Did I got your postings correct? Step is a (ISO)standard for a 3D file format and Open CASCADE is an (open source)standard for the same - 3D representation. FCStd contains brep, a part of Open CASCADE and two other parts: asc and bms (and of corse xml :-)
FreeCAD does open and save in FCStd and step (and iges).

When I convert with FreeCAD from
FCStd -> step -> FCStd
and from
step -> FCStd -> step:
Do I have exactly the same file after these conversions?

What are the advantages and disadvantages of step, Open CASCADE and FCStd? Who and how many people do use these formats?

Why not open an Wiki page about this topic, or is there already one?
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: File Format FCStd

Post by jriegel »

Its not that easy.

FCstd holds more information then BREP and STEP. There also Features, graphic information, scripts macros, drawings. And all
application depended.

STEP is an ISO standard for exchanging product information. A lot stuff in FreeCAD can not expressed in STEP so there is no
round trip. Its always the same. If you base your application on a standard like STEP, you can only do what STEP overs. not more....
Stop whining - start coding!
Post Reply