德尔福GLScene出口场景为stl [英] Delphi GLScene export scene as stl
问题描述
我有一个 GLScene
项目。在 SceneViewer
中,我将一些stl文件导入为自由格式。
用户可以与这个对象进行交互(用鼠标移动并旋转它们)
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).
现在我必须导出这个整个 Scene
到一个 stl文件,所以 freeforms 的位置和轮换应该像场景
此导出后(合并)。
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").
我发现这个线程关于同样的问题:将场景导出到STL文件,但这会创建一个破碎的stl文件(试图用meshlab打开)。
I found this thread about the same problem: Export "Scene" to STL File but this creates an broken stl file (tried open with meshlab).
我希望创建一个解决方案有一些想法。
如果有人知道另一种3d文件格式的解决方案,那么它也是很棒的。
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.
推荐答案
我找到了解决方案:-)
I have found the solution :-)
在答案是几乎正确的,
,但我必须以另一种方式计算头信息(平头计数)。
现在我使用一个循环,在写入之前计算头。
有时解决方案是如此接近。
the link in the answer is nearly right, but i have to calculate the header information (count of faceletts) in an other way. now i use a loop an calculate the header before writing thats all. Sometimes the solution is so near.
var j :integer ;
var i:integer;
var header: TSTLHeader;
var dataFace: TSTLFace;
var list: TaffineVectorlist;
//objects = list of steFreeform objects
//astream = created stream
for j := 0 to objects.count - 1 do
begin
list := TGLFREEForm(objects[j].MeshObjects.ExtractTriangles;
header.nbfaces :0 header.nbFaces + list.count div 3 ;
end;
aStream.write(header.SizeOf(header));
//rest see above link in the question
这篇关于德尔福GLScene出口场景为stl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!