Vous êtes sur la page 1sur 35

# 5/17/2014

ECE5390SpecialTopics:
21st CenturyElectromagnetics
Instructor:
Office:
Phone:
EMail:

Dr.Raymond C.Rumpf
A337
(915)7476958
rcrumpf@utep.edu

Spring2014

Lecture #19

## Synthesizing Geometries for

21st Century Electromagnetics
Lecture 19

Lecture Outline

## Text files in MATLAB

String manipulation in MATLAB
STL files
STL files in MATLAB
Visualizing surface meshes in MATLAB
Generating faces and vertices using MATLAB
Converting surfaces meshes from objects on a 3D
grid
Point clouds
Importing custom polygons into SolidWorks
Lecture19

Slide2

5/17/2014

Writing Text Files
in MATLAB

## Opening and Closing Files

% OPEN ASCII STL FILE
fid = fopen(pyramid.STL,'r');
if fid==-1
error('Error opening file.');
end

## %r is read-only for safety

Usewtowritefiles.

AfileisclosedinMATLABwiththefollowingcommand.
% CLOSE FILE
fclose(fid);

Openandclosingthefileisalwaysthefirstandlastthingyoudo.
WARNING!Alwayscloseopenfiles!
Lecture19

5/17/2014

## Reading a Line from the Text

File
% READ A LINE OF TEXT
L = fgetl(fid);

% READ AND DISPLAY AN ENTIRE TEXT FILE
while feof(fid)==0
% Get Next Line from File
L = fgetl(fid);
% Display the Line of Text
disp(L);
end

Lecture19

## Writing a Line to the Text File

Alineoftextiswrittentothetextfileusingfprintf().
% WRITE A LINE OF TEXT
fprintf(fid,solid pyramid\r\n);

Thiswritessolid pyramidtothefile
followedbycarriagelinereturn.

Numberscanalsobewrittentothefile.
% Write Facet Normal to File
N = [ 1.234567 68.76543 1.592745 ];
L = '
facet normal %8.6f %8.6f %8.6f\r\n';
fprintf(fid,L,N);

Thiswrites
facet normal 1.234567e0 6.876543e1 1.592745e0to
thefilefollowedbycarriagelinereturn.

Lecture19

5/17/2014

## ANSI Formatting -- Summary

ESCAPECHARACTERS

CONVERSIONCHARACTERS

ValueType

Formostcases,\nissufficientfora
singlelinebreak.
However,ifyouarecreatingafile
forusewithMicrosoft
\r\ntomovetoanewline.

Conversion

Details

Integer,signed

%dor%i

Base10values

Integer,unsigned

%u

Base10

Floatingpointnumber

%f

Fixedpointnotation

%e

Exponentialnotation,suchas
3.141593e+00

%E

Sameas%e,butuppercase,suchas
3.141593E+00

%g

Themorecompactof%eor%f,withno
trailingzeros

%G

Themorecompactof%Eor%f,withno
trailingzeros

%c

Singlecharacter

%s

Stringofcharacters

Characters

Lecture19

Characters

Lecture19

5/17/2014

## ANSI Formatting Flags

Action

Flag

Example

Leftjustify.

''

%-5.2f

Printsigncharacter(+ or).

'+'

%+5.2f

Insertaspacebeforethevalue.

' '

% 5.2f

'0'

%05.2f

Modifyselectednumericconversions: '#'
For%o,%x,or%X,print0,0x,or
0X prefix.
For%f,%e,or%E,printdecimal
pointevenwhenprecisionis0.
For%g or%G,donotremove
trailingzerosordecimalpoint.

%#5.0f

Lecture19

String
Manipulation in
MATLAB

5/17/2014

Parsing Strings
Alineoftextcanbeparsedintoseparatewordsusingsscanf().
S = 'Hello Class';
T = sscanf(S,'%s %s');

T =
HelloClass

S = 'Hello Class';
T = sscanf(S,'%*s %s');

