stlwrite - write ASCII or Binary STL files

버전 1.9.0.0 (10.6 KB) 작성자: Sven
将各种输入(斑块,表面)导出到STL三角网格

다운로드:25.3k

업데이트 날짜:2018/5/4

라이선스 보기

**大速度提升由奥利弗·伍德福德(Oliver Woodford)提供。建议更新到最新版本**
stlwrite(FILE, FV) writes a stereolithography (STL) file to FILE for a
三angulated patch defined by FV (a structure with fields 'vertices'
and 'faces').

stlwrite(FILE, FACES, VERTICES) takes faces and vertices separately,
rather than in an FV struct

stlwrite(FILE, X, Y, Z) creates an STL file from surface data in X, Y,
and Z. stlwrite triangulates this gridded data into a triangulated
使用下面指定的三角剖分选项的表面。x,y和z可以是
two-dimensional arrays with the same size. If X and Y are vectors with
length equal to SIZE(Z,2) and SIZE(Z,1), respectively, they are passed
through MESHGRID to create gridded data. If X or Y are scalar values,
它们用于指定网格点之间的X和Y间距。

stlwrite(...,'PropertyName',VALUE,'PropertyName',VALUE,...) writes an
使用以下属性值的STL文件:

MODE - File is written using 'binary' (default) or 'ascii'.

TITLE - Header text (max 80 chars) written to the STL file.

TRIANGULATION - When used with gridded data, TRIANGULATION is either:
'delaunay' - (默认)x,y的delaunay三角剖分
'f' - Forward slash division of grid quads
'b' - Back slash division of quadrilaterals
'x' - Cross division of quadrilaterals
Note that 'f', 'b', or 't' triangulations now use an
inbuilt version of FEX entry 28327, "mesh2tri".

FACECOLOR - Single colour (1-by-3) or one-colour-per-face (N-by-3)
RGB颜色的向量,用于面部/顶点输入。RGB范围
IS 5位(0:31),以Viscam/SolidView格式存储
(http://en.wikipedia.org/wiki/stl_(file_format)#color_in_binary_stl)

示例1:
% Write binary STL from face/vertex data
tmpvol = false(20,20,20); % Empty voxel volume
tmpvol(8:12,8:12,5:15) = 1; % Turn some voxels on
fv = isosurface(~tmpvol, 0.5); % Make patch w. faces "out"
stlwrite('test.stl',fv)%保存到二进制.stl

示例2:
%从网格数据中写下ASCII STL
[X,Y] = deal(1:40); % Create grid reference
Z = peaks(40); % Create grid height
stlwrite('test.stl',x,y,z,'mode','ascii')

示例3:
% Write binary STL with coloured faces
cVals = fv.vertices (fv.faces (:,1),3); % Colour by Z height.
攀登= [min(cvals)max(cvals)];%转换身高值
nCols = 255; cMap = jet(nCols); % onto an 8-bit colour map
fColsDbl = interp1(linspace(cLims(1),cLims(2),nCols),cMap,cVals);
fCols8bit = fColsDbl*255; % Pass cols in 8bit (0-255) RGB triplets
stlwrite('testCol.stl',fv,'FaceColor',fCols8bit)

인용 양식

Sven(2022)。stlwrite - write ASCII or Binary STL files(//www.tianjin-qmedu.com/matlabcentral/fileexchange/20922-stlwrite-write-write-write-isasi- or-binary-s- s--stl-files),Matlab Central File Exchange。검색됨.

matlab릴리스호환정보
개발 환경: R2011b
모든 릴리스와 호환
플랫폼 호환성
视窗 macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

开始狩猎!