This sample uses the ConceptDraw Basic scripting language to draw basic ConceptDraw shapes. It creates a polygon made up of several connected segments. The procedure clears the active page of the document from all shapes on it. After that it draws a line segment with fixed coordinates of the begin and end points, then new segments are added to it. The coordinates of endpoints of new segments are chosen randomly. After a segment has been drawn, the user is asked whether to build another one. All segments in this sample belong to the same geometry, unlike in the DrawLines sample, where each segment creates a separate shape. This is achieved because the operations that draw segment are enclosed within one pair of BeginShape() - EndShape() functions. The DrawPolygon() procedure is located in the external module DrawPolygon.cdb and is called from a document-level script. If the "Enable ConceptDraw Basic script autorun" flag is not set in the Preferences dialog of ConceptDraw, the script can be run from the ConceptDraw Basic editor (Tools->ConceptDraw Basic->Document Script->Edit) from the Build->Run menu.