collada export results in empty but correct file on referenced features

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!
Post Reply
matiasasb
Posts: 1
Joined: Sun Aug 07, 2022 11:12 pm

collada export results in empty but correct file on referenced features

Post by matiasasb »

Hello!
Trying to export in collada format a feature that is referenced by another, let us say, the one which another feature is attached to; results in an empty file.

Is this a bug or expected behaviour?.

Way to reproduce:
  1. Create new file
  2. Add two boxes
  3. Reference one box with another. Examples:
    • Attach first box to the second.
    • Reference first box Placement.Base.x in Placement of the other box.
  4. Export both boxes in collada (*.dae) format.
  5. Import the generated files
Expected result:
Two new meshes.

Actual result.
One mesh.

The empty export:

Code: Select all

<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <contributor/>
    <created>2022-08-07T20:08:32.646802</created>
    <modified>2022-08-07T20:08:32.646816</modified>
    <unit name="meter" meter="1.0"/>
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_visual_scenes>
    <visual_scene id="myscene"/>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#myscene"/>
  </scene>
</COLLADA>
The expected export

Code: Select all

<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <contributor/>
    <created>2022-08-07T20:08:04.387256</created>
    <modified>2022-08-07T20:08:04.387263</modified>
    <unit name="meter" meter="1.0"/>
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_effects>
    <effect id="effect_Box001" name="effect_Box001">
      <profile_COMMON>
        <technique sid="common">
          <phong>
            <emission>
              <color>0.0 0.0 0.0 1.0</color>
            </emission>
            <ambient>
              <color>0.0 0.0 0.0 1.0</color>
            </ambient>
            <diffuse>
              <color>0.800000011920929 0.800000011920929 0.800000011920929 1.0</color>
            </diffuse>
            <specular>
              <color>1 1 1 1.0</color>
            </specular>
            <shininess>
              <float>0.0</float>
            </shininess>
            <reflective>
              <color>0.0 0.0 0.0 1.0</color>
            </reflective>
            <reflectivity>
              <float>0.0</float>
            </reflectivity>
            <transparent>
              <color>0.0 0.0 0.0 1.0</color>
            </transparent>
            <transparency>
              <float>1.0</float>
            </transparency>
          </phong>
        </technique>
        <extra>
          <technique profile="GOOGLEEARTH">
            <double_sided>0</double_sided>
          </technique>
        </extra>
      </profile_COMMON>
    </effect>
  </library_effects>
  <library_geometries>
    <geometry id="geometry0" name="Box001">
      <mesh>
        <source id="cubeverts-array0">
          <float_array count="24" id="cubeverts-array0-array">0 0 0.018 0 0 0.028 0 0.01 0.018 0 0.01 0.028 0.01 0 0.028 0.01 0 0.018 0.01 0.01 0.018 0.01 0.01 0.028</float_array>
          <technique_common>
            <accessor count="8" source="#cubeverts-array0-array" stride="3">
              <param type="float" name="X"/>
              <param type="float" name="Y"/>
              <param type="float" name="Z"/>
            </accessor>
          </technique_common>
        </source>
        <source id="cubenormals-array0">
          <float_array count="36" id="cubenormals-array0-array">-1 0 0 -1 0 0 1 0 0 1 -0 0 0 -1 0 0 -1 0 0 1 0 0 1 0 0 0 -1 0 0 -1 0 0 1 0 0 1</float_array>
          <technique_common>
            <accessor count="12" source="#cubenormals-array0-array" stride="3">
              <param type="float" name="X"/>
              <param type="float" name="Y"/>
              <param type="float" name="Z"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="cubeverts-array0-vertices">
          <input semantic="POSITION" source="#cubeverts-array0"/>
        </vertices>
        <triangles count="12" material="ref_Box001">
          <input offset="0" semantic="VERTEX" source="#cubeverts-array0-vertices"/>
          <input offset="1" semantic="NORMAL" source="#cubenormals-array0"/>
          <p>0 0 1 0 2 0 2 1 1 1 3 1 4 2 5 2 6 2 4 3 6 3 7 3 5 4 4 4 0 4 0 5 4 5 1 5 7 6 6 6 2 6 7 7 2 7 3 7 2 8 6 8 0 8 0 9 6 9 5 9 7 10 3 10 1 10 7 11 1 11 4 11</p>
        </triangles>
      </mesh>
    </geometry>
  </library_geometries>
  <library_materials>
    <material id="mat_Box001" name="Box001">
      <instance_effect url="#effect_Box001"/>
    </material>
  </library_materials>
  <library_visual_scenes>
    <visual_scene id="myscene">
      <node id="node0" name="node0">
        <instance_geometry url="#geometry0">
          <bind_material>
            <technique_common>
              <instance_material symbol="ref_Box001" target="#mat_Box001"/>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#myscene"/>
  </scene>
</COLLADA>
Export works correctly in ply format. In fact, this is the workaround I am using.

I was thinking that this is so to avoid exporting base features twice or on the like.

So, the question is: Is the behaviour explained above a bug or the expected one?

Code: Select all

OS: openSUSE Leap 15.4 (GNOME/default)
Word size of FreeCAD: 64-bit
Version: 0.20.Unknown
Build type: Release
Python 3.6.15, Qt 5.15.2, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.2
Locale: Spanish/Argentina (es_AR)
Installed mods: 
  * BOLTSFC

Saludos cordiales. (I really don't know how to close a message in english)
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: collada export results in empty but correct file on referenced features

Post by Roy_043 »

Confirmed.

Code: Select all

OS: Windows 8.1 Version 6.3 (Build 9600)
Word size of FreeCAD: 64-bit
Version: 0.21.29997 (Git)
Build type: Release
Branch: master
Hash: b52967d52ac46eff7c59e74d991f3f5b298944ef
Python 3.10.5, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.2
Locale: Dutch/Netherlands (nl_NL)
Installed mods: 
Post Reply