Solved

Delphi GLScene export scene

Posted on 2013-01-25
7
1,261 Views
Last Modified: 2013-12-04
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
Comment
Question by:Kuschelino
  • 2
7 Comments
 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 38824657
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
 

Author Comment

by:Kuschelino
ID: 38827274
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
 

Accepted Solution

by:
Kuschelino earned 0 total points
ID: 38836546
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
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 39479169
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Viewers will learn the basics of making and using Impulse Kits in Ableton Live. Load new Impulse into an empty MIDI track: Fill the 8 empty sample slots with drum samples: Adjust parameters to tailor each sound as desired: Proceed to create be…
Viewers will learn key ranges in Sampler to make their sampled instruments sound more realistic Gather samples of various notes and drag them to Key Range panel: Set proper root key for each sample: Select all the samples with Command-A (or Ctrl…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question