T =
Class

skipstring

Youcanalsoextractnumbersfromastringusingsscanf().
S = 'I am 25 years old and 6 feet tall.';
N = sscanf(S,'%*s %*s %f %*s %*s %*s %f %*s %*s');

N =

Lecture19

25
6

11

## Checking for Specific Words in

Strings (1 of 3)
Youcanperformanexactcomparisonbetweentwostrings
usingstrcmp().
s1 = 'cat';
s2 = 'dog';
c = strcmp(s1,s2);
s1 = 'cat';
s2 = 'Cat';
c = strcmp(s1,s2);
s1 = 'cat';
s2 = 'cat';
c = strcmp(s1,s2);

Lecture19

c =
0

c =
0

c =
1

12

5/17/2014

## Checking for Specific Words in

Strings (2 of 3)
Youcandothesamecamparison,butcaseinsensitive
usingstrcmpi().
s1 = 'cat';
s2 = 'dog';
c = strcmpi(s1,s2);
s1 = 'cat';
s2 = 'Cat';
c = strcmpi(s1,s2);
s1 = 'cat';
s2 = 'cat';
c = strcmpi(s1,s2);

c =
0

c =
1

c =
1

Lecture19

13

## Checking for Specific Words in

Strings (3 of 3)
Youcanfindtheoccurrenceofonestringinsideanother
usingstrfind().
s1 = 'University of Texas at El Paso';
s2 = 'Hawaii';
ind = strfind(s1,s2);

## s1 = 'University of Texas at El Paso';

s2 = 'Texas';
ind = strfind(s1,s2);

Lecture19

ind =
[]

ind =
15

14

5/17/2014

## Converting Between Strings and

Numbers
Youcanconvertastringtoanumberusingstr2num().
S = '534';
N = str2num(S);

N =
534

S = '2.74E-10';
N = str2num(S);

N =
2.74E-10

Similarly,youcanconvertnumberstostringsusingnum2str().
N = 1234;
S = num2str(N);

S =
1234

N = 1.23456789;
S = num2str(N);

S =
1.2346

N = 1.23456789;
S = num2str(N,'%1.6f');

S =
1.234568

Lecture19

15

STL Files

5/17/2014

## What is an STL File?

STL Standard Tessellation Language
This file format is widely used in rapid prototyping. It
contains only a triangular mesh of an objects surface.
Color, texture, materials, and other attributes are not
represented.
They can be text files or binary. Binary is more common
because they are more compact. We will look at text files
because that is more easily interfaced with MATLAB.

Lecture19

Slide17

Surface Mesh
Despitethisspherereallybeingasolidobject,itisrepresentedinan
STLfilebyjustitssurface.

SolidObject

STLRepresentation

Lecture19

18

5/17/2014

## STL File Format

solid name
facet normal nx ny nz
outer loop
vertex vx,1 vy,1 vz,1
vertex vx,2 vy,2 vz,2
vertex vx,3 vy,3 vz,3
endloop
endfacet

Thissetoftextisrepeatedforeverytriangleonthe
surfaceoftheobject.

v v v3 v1
n 2 1

v2 v1 v3 v1

endsolid name

v2

v1

v3

Bold face indicates a keyword; these must appear in lower case. Note that there is a space in facet normal and in
outer loop, while there is no space in any of the keywords beginning with end. Indentation must be with spaces;
tabs are not allowed. The notation, {}+, means that the contents of the brace brackets can be repeated one or
more times. Symbols in italics are variables which are to be replaced with user-specified values. The numerical data
in the facet normal and vertex lines are single precision floats, for example, 1.23456E+789. A facet normal
coordinate may have a leading minus sign; a vertex coordinate may not.
Lecture19

19

## Example STL File

