Solved

Delphi GLScene export scene

Posted on 2013-01-25
7
1,190 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 25

Expert Comment

by:Sinisa Vuk
Comment Utility
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
Comment Utility
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
Comment Utility
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 36

Expert Comment

by:Geert Gruwez
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Viewers will learn how to create burn videos onto a DVD using Nero Suite including creating a DVD menu and chapters.
Viewers will learn the basics of using Ableton Live's advanced sampler instrument, Sampler. Load new Sampler into an empty MIDI track: Select a sample and drop it into sample window in Sampler: Adjust pitch if necessary with Root Key setting: …

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now