Polygon
Create curve or solid polygon consisting of line segments in 2D or 3D.
Syntax
model.component(<ctag>).geom(<tag>).create(<ftag>,"Polygon");
model.component(<ctag>).geom(<tag>).feature(<ftag>).set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).getType(property);
Description
Use model.component(<ctag>).geom(<tag>).create(<ftag>,"Polygon") to create a polygon or a line segment. The following properties are available
none | custom | integer between 1 and the number of colors in the current theme
The color to use. Active when color is set to custom.
If source is file, the file that contains the vertex coordinates.
on | off
all | obj | dom | bnd | edg | pnt | off
dom in 2D; edg in 3D.
Show selections, if selresult is on, in physics, materials, and so on; in part instances; or in 3D from a plane geometry. obj is not available in a component’s geometry. dom, bnd, and edg are not available in all features.
table | file | vectors
The vertex coordinates when source is table, size N*sdim.
solid | open | closed
solid (2D)
open (3D)
Object type. solid is not available in 3D.
this | Part Instance feature
xyplane | Work plane feature
If type is open or closed, a curve consisting of line segments is constructed. If type is solid, the solid enclosed by such a closed polygon is constructed. If type is closed or solid, but the first and last control points are different, an extra segment is added to close the curve.
Use model.component(<ctag>).geom(<tag>).feature(<ftag>).importToTable() to read data from the file defined by the filename property and store the data in the table property. The source property is also changed to table.
If source is file, the polygon is not automatically rebuilt when the data in the file changes. Use model.component(<ctag>).geom(<tag>).feature(<ftag>).importData() to rebuild the polygon after such a change.
For information about the selresult and contributeto properties, see Selections of Geometric Entities.
Compatibility
model.component(<ctag>).geom(<tag>).create(<ftag>,"line1") constructs an open polygon.
model.component(<ctag>).geom(<tag>).create(<ftag>,"poly1") constructs a closed polygon.
model.component(<ctag>).geom(<tag>).create(<ftag>,"line2") or model.component(<ctag>).geom(<tag>).create(<ftag>,"poly2") constructs a solid polygon.
Example
Construct a solid triangle pol1:
Code for Use with Java
Model model = ModelUtil.create("Model1");
model.component().create("comp1");
GeomSequence g = model.component("comp1").geom().create("geom1",2);
g.create("pol1","Polygon");
g.feature("pol1").set("x","0,0,2").set("y","1,0,0");
g.run();
Code for Use with MATLAB
model = ModelUtil.create('Model1');
model.component.create('comp1');
g = model.component('comp1').geom.create('geom1',2);
g.create('pol1','Polygon');
g.feature('pol1').set('x','0,0,2').set('y','1,0,0');
g.run;
See Also
CubicBezier, QuadraticBezier