solid pyramid
facet normal -8.281842e-001 2.923717e-001 -4.781524e-001
outer loop
vertex 4.323172e-018 1.632799e-017 6.495190e-001
vertex 3.750000e-001 7.081604e-001 4.330127e-001
vertex 3.750000e-001 0.000000e+000 0.000000e+000
endloop
endfacet
facet normal 0.000000e+000 2.923717e-001 9.563048e-001
outer loop
vertex 7.500000e-001 0.000000e+000 6.495190e-001
vertex 3.750000e-001 7.081604e-001 4.330127e-001
vertex 0.000000e+000 0.000000e+000 6.495190e-001
endloop
endfacet
facet normal 8.281842e-001 2.923717e-001 -4.781524e-001
outer loop
vertex 3.750000e-001 -1.632799e-017 0.000000e+000
vertex 3.750000e-001 7.081604e-001 4.330127e-001
vertex 7.500000e-001 0.000000e+000 6.495190e-001
endloop
endfacet
facet normal 0.000000e+000 -1.000000e+000 0.000000e+000
outer loop
vertex 3.750000e-001 0.000000e+000 0.000000e+000
vertex 7.500000e-001 0.000000e+000 6.495190e-001
vertex 0.000000e+000 0.000000e+000 6.495190e-001
endloop
endfacet
endsolid pyramid

Lecture19

AnSTLfileisessentiallyjusta
listofallthetrianglesonthe
surfaceofanobject.
Eachtriangleisdefinedwitha
surfacenormalandthe
positionofthethreevertices.
Slide20

10

5/17/2014

A Single Triangle
facet normal -8.281842e-001 2.923717e-001 -4.781524e-001
outer loop
vertex 4.323172e-018 1.632799e-017 6.495190e-001
vertex 3.750000e-001 7.081604e-001 4.330127e-001
vertex 3.750000e-001 0.000000e+000 0.000000e+000
endloop
endfacet

1. Facetnormalmustfollowrighthand
ruleandpointoutwardfromobject.
a) Someprogramssetthisto[0;0;0]
b) Dontdependonit!
commonvertices.
3. STLfilesappeartobesetuptohandle
arbitrarypolygons.Dontdothis.

Vertex3

FacetNormal

Vertex1

Lecture19

Vertex2

Slide21

Since the facet normal can be calculated from the
vertices using the right-hand rule, sometimes the
facet normal in the STL file contains other
Dont depend on the right-hand rule being
followed.
Basically, dont depend on anything!

Lecture19

22

11

5/17/2014

STL Files in
MATLAB

## How to Store the Data

WehaveN facetsand 3N verticestostoreinarrays.
F(N,3) Array of triangle facets
V(?,3) Array of triangle vertices
Manytimes,thenumberofverticesis3N.Observingthatmanyof
thetrianglefacetssharevertices,therewillberedundantvertices

Lecture19

24

12

5/17/2014

## Lazy Array of Vertices (1 of 2)

vx ,1
v
x ,2
V

vx , M

v y ,1
v y ,2

vy ,M

vz ,1
vz ,2

vz , M

V isanarray
containingthe
positionofallthe
verticesinCartesian
coordinates.

5
8
2

M isthetotal
numberof
1
vertices.

7
11

3
12

10

Lecture19

25

## Lazy Array of Vertices (2 of 2)

Thereisredundancyhere.Twelveverticesarestored,butthedevice
isreallyonlycomposedoffour.
Whileaninefficientrepresentation,
thisisprobablynotworthyourtimefixing.

2,5,8

SolidWorks exportsalazyarrayofvertices.

vx ,1
v
x ,2
V

vx , M
Lecture19

v y ,1
v y ,2

vy ,M

vz ,1
vz ,2

vz , M

4,9,11
1,6,12
3,7,10
26

13

5/17/2014

## Compact Array of Vertices

vx ,1
v
x ,2
V
vx ,3

vx ,4

vz ,1
vz ,2
vz ,3

vz ,4

v y ,1
v y ,2
v y ,3
v y ,4

