用什么软件可以提取stl格式曲面的所有顶点坐标
2个回答
展开全部
我刚好做了类似的项目。STL可以导入PROE或CATIA,问题是毫无意义,除了给快速成型设备。所以通过geomagic可以逆向建面,输出IGS或者STEP,然后导入PROE或CATIA
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Matlab可以提取,这个是我在matlab社区找到的代码
function [v, f, n, c, stltitle] = stlread(filename, verbose)
% This function reads an STL file in binary format into vertex and face
% matrices v and f.
%
% USAGE: [v, f, n, c, stltitle] = stlread(filename, verbose);
%
% verbose is an optional logical argument for displaying some loading
% information (default is false).
%
% v contains the vertices for all triangles [3*n x 3].
% f contains the vertex lists defining each triangle face [n x 3].
% n contains the normals for each triangle face [n x 3].
% c is optional and contains color rgb data in 5 bits [n x 3].
% stltitle contains the title of the specified stl file [1 x 80].
%
% To see plot the 3D surface use:
% patch('Faces',f,'Vertices',v,'FaceVertexCData',c);
% or
% plot3(v(:,1),v(:,2),v(:,3),'.');
%
% Duplicate vertices can be removed using:
% [v, f]=patchslim(v, f);
%
% For more information see:
% http://www.esmonde-white.com/home/diversions/matlab-program-for-loading-stl-files
%
% Based on code originally written by:
% Doron Harlev
% and combined with some code by:
% Eric C. Johnson, 11-Dec-2008
% Copyright 1999-2008 The MathWorks, Inc.
%
% Re-written and optimized by Francis Esmonde-White, May 2010.
use_color=(nargout>=4);
fid=fopen(filename, 'r'); %Open the file, assumes STL Binary format.
if fid == -1
error('File could not be opened, check name or path.')
end
if ~exist('verbose','var')
verbose = false;
end
ftitle=fread(fid,80,'uchar=>schar'); % Read file title
numFaces=fread(fid,1,'int32'); % Read number of Faces
T = fread(fid,inf,'uint8=>uint8'); % read the remaining values
fclose(fid);
stltitle = char(ftitle');
if verbose
fprintf('\nTitle: %s\n', stltitle);
fprintf('Number of Faces: %d\n', numFaces);
disp('Please wait...');
end
% Each facet is 50 bytes
% - Three single precision values specifying the face normal vector
% - Three single precision values specifying the first vertex (XYZ)
% - Three single precision values specifying the second vertex (XYZ)
% - Three single precision values specifying the third vertex (XYZ)
% - Two color bytes (possibly zeroed)
% 3 dimensions x 4 bytes x 4 vertices = 48 bytes for triangle vertices
% 2 bytes = color (if color is specified)
trilist = 1:48;
ind = reshape(repmat(50*(0:(numFaces-1)),[48,1]),[1,48*numFaces])+repmat(trilist,[1,numFaces]);
Tri = reshape(typecast(T(ind),'single'),[3,4,numFaces]);
n=squeeze(Tri(:,1,:))';
n=double(n);
v=Tri(:,2:4,:);
v = reshape(v,[3,3*numFaces]);
v = double(v)';
f = reshape(1:3*numFaces,[3,numFaces])';
if use_color
c0 = typecast(T(49:50),'uint16');
if (bitget(c0(1),16)==1)
trilist = 49:50;
ind = reshape(repmat(50*(0:(numFaces-1)),[2,1]),[1,2*numFaces])+repmat(trilist,[1,numFaces]);
c0 = reshape(typecast(T(ind),'uint16'),[1,numFaces]);
r=bitshift(bitand(2^16-1, c0),-10);
g=bitshift(bitand(2^11-1, c0),-5);
b=bitand(2^6-1, c0);
c=[r; g; b]';
else
c = zeros(numFaces,3);
end
end
if verbose
disp('Done!');
end
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询