• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1455
  • Last Modified:

Delphi GLScene export scene

i have a glscene project. In the sceneviewer i import some stl files as freeform. The user can interact with this objects (move and rotate them with mouse). Now i have to export this whole scene to one stl file, so the position and the rotation of the freeforms should be like in the scene after this export ("merge"). I found this thread  here about a similar problem, i tried this, but this creates an broken stl file (tried open with meshlab).

I hope there is some idea for creating a solution. If somebody knows a solution for another 3d-file format, it will be great too.

Kind Regard
0
Kuschelino
Asked:
Kuschelino
  • 2
1 Solution
 
Sinisa VukCommented:
I suggest great 3ds-import-library. It is not importer only, but can export to 3ds too. If you can make little demo project with export to stl, we can look into problem more easily. Stl stands as quite simple acsii format (STL file format) and export to it must be simple task too.
0
 
KuschelinoAuthor Commented:
I have a small demo project, really small. You can move to stl objects with cursor keys.
Before you can move the object, you have to select one with the mouse.

Hope this helps for finding a solution.
Delphi 2010 Project with 2 stl files attached.
!!!!! Attention:
I have to remane the included stl files in 1.bmp (should be 1.stl) and 2.bmp (should    be   2.stl)
 the binary is renamed to project1.bmp (should be project1.exe)
--> becaus upload restrictions.


Kind Regards

I will be eternally grateful, expert exchange is my last hope.
3ddemo.zip
0
 
KuschelinoAuthor Commented:
I have found the solution by my self. The trick for the binary stl format was, that i have the heade caluculated right.
var j : integer;
   i : Integer;
   header : TSTLHeader;
   dataFace : TSTLFace;
   list : TAffineVectorList;
   var f: Textfile;

const
   cHeaderTag = 'GLScene STL export';
begin

FillChar(header.dummy[0], SizeOf(header.dummy), 0);
Move(cHeaderTag, header.dummy[0], Length(cHeaderTag));
//calculate header count
 for j := 0 to objects.Count - 1 do
 begin
      list:=TGLFREeform(objects[j]).MeshObjects.ExtractTriangles;
      header.nbFaces:= header.nbFaces + list.Count div 3;
 end;

       aStream.Write(header, SizeOf(header));

 for j := 0 to objects.Count - 1 do
 begin
      list:=TGLFREeform(objects[j]).MeshObjects.ExtractTriangles;


   try

      i:=0; while i<list.Count do begin
         dataFace.normal:=CalcPlaneNormal(list[i], list[i+1], list[i+2]);

        dataFace.v1:=VectorTransform(list[i],TGLFREeform(objects[j]).AbsoluteMatrix);
        dataFace.v2:=VectorTransform(list[i+1],TGLFREeform(objects[j]).AbsoluteMatrix);
        dataFace.v3:=VectorTransform(list[i+2],TGLFREeform(objects[j]).AbsoluteMatrix);

         aStream.Write(dataFace, SizeOf(dataFace));
         Inc(i, 3);

      end;

   finally
      list.Free;
   end;

 end;

Open in new window

0
 
Geert GruwezOracle dbaCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now