2
2
2
2

ArrayofVertices,V

4
4
3

3
4

3
1

Lecture19

27

Array of Faces
n1,1
n
2,1
F

nN ,1

n1,2
n2,2

nN ,2

n1,3
n2,3

nN ,3

F isanarray
indicatingthearray
indicesofthe
verticesdefining
thefacet.

5
allintegers

8
2

9
4

N isthetotal
numberof
faces.
Lecture19

3
11

3
12

10

28

14

5/17/2014

2,5,8

4,9,11
1,6,12
3,7,10

Lecture19

29

## Example of Compact Arrays

2

4
1
3
Thiscanmakeaverylargedifferenceforlargeandcomplexobjects.

Lecture19

30

15

5/17/2014

## How to Read an STL File Into

MATLAB
2. Read first line and store object name if needed.
a. Read the facet normal. You probably dont need this, and you can ignore it.
b. Skip outer loop line
f. Skip endloop line
g. Skip endfacet line
h. Add vertices to V array.
i. Add facet to F array.
4. If another facet exists, go back to Step 3.
5. Skip endsolid line
6. Close the file.
7. If desired, eliminate redundant vertices.

Lecture19

31

## How to Write an STL File From

MATLAB
1. Open a new text file.
2. Add first line, solid name.
Seenextslide.
3. For each triangle facet, repeat the following steps

a. Determine the vertices of the facet v1 , v2 , v3
b. Calculate the facet normal (nx,ny,nz) using the right-hand rule.
c. Write line facet normal nx ny nz
d. Write line outer loop
e. Write vertex vx,1 vy,1 vz,1
Besuretoputtheseintheorderthatfollowsthe
f. Write vertex vx,2 vy,2 vz,2
righthandrule!
g. Write vertex vx,3 vy,3 vz,3
h. Write line endloop
i. Write line endfacet
4. If another facet exists, go back to Step 3.
5. Write line endsolid name
6. Close the file.

Lecture19

32

16

5/17/2014

## Reconciling the Surface Normal

for Objects on a Grid

Constructanobjectonagrid.

Generateasurfacemeshoftheobject.

surface
normal

Blurtheobjectonthegrid.

Thesurfacenormalshouldpointinthe

Lecture19

33

## STL Files Generated by

SolidWorks
Forsomereason,Solidworks doesnotusethezaxisasthevertical
axis.
Forconvenience,STLfilescanbeeasilyreoriented.
% REORIENT SOLIDWORKS AXES TO MATLAB AXES
Y
= V(:,2);
V(:,2) = V(:,3);
V(:,3) = Y;

OrientationinSolidWorks
Lecture19

ImportedOrientation

34

17

5/17/2014

Visualizing
Surface Meshes
in MATLAB

## How to Draw the Object

Giventhefacesandvertices,theobjectcanbedrawninMATLAB
usingthepatch() command.
% DRAW STRUCTURE USING PATCHES
P = patch('faces',F,'vertices',V);
set(P,'FaceColor','b','FaceAlpha',0.5);
set(P,'EdgeColor','k','LineWidth',2);

Lecture19

36

18

5/17/2014

Generating
Faces and
Vertices Using
MATLAB

MATLAB Surfaces
SurfacescomposedofsquarefacetsarestoredinX,Y,andZ arrays.
Thesurfaceshownisconstructed
ofarraysthatareall55.

Lecture19

38

19

5/17/2014

## Direct Construction of the

Surface Mesh
MATLABhasanumberofbuiltincommandsforgeneratingsurfaces.
Someofthesearecylinder(),sphere() andellipsoid().
% CREATE A UNIT SPHERE
[X,Y,Z] = sphere(41);

Surfacescanbeconvertedtotriangularpatches(facetsandvertices)
usingthesurf2patch() function.
% CONVERT TO PATCH
[F,V] = surf2patch(X,Y,Z,triangles);

