function []=writeDXF(fname,X,Y,varargin) DXF_var_in = argn(2); DXF_flags = []; DXF_vars = []; // The intended use of this macro is to export entities to a // CAD environment, where graphical formatting and annotation // may be performed //******************************************************************************************* // I disclaim any responsibility for tragic or litiginous circumstances arising from its use // NO WARRANTY OF ANY KIND is implied or expressed,.. be thankful if it works // Toby Borland 1-Apr-2004, tested on Autodesk(r) AutoCad 2004 // tobyborland@hotmail.com //******************************************************************************************* // The format is based around the Autodesk AutoCAD R11 specification for .DXF files // // input input flag options DXF output // // 2..3 coords POINT // 'POINT'--------> for arrays of points // >6 vectors/matrices coords POLYLINE + VERTICES // 'closed' // 'polyface' // 'tessa' // 'N_closed' // matrices '3DFACE' // 'layer=[?..?]' // 'color=[-256(?)..256]' // 'handle_offset=??' // // assume polyline if vector input given // assume polymesh if matrix input given and 'POINT' not specified handle_offset = 48; //guess, relying on CAD environment to reassign hard pointers color = 256; layer = 0; Z = []; DXF_entity = []; DXF_legal_flags = ['POINT' '3DFACE' 'POLYLINE' 'polyface' 'tessa' 'closed' 'N_closed' 'color=' 'layer=' 'handle_offset=']; //'B3spline' 'B4spline' 'Bezier' not used as NURBS work better in both environments // relevant Group 70 bit-flags for POLYLINE Pl_closed_or_polygon_mesh_M_closed = 0; // 'closed' Pl_3D = 1; // not always true, AUDIT reports error and 'fixes' vertices to lose all data Pl_3D_polygon_mesh = 0; // Pl_polygon_mesh_N_closed = 0; // 'N_closed' Pl_polyface_mesh = 0; // => Group71 & Group72 VERTEX Group 70 128 bit set,'polyface' Pl_linetype_continuous = 1; // dunno ramifications yet function found = boolgrep(S1, S2); found = []; if (grep(S1, S2) == []) then found = %F; else found = %T; end endfunction for DXF_1 = 1:(DXF_var_in - 3) do select type(varargin(DXF_1)) case 1 if (Z == []) then Z = varargin(DXF_1); end case 10 DXF_flags = [DXF_flags varargin(DXF_1)]; else warning(" unrecognised input type > "+string(varargin(DXF_1))); end end if boolgrep(DXF_flags,'color=') then execstr(DXF_flags(grep(DXF_flags,'color='))); if (color > 256)|(color < -256) then color = 256; warning(" color number range = [-256?..256], reverting to default color"); end end if boolgrep(DXF_flags,'handle_offset=') then execstr(DXF_flags(grep(DXF_flags,'handle_offset='))); handle_offset = dec2hex(handle_offset); if (handle_offset <= 0) then handle_offset = 30; end warning(" I have not fully determined how hard pointers are assigned"); disp(" Fiddle with handle_offset at your peril"); end if boolgrep(DXF_flags,'layer=') then execstr(DXF_flags(grep(DXF_flags,'layer='))); if (layer < 0)|(layer > 30) then layer = 0; end warning(" I do not know how many layer are supported across all CAD programs"); disp(" Fiddle with layer at your peril"); end DXF_flags = DXF_flags(grep(DXF_flags, DXF_legal_flags)); WCS_Z = 0; if Z==[] then // if no Z dimension, generate same size zero matrix Z = zeros(size(X,1),size(X,2)); Pl_3D = 0; elseif max(size(Z)) == 1 then //only elevation supplied WCS_Z = Z; Z = Z .* ones(size(X,1),size(X,2)); Pl_3D = 0; end // dimension check if (size(X,1)~=size(Y,1))| ... (size(X,2)~=size(Y,2))| ... (size(Y,1)~=size(Z,1))| ... (size(Y,2)~=size(Z,2)) then error("XY coordinate matrices/vectors dissimilar in dimension"); end M = size(X,'c'); N = size(X,'r'); // 256 M,N limit check if (M * N) > 65536 then warning(" polyline size probably exceeded"); elseif (M > 1)&(N > 256) // mesh [2..256]x[2..256] error(" POLYLINE mesh maximum columns (N > 256) exceeded"); elseif (N > 1)&(M > 256) error(" POLYLINE mesh maximum rows (M > 256) exceeded"); end // Determine desired/possible output entity // Default entity DXF_entity = 'POLYLINE'; // vector/matrix input => Polyline / Poly~ mesh output if not 'POINT' or '3DFACE' // required to be able to define arrays of points if boolgrep(DXF_flags,'POINT') then if boolgrep(DXF_flags,'3DFACE') then error(" either POINT or 3DFACE, not both"); end end if boolgrep(DXF_flags,'POINT')|(and([size(X,1) size(X,2)]) == 1) then if boolgrep(DXF_flags, ['closed' 'polyface' 'tessa' 'N_closed']) then warning(" POINT incompatible with other flags"); end DXF_entity = 'POINT'; end if boolgrep(DXF_flags,'3DFACE') then if boolgrep(DXF_flags, ['closed' 'polyface' 'N_closed']) then warning(" 3DFACE incompatible with other flags"); end if (or([size(X,1) size(X,2)]) == 1) then error(" APOLOGIES: easier to enter matrix than assume user preferences"); end DXF_entity = '3DFACE'; end if boolgrep(DXF_flags,'closed') then if (DXF_entity == 'POLYLINE') then Pl_closed_or_polygon_mesh_M_closed = 1; else error(" only entries with more than 2 points can be closed"); end end if boolgrep(DXF_flags,'N_closed') then if (DXF_entity == 'POLYLINE') & and([M N] > 1) then Pl_polygon_mesh_N_closed = 1; // 'N_closed' else error(" only matrix polymesh can be N_closed"); end end if boolgrep(DXF_flags,'tessa') then if and([M N] > 1) then warning(" tessalation interstices defined by position of coordinate within input array"); disp(" see help or code for details"); Pl_polyface_mesh = 1; end if (DXF_entity == 'POINT') error(" only matrix polymesh/3DFACE can be tessalated"); end end if boolgrep(DXF_flags,'polyface') then if or([M N] == 1) then // 'closed' implied // calls on and multiple face generation // creates the necessity of writing an algorithm // capable of dealing with concave boundaries disp(" Arbitrary vertex polygons require a concave hull algorithm"); disp(" .. which has not been implemented in writeR11DXF as of yet"); error(" polyface flag only relevant to polymesh input (matrix)"); else disp(" Polyface mesh faces have been allocated wrt input matrix ordering"); end Pl_polyface_mesh = 1; end // extension check if (grep(fname, '.')==[]) then fname = fname+'.dxf'; end X = matrix(X',-1,1); Y = matrix(Y',-1,1); Z = matrix(Z',-1,1); // Got to continiously write to file to minimise stack size overhead [fid,err] = mopen(fname,'w',0) if err<0 then fid = -1;end Header = ... ' 0\nSECTION\n 2\nHEADER\n' + ... ' 9\n$ACADVER\n 1\nAC1009\n' + ... '999\nThis file is generated by the scilab script writeR12DXF.sce\n' + ... '999\nToby Borland mar2004 tobyborland@hotmail.com\n' + ... ' 9\n$WORLDVIEW\n 70\n 1\n' + ... ' 0\nENDSEC\n'; mfprintf(fid,Header); // Start of Entities section mfprintf(fid,' 0\nSECTION\n 2\nENTITIES\n'); // polyline vertices\points added row-wise from left to right // put arrays into XYZ[X_column_vector Y_column_vector Z_column_vector] // so that associated points are on same rows select DXF_entity case 'POINT'//_____________________________________________________POINT Pt_handle = handle_offset + 1 + (1:(M * N))'; Pt_layer = layer .* ones((M * N),1); Pt_color = color .* ones((M * N),1); Point_format = ' 0\nPOINT\n' + ... // header ' 5\n%6X\n' + ... // handle ' 8\n%u\n' + ... // layer ' 62\n%6i\n' + ... // colour ' 10\n%.17G\n' + ... // X ' 20\n%.17G\n' + ... // Y ' 30\n%.17G\n'; // Z mfprintf(fid, Point_format, Pt_handle, Pt_layer, Pt_color, X, Y, Z) case '3DFACE'//_____________________________________________________3DFACE // relevant Group 70 bit-flags for 3DFACE D3F_edge_1_invisible = 0; D3F_edge_2_invisible = 0; D3F_edge_3_invisible = 0; D3F_edge_4_invisible = 0; D3F_G70 = D3F_edge_1_invisible + ... 2 * D3F_edge_2_invisible + ... 4 * D3F_edge_3_invisible + ... 8 * D3F_edge_4_invisible; D3F_ref = (1:(M-1)*(N-1))'; D3F_format = ' 0\n3DFACE\n' + ... // header ' 5\n%X\n' + ... // handle ' 8\n%u\n' + ... // layer ' 62\n%6i\n' + ... // colour ' 10\n%.17G\n' + ... // corner 0, X ' 20\n%.17G\n' + ... // corner 0, Y ' 30\n%.17G\n' + ... // corner 0, Z ' 11\n%.17G\n' + ... // corner 1, X ' 21\n%.17G\n' + ... // corner 1, Y ' 31\n%.17G\n' + ... // corner 1, Z ' 12\n%.17G\n' + ... // corner 2, X ' 22\n%.17G\n' + ... // corner 2, Y ' 32\n%.17G\n' + ... // corner 2, Z ' 13\n%.17G\n' + ... // corner 3, X ' 23\n%.17G\n' + ... // corner 3, Y ' 33\n%.17G\n' + ... // corner 3, Z ' 70\n%6u\n'; //Group 70 flag // TO ALTER THE ORDER OF SIDES ENTERED INTO TESSA, // CHANGE THE ORDER OF THE VECTORS BELOW D3F_ref = matrix(1:(M*N),M,N); D3F_TLC = matrix(D3F_ref(1:(M-1),1:(N-1)),-1,1); // Top Left Corner D3F_TRC = matrix(D3F_ref(2:M,1:(N-1)),-1,1); D3F_BLC = matrix(D3F_ref(1:(M-1),2:N),-1,1); D3F_BRC = matrix(D3F_ref(2:M,2:N),-1,1); // Bottom right corner of a face if ~(boolgrep(DXF_flags,'tessa')) then // default 4 corners D3F_handle = (handle_offset-1) + (1:(M-1)*(N-1))'; D3F_layer = layer .* ones(((M-1)*(N-1)), 1); D3F_color = color .* ones(((M-1)*(N-1)), 1); D3F_G70_V = D3F_G70 .* ones(((M-1)*(N-1)), 1); mfprintf(fid, D3F_format, D3F_handle, D3F_layer, D3F_color, ... X(D3F_TLC), Y(D3F_TLC), Z(D3F_TLC), ... X(D3F_TRC), Y(D3F_TRC), Z(D3F_TRC), ... X(D3F_BRC), Y(D3F_BRC), Z(D3F_BRC), ... X(D3F_BLC), Y(D3F_BLC), Z(D3F_BLC), ... D3F_G70_V); else // tessa: arrange 3dfaces as triangles // given arrays are for triangles and dummy 4th // point must be generated, note 4th vertex invisible (-ve) // this is a 'backslash' arrangement D3F_handle = (handle_offset-1) + (1:(2*(M-1)*(N-1)))'; D3F_handle = matrix(D3F_handle,2,-1)'; D3F_edge_3_invisible = 1; D3F_G70 = D3F_edge_1_invisible + ... 2 * D3F_edge_2_invisible + ... 4 * D3F_edge_3_invisible + ... 8 * D3F_edge_4_invisible; D3F_layer = layer .* ones((2*(M-1)*(N-1)), 1); D3F_color = color .* ones((2*(M-1)*(N-1)), 1); D3F_G70_V = D3F_G70 .* ones((2*(M-1)*(N-1)), 1); // note this is not in sequential order to handle reference mfprintf(fid, D3F_format, D3F_handle(:,1), D3F_layer, D3F_color, ... X(D3F_TLC), Y(D3F_TLC), Z(D3F_TLC), ... X(D3F_TRC), Y(D3F_TRC), Z(D3F_TRC), ... X(D3F_BRC), Y(D3F_BRC), Z(D3F_BRC), ... X(D3F_BRC), Y(D3F_BRC), Z(D3F_BRC), ... D3F_G70_V); mfprintf(fid, D3F_format, D3F_handle(:,2), D3F_layer, D3F_color, ... X(D3F_TLC), Y(D3F_TLC), Z(D3F_TLC), ... X(D3F_BLC), Y(D3F_BLC), Z(D3F_BLC), ... X(D3F_BRC), Y(D3F_BRC), Z(D3F_BRC), ... X(D3F_BRC), Y(D3F_BRC), Z(D3F_BRC), ... D3F_G70_V); end case 'POLYLINE'//_____________________________________________________POLYLINE // Group 70 bit-flags for POLYLINE Pl_G70 = Pl_closed_or_polygon_mesh_M_closed + ... 8 * Pl_3D + ... 16 * Pl_3D_polygon_mesh + ... 32 * Pl_polygon_mesh_N_closed + ... 64 * Pl_polyface_mesh + ... 128 * Pl_linetype_continuous; Polyline_format = ' 0\nPOLYLINE\n' + ... // header ' 5\n%X\n' + ... // handle ' 8\n%u\n' + ... // layer ' 62\n%6i\n' + ... // colour ' 66\n 1\n' + ... // 'vertices follow' flag ' 10\n0.0\n' + ... // X (always zero) ' 20\n0.0\n' + ... // Y (always zero) ' 30\n%.17G\n' + ... // Z elevation WCS ' 70\n%6u\n'; // Group 70 bitflag mfprintf(fid, Polyline_format, handle_offset, layer, color, WCS_Z, Pl_G70); if (Pl_polyface_mesh == 1) // POLYLINE Group 71 & 72 mfprintf(fid,' 71\n%6u\n 72\n%6u\n', M, N); end //-----------------------------------------------------VERTEX // relevant Group 70 bit-flags for VERTEX Vx_3D_Polyline = 0; //dunno Vx_3D_polygon_mesh = 0; Vx_polyface_mesh = 0; // normal vertex preceding face vertex has 64 set and 128 set if (Pl_polyface_mesh == 1) then Vx_3D_polygon_mesh = 1; Vx_polyface_mesh = 1; end Vx_G70 = 32 * Vx_3D_Polyline + ... 64 * Vx_3D_polygon_mesh + ... 128 * Vx_polyface_mesh; Vx_layer = layer .* ones((M * N), 1); Vx_color = color .* ones((M * N), 1); Vx_G70_V = Vx_G70 .* ones((M * N), 1); Vx_handle = handle_offset + (1:(M * N))'; Vx_format = ' 0\nVERTEX\n' + ... // header ' 5\n%X\n' + ... // handle ' 8\n%u\n' + ... // layer ' 62\n%6i\n' + ... // colour ' 10\n%.17G\n' + ... // X ' 20\n%.17G\n' + ... // Y ' 30\n%.17G\n' + ... // Z ' 70\n%6u\n'; // Group 70 flag mfprintf(fid, Vx_format, Vx_handle, Vx_layer, Vx_color, X, Y, Z, Vx_G70_V); if (Pl_polyface_mesh == 1) then // face vertex has 128 set and 64 not set Vx_3D_Polyline = 0; Vx_3D_polygon_mesh = 0; Vx_polyface_mesh = 1; Vx_G70 = 32 * Vx_3D_Polyline + ... 64 * Vx_3D_polygon_mesh + ... 128 * Vx_polyface_mesh; Vx_G7n = mini(Vx_handle) + (1:(M-1)*(N-1))'; Vx_face_format = ' 0\nVERTEX\n' + ... // header ' 5\n%X\n' + ... // Vxf_handle ' 8\n%u\n' + ... // layer ' 62\n%6i\n' + ... // colour ' 10\n0.0\n' + ... // X (always zero for face vertex) ' 20\n0.0\n' + ... // Y (always zero for face vertex) ' 30\n0.0\n' + ... // Z (always zero for face vertex) ' 71\n%6i\n' + ... // 1st associated vertex ' 72\n%6i\n' + ... // 2nd vertex ' 73\n%6i\n' + ... // 3rd vertex ' 74\n%6i\n' + ... // 4th vertex ' 70\n%6u\n'; //Group 70 flag Vx_layer = layer .* ones((M-1)*(N-1),1); Vx_color = color .* ones((M-1)*(N-1),1); Vx_ref = matrix(1:(M*N),M,N); Vx_TLC = matrix(Vx_ref(1:(M-1),1:(N-1)),-1,1); // Top Left Corner Vx_TRC = matrix(Vx_ref(2:M,1:(N-1)),-1,1); Vx_BLC = matrix(Vx_ref(1:(M-1),2:N),-1,1); Vx_BRC = matrix(Vx_ref(2:M,2:N),-1,1); if ~(boolgrep(DXF_flags,'tessa')) then // default polyfaces Vx_handle = max(Vx_handle) + (1:(M-1)*(N-1))';//Vx_G7n; Vx_G70_V = Vx_G70 .* ones(((M-1)*(N-1)), 1); mfprintf(fid, Vx_face_format, Vx_handle, Vx_layer, Vx_color, ... Vx_TLC, ... Vx_TRC, ... Vx_BRC, ... Vx_BLC, ... Vx_G70_V); else // tessa: arrange polyfaces as triangles // given arrays are for triangles and dummy 4th // point must be generated, note 3rd vertex invisible (-ve) // this is a 'backslash' arrangement Vx_handle = max(Vx_handle) + (1:(2*(M-1)*(N-1)))'; Vx_handle = matrix(Vx_handle,2,-1)'; Vx_G70_V = Vx_G70 .* ones((2*(M-1)*(N-1)), 1); // note this is not in sequential order to handle reference mfprintf(fid, Vx_face_format, Vx_handle(:,1), Vx_layer, Vx_color, ... Vx_TLC, ... Vx_TRC, ... -Vx_BRC, ... Vx_BRC, ... Vx_G70_V); mfprintf(fid, Vx_face_format, Vx_handle(:,2), Vx_layer, Vx_color, ... Vx_TLC, ... Vx_BLC, ... -Vx_BRC, ... Vx_BRC, ... Vx_G70_V); end end // Add SEQEND mfprintf(fid,' 0\nSEQEND\n 5\n%X\n 8\n%u\n 62\n%6i\n', max(Vx_handle) + 1, layer, color); end //Entities section end followed by File end mfprintf(fid,' 0\nENDSEC\n 0\nEOF'); mclose(fid); endfunction // The intended use of this macro is to export entities to a // CAD environment, where graphical formatting and annotation // may be performed // // All input/output should comprise discrete points // Any function type representations, e.g. circle, spline etc // should be processed within the relevant program and // then passed as arrays of discrete points // This is to avoid attempting to match function definitions // // Spline & curve options are avoided as the intention is to generate // exportable discrete points, there are superior options within both // environments // // Text should be left to the CAD program // // The units represented are not a distinct field from the SciLab-Matlab end // Allow the CAD program to ascribe imperial, metric, Angstrom whatever.. // // To reduce confusion/code, the macro will deal exclusively with entities // that are expressed in 'world coordinates' (no Group codes 50,210,220,230) // This also corresponds with entities defined by a set of discrete points // within CAD DXF spec: // // Entities Notes // // Line, Point, 3DFace, 3D These entities do not lie in a // Polyline, 3d vertex, 3D particular plane. All points are // Mesh, 3D Mesh vertex expressed in World coordinates. Of // these entities, only Lines and // Points can be extruded; their // extrusion direction can differ from // the World Z axis // // Although the R12/LT2 DXF format makes provision for splines, // splines passed in R12/LT2 DXF format may well be resaved as polylines // The difference between AutoSketch and AutoCad 2000 is the number // of discrete vertices added. // // Entities defined in model space by default (no Group code 67) // No elevation instead of Z-field (no Group code 38) // Thickness ignored (no Group code 39,40,41) // No Linetype name (no Group code 6) // Easier to use a 2 point polyline than define a line entity // // LINE 10, 20, 30 (start point), 11, 21, 31 (endpoint). // // POINT 10, 20, 30 (point). // // POLYLINE 66 (vertices-follow flag), // 10, 20, 30 (polyline elevation-30 supplies elevation, 10 and 20 are always set to zero), // 70 (Polyline flag -optional 0), // 40 (default starting width -optional 0), // 41 (default ending width -optional 0), // 71 and 72 (polygon mesh M and N vertex counts -optional 0), // 73 and 74 (smooth surface M and N densities -optional 0), // 75 (curves and smooth surface type -optional 0). // // The default widths apply to any vertex that doesn't supply widths // (see later). // // The "vertices follow" flag is always 1, indicating that // a series of Vertex entities is expected to follow the // Polyline, terminated by a sequence end (Seqend) entity. // The polyline flag (group code 70) is a bit-coded field // with bits defined as follows: // // Group 70 bit codes for Polyline entity // // Flag bit value Meaning // // 1 This is a closed Polyline (or a polygon mesh // closed in the M direction) // 2 Curve-fit vertices have been added // 4 Spline-fit vertices have been added // 8 This is a 3D Polyline // 16 This is a 3D polygon mesh. // // Group 75 indicates the smooth surface type as follows: // // 0 = no smooth surface fitted // 5 = quadratic B-spline surface // 6 = cubic B-spline surface // 8 = Bezier surface // // 32 The polygon mesh is closed in the N direction // 64 This Polyline is a polyface mesh // 128 The linetype pattern is generated continuously // around the vertices of this Polyline // // A polyface mesh is represented in DXF as a variant of a // Polyline entity. The Polyline header is identified as // introducing a polyface mesh by the presence of the 64 // bit in the Polyline flags (70) group. The 71 group // specifies the number of vertices in the mesh, and the // 72 group, the number of faces. While these counts are // correct for all meshes created with the PFACE command, // applications are not required to place correct values // in these fields, and AutoCAD actually never relies upon // their accuracy. // // Following the Polyline header is a sequence of Vertex // entities that specify the vertex coordinates and faces // that compose the mesh. Vertices such as these are // described in the following subsection on Vertex. // // Applications might want to represent polygons with an // arbitrarily large number of sides in polyface meshes. // However, the AutoCAD entity structure imposes a limit // on the number of vertices that a given face entity can // specify. You can represent more complex polygons by // decomposing them into triangular wedges. Their edges // should be made invisible to prevent visible artifacts // of this subdivision from being drawn. The PFACE command // performs this subdivision automatically, but when // applications generate polyface meshes directly, the // applications must do this themselves. // // The number of vertices per face is the key parameter in // this subdivision process. The PFACEVMAX system variable // provides an application with the number of vertices per // face entity. This value is read-only, and is set to 4. // // Polyface meshes created with the PFACE command are // always generated with all the vertex coordinate // entities first, followed by the face definition // entities. The code within AutoCAD that processes // polyface meshes does not, at present, require this // ordering; it works even with interleaved vertex // coordinates and face definitions as long as no face // specifies a vertex with an index that appears after it // in the database. Programs that read polyface meshes // from DXF would be wise to be as tolerant of odd vertex // and face ordering as AutoCAD is. // // VERTEX 10, 20, 30 (location), // 40 (starting width -optional, see earlier), // 41 (ending width -optional, see above), // 42 (bulge -optional 0), // 70 (vertex flags -optional 0), // 50 (curve fit tangent direction optional). // // The bulge is the tangent of 1/4 the included angle for an arc segment, // made negative if the arc goes clockwise from the start point to the endpoint; // a bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle. // The meaning of the bit-coded Vertex flag (group code 70) is shown in the following table // // Group 70 bit codes for Vertex entity // // Flag bit value Meaning // // 1 Extra vertex created by curve-fitting // 2 Curve-fit tangent defined for this vertex. A // curve-fit tangent direction of 0 may be // omitted from the DXF output, but is // significant if this bit is set // 4 Unused (never set in DXF files) // 8 Spline vertex created by spline-fitting // 16 Spline frame control point // 32 3D Polyline vertex // 64 3D polygon mesh vertex // 128 Polyface mesh vertex // // Every Vertex that is part of a polyface mesh has the // 128 bit set in its Vertex flags (70) group. If the // entity specifies the coordinates of a vertex of the // mesh, the 64 bit is set as well and the 10, 20, and 30 // groups give the vertex coordinates. The vertex indexes // are determined by the order in which the Vertex // entities appear within the Polyline, with the first // numbered 1. // // If the Vertex defines a face of the mesh, its Vertex // flags (70) group has the 128 bit set but not the 64 // bit. The 10, 20, and 30 (location) groups of the face // entity are irrelevant and are always written as zero in // a DXF file. The vertex indexes that define the mesh are // given by 71, 72, 73, and 74 groups, the values of which // are integers specifying one of the previously defined // vertices by index. If the index is negative, the edge // that begins with that vertex is invisible. The first // zero vertex marks the end of the vertices of the face. // Since the 71 through 74 groups are optional fields with // default values of zero, they are present in DXF only if // nonzero. // // SEQEND No fields. This entity marks the end of vertices // (Vertex type name) for a Polyline, or the end of // Attribute entities (Attrib type name) for an Insert // entity that has Attributes (indicated by 66 group // present and nonzero in Insert entity). // // 3DFACE Four points defining the corners of the face: // (10, 20, 30), // (11, 21, 31), // (12, 22, 32), // (13, 23, 33). // 70 (invisible edge flags optional 0) // // If only three points are entered (forming a triangular face), // the third and fourth points will be the same. // The meanings of the bit-coded "Invisible edge flags" are shown in the // following table: // // Group 70 bit codes for 3D Face entity // Flag bit value Meaning // // 1 First edge is invisible // 2 Second edge is invisible // 4 Third edge is invisible // 8 Fourth edge is invisible // //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //Test Vars //EL = -%pi/2:%pi/(2*9):%pi/2; //AZ = 0:(2*%pi)/35:2*%pi; //R_m = ones(max(size(EL)),max(size(AZ)));EL_m = R_m;AZ_m = R_m; //for r = 1:max(size(EL)) do EL_m(r,:) = EL_m(r,:).*EL(r);end //for c = 1:max(size(AZ)) do AZ_m(:,c) = AZ_m(:,c).*AZ(c);end //Z = R_m .* sin(EL_m); //X = R_m .* cos(EL_m) .* cos(AZ_m); //Y = R_m .* cos(EL_m) .* sin(AZ_m); //writeR12DXF("spheretest",X,Y,Z,"color=6") //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>