4D v13

SVG_New_regular_polygon

Home

 
4D v13
SVG_New_regular_polygon

SVG_New_regular_polygon 


 

SVG_New_regular_polygon ( parentSVGObject ; width ; number {; x {; y {; foregroundColor {; backgroundColor {; strokeWidth}}}}} ) -> Function result 
Parameter Type   Description
parentSVGObject  SVG_Ref in Reference of parent element
width  Longint in Diameter of surrounding circle
number  Longint in Number of sides
Longint in Coordinate on center X axis
Longint in Coordinate on center Y axis
foregroundColor  String in Color or gradient name
backgroundColor  String in Color or gradient name
strokeWidth  Real in Line thickness
Function result  SVG_Ref in Reference of polygon

The SVG_New_regular_polygon command draws a regular polygon with number of sides fit into a circle with a diameter of width in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.

The optional x and y parameters can be used to specify the center of the circle. If they are omitted, the figure will be drawn in the upper left corner of the document.

The optional foregroundColor and backgroundColor parameters contain, respectively, the name of the line color and of the background color. (For more information about colors, please refer to the commands of the Colors and Gradients theme).

The optional strokeWidth parameter contains the size of the pen expressed in pixels. Its default value is 1.

Draw a pentagon (default fill and border color, default line thickness):

 svgRef:=SVG_New
 objectRef:=SVG_New_regular_polygon(svgRef;100;5)

Draw an octogon, the circle containing it and the trace lines:

 svgRef:=SVG_New
 $width:=200
 $sides:=8
 objectRef:=SVG_New_regular_polygon(svgRef;$width;$sides;0;0;"crimson";"palevioletred";2)
 
 $radius:=$width/2
 objectRef:=SVG_New_rect(svgRef;0;0;$width;$width;0;0;"blue";"none")
 objectRef:=SVG_New_line(svgRef;0;$radius;$width;$radius;"blue")
 objectRef:=SVG_New_line(svgRef;$radius;0;$radius;$width;"blue")
 objectRef:=SVG_New_line(svgRef;0;0;$width;$width;"blue")
 objectRef:=SVG_New_line(svgRef;$width;0;0;$width;"blue")
 objectRef:=SVG_New_circle(svgRef;$radius;$radius;$radius;"blue";"none")

 
PROPERTIES 

Product: 4D
Theme: Drawing
Number: 65974

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: Composant 4D SVG v11.4

 
SEE ALSO 

SVG_New_polygon