Thefacesandverticescanbedirectlyvisualizedusingthepatch()
function.
% VISUALIZE FACES AND VERTICES
h = patch('faces',F,'vertices',V);
set(h,'FaceColor',[0.5 0.5 0.8],'EdgeColor','k');
Lecture19

39

## Grid Surface Mesh

3Dobjectsonagridcanbeconvertedtoasurfacemeshusingthe
commandisosurface().
% CREATE ELLIPTICAL OBJECT
OBJ = (X/rx).^2 + (Y/ry).^2 + (Z/rz).^2;
OBJ = (OBJ < 1);
% CREATE SURFACE MESH
[F,V] = isosurface(X,Y,Z,OBJ,0.5);

Objecton3DGrid
Lecture19

SurfaceMesh
40

20

5/17/2014

## Combining Faces and Vertices

from Two Objects
TherearenofunctionsinMATLABtoperformBooleanoperationsonmultiple
meshes.Wecan,however,combinethefacesandverticesfromtwoobjects.Be
carefulthisdoesnotresultinoverlapsorgapsbetweenobjects.
F1 andV1

F2 andV2

Correctly
Combined

## % COMBINE FACES AND VERTICES

F3 = [ F1 ; F2+length(V1(:,1)) ]
V3 = [ V1 ; V2 ]

Incorrectly
Combined

% WRONG WAY TO
% COMBINE FACES AND VERTICES
F3 = [ F1 ; F2 ]
V3 = [ V1 ; V2 ]

Lecture19

41

Converting
Surface Meshes
to Objects on a
3D Grid

21

5/17/2014

## Math Relating to Planes

v1

Thefacetnormalcanbewrittenas

s Ax By Cz

v3

v2

s 1

Thefacetdefinesaplane.Thestandard
equationofaplanein3Dspaceis

Ax By Cz D 0

Theequationforplanecanbewritteninavectornotationas

s r D 0

r xx yy zz

r0
WecandetermineD givenanypointontheplane.

s r0 D 0

D s r0

Lecture19

43

## Our Equation for a Plane

UsingthenewexpressionforD,theequationoftheplanebecomes

s r D 0

s r s r0 0

s r r0 0

v1

v2

Lecture19

v3

44

22

5/17/2014

## Which Side of a Plane Does a

Point Reside?

Givensomepoint,whichsideoftheplanedoesthispointreside?
ri

s ri r0 0 Opposite side as the normal

s ri r0 0 On the plane

s ri r0 0 Same side as the normal
Proof
Pickapointthatisobviouslyonthesamesideasthenormal.

ri r0 s

v1

Substitutethisintotheequationofaplaneandcheckthesign.

s ri r0 ?

s r0 s r0 ?

v2

s s ?

v3

s s s 0
Lecture19

45

## Initialize the Algorithm (1 of 2)

Step1 Determinetheaxislimitsbylookingattheverticesdata.
% COMPUTE GRID LIMITS
xmin = min(V(:,1));
ymin = min(V(:,2));
zmin = min(V(:,3));

xmax = max(V(:,1));
ymax = max(V(:,2));
zmax = max(V(:,3));

Step2 Computethe3Dgridparameters.
% CALCULATE GRID
Sx = xmax - xmin;
Sy = ymax - ymin;
Sz = zmax - zmin;
Nx = 32;
Ny = round(Nx*Sy/Sx);
Nz = round(Nx*Sz/Sx);
xa = linspace(xmin,xmax,Nx);
ya = linspace(ymin,ymax,Ny);
za = linspace(zmin,zmax,Nz);

Lecture19

46

23

5/17/2014

## Initialize the Algorithm (2 of 2)

Step3 Computethecentersofthefacetsandthefacetnormals.
% COMPUTE FACET CENTERS AND NORMALS
FN = zeros(3,NF);
F0 = zeros(3,NF);
for nf = 1 : NF
% Calculate Vertices
v1 = [ V(F(nf,1),1) ; V(F(nf,1),2) ; V(F(nf,1),3) ];
v2 = [ V(F(nf,2),1) ; V(F(nf,2),2) ; V(F(nf,2),3) ];
v3 = [ V(F(nf,3),1) ; V(F(nf,3),2) ; V(F(nf,3),3) ];
% Calculate Facet Normal
p1 = v2 - v1;
p2 = v3 - v1;
knownifthedatawasimported
fn = cross(p2,p1);
fn = fn/norm(fn);
fromanSTLfile.
FN(:,nf) = fn;
% Calculate Position
F0(:,nf) = (v1 + v2 + v3)/3;
end

Lecture19

47

## Fill the Grid

Step4 Loopthroughthegrid,findtheclosestfacet,determine
whichsideofthefacetthepointison,andfillinifinsideobject.
% FILL GRID
ER = zeros(Nx,Ny,Nz);
for nz = 1 : Nz
for ny = 1 : Ny
for nx = 1 : Nx
% Get Point
p = [ xa(nx) ; ya(ny) ; za(nz) ];
% Find Closest Facet
dV = [ F0(1,:)-p(1) ; F0(2,:)-p(2) ; F0(3,:)-p(3) ];
dV = sum(abs(dV).^2);
[v,ind] = min(dV);
ind = ind(1);
% Add Point if Inside Object
a = dot(FN(:,ind),p-F0(:,ind));
ER(nx,ny,nz) = (a<=0);
end
end
end
Lecture19

48

24

5/17/2014

Example Pyramid

ER(nx,ny,nz)
SolidWorks Model

Lecture19

ImportSTLintoMATLAB

ConverttoVolumeObject

49

Example Dinosaur
ER(nx,ny,nz)

ImportSTLintoMATLAB
Lecture19

ConverttoVolumeObject
50

25

5/17/2014

Point Clouds

## What is a Point Cloud?

KleinBottle(seeMATLABdemos)

PointCloudDescriptionofaKleinBottle

PointcloudsrepresenttheoutsidesurfaceofobjectasasetofverticesdefinedbyX,Y,andZ
coordinates.Theyaretypicallygeneratedby3Dscanners,butcanalsobeusedtoexport3D
Lecture19

52

26

5/17/2014

Lecture19

53

## Point Cloud Data

Thepositionofallthepointsinthepoint
cloudcanbestoredinanarray.
x1
x
2
PC x3

xN
PC =
0.1200
0.1159
0.0311
0.0000
-0.0311
-0.0600

Lecture19

y1
y2
y3

yN

0.0000
-0.0311
-0.1159
-0.1200
-0.1159
-0.1039

z1
z2
z3

z N
0.7071
0.7071
0.7071
0.7071
0.7071
0.7071

54

27

5/17/2014

## Saving Point Cloud Data to File

(1 of 2)
Pointclouddatafilesarecommaseparated
textfileswiththeextension.xyz
Thesecanbeeasilygeneratedusingthe
builtinMATLABcommandcsvwrite().
% SAVE POINT CLOUD AS A COMMA SEPERATED FILE
PC = [ X Z Y ];
dlmwrite('pointcloud.xyz',PC,'delimiter',',','newline','pc');

PC = [ X Y Z ];

PC = [ X Z Y ];

Lecture19

55

## Saving Point Cloud Data to File

(2 of 2)
SolidWorkswantstoseeanXYZat
thestartofthefile.
MATLABtextfilecreator.

Lecture19

56

28

5/17/2014

SolidWorks
First,youwillneedtoactivatethe
ScanTo3DinSolidWorks.
ChecktheScanto3Dcheckbox.
ClickOK.

Lecture19

57

Lecture19

58

29

5/17/2014

## Run the Mesh Prep Wizard

ToolsScanTo3DMeshPrepWizard

Lecture19

1.
2.
3.
4.

RuntheMeshPrepWizard.
Selectthepointcloud.
Clicktherightarraybutton.
Orientationmethod,selectNone
becausewedidthisinMATLAB.
5. Noiseremoval,zeroassuming
geometrycamefromMATLAB.
6. Workthroughalloptions.
7. Clickthegreencheckmarktofinish.

59

Lecture19

60

30

5/17/2014

## Final Notes on Point Clouds

Other CAD packages have better point cloud
import capabilities than SolidWorks. Rhino 3D is
said to be excellent.
Generating a solid model from the data can be
done in SolidWorks. The meshed model is
essentially used as a template for creating the
solid model. This procedure is beyond the scope
of this lecture.

Lecture19

61

Importing
Custom
Polygons into
SolidWorks

31

5/17/2014

The Problem
Supposewecalculatetheverticesofapolygonfromanoptimization
inMATLAB.
Howdoweimportantthe
verticessothatthepolygon
canbeimportedexactlyinto
Solidworks sothatitcanbe
extruded,cut,modified,etc.?
Thereisnofeaturein
SolidWorks todothis!!

Lecture19

63

Example Application
PlacingaGMRfilteronto
acurvedsurface.

Gratingperiodisspatially
variedtocompensate.

sin x R
x
tan 1

R
1 d R cos x R
K x K 0 k0 ninc sin inc x

inc x

x K x dx
0

1
r x
r

cos x cos f
cos x cos f

R.C.Rumpf,M.Gates,C.L.Kozikowski,W.A.Davis,
"GuidedModeResonanceFilterCompensatedtoOperate
onaCurvedSurface,"PIERC,Vol.40,pp.93103,2013.

Lecture19

64

32

5/17/2014

## Be Careful About XYZ Curves

ThereisafeatureinSolidWorks CurveThroughXYZPointsthat
appearstoimportdiscretepoints,butitfitsthepointstoaspline.
Thiseffectivelyroundsanycornersandmayproduceintersections
thatcannotberendered.

Thisshouldbeasquare!

Thefourpointsarefittoaspline!

Lecture19

65

## Step 1 Define the Polygon

CreateanN3arrayinmemorycontainingtheallthepointsinthe
polygon.N isthenumberofpoints.
P =
0.6448
1.0941
1.3427
0.3642
0.4753
-0.0651
-0.5258
-0.4824
-0.8912
-0.9966
-0.9087
-1.0666
-1.1762
-0.5403
-0.1403
0.3818
0.7795
0.8293
1.0972
0.6448

Lecture19

0
0.3758
1.0452
0.5573
1.8765
0.7853
1.1984
0.5240
0.4822
0.1664
-0.1517
-0.5774
-1.2777
-1.2314
-1.6931
-1.5074
-1.1927
-0.6455
-0.3766
-0.0000

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

66

33

5/17/2014

## Step 2 Save as an IGES from

MATLAB
fromtheMathworks website.ThiswillsaveyourpolygontoanIGES
file.
% SAVE IGES FILE
igesout(P,'poly');

Thiscreatesafilecalledpoly.igsinyourworkingdirectory.

Lecture19

67

## Step 3 Open the IGES in

SolidWorks (1 of 2)
SelecttheIGESfiletypeinthe[Open]filedialog.Thenclickonthe
[Options]button.

Lecture19

68

34

5/17/2014

## Step 3 Open the IGES in

SolidWorks (2 of 2)
1. Makesurethat
Surface/solid
entitiesis
unchecked
2. EnsurethatFree
point/curveentities
ischecked.
3. ClickontheImport
button.

Openthefile.

Lecture19

69

## Step 4 Convert to a Standard

2D Sketch
Thepolygonimportsasa3Dsketchbydefault.
Editthe3Dsketchandcopy.
Openanew2Dsketchandpaste.
Nowyoucandowhateveryouwishwiththesketch!Extrude,
revolve,cutextrude,etc.

Lecture19

70

35