How to add text in a box

<< Click to Display Table of Contents >>

Navigation:  How To >

How to add text in a box

Sometimes it is needed to mark up the drawing with text. Let us see how to create text in a box:


The following code example creates a rectangle, hatches inside it and adds the text.

<?xml version="1.0" encoding="UTF-8"?>
   <!-- Description: Example show how to create text in a box and how to use list of handles. -->
<cadsofttools version="2.0">
 <!-- Create simple rectangular Solid Hatch. Handle of polyline is saved as "@1" -->
   <cstLWPolyline HandleSave="@1">    
   <cstVertex Point="0,0,0"/>      
   <cstVertex Point="2,0,0"/>
   <cstVertex Point="2,1,0"/>
   <cstVertex Point="0,1,0"/>
   <cstVertex Point="0,0,0"/>      
   <!-- Select polyline -->
 <Select Handle="@1"/>    
   <!-- Create hatch -->
   <!-- Set red color, it's index is 1 -->
 <apply Color="0;1;"/>
   <!-- Create text in box -->
   <cstMText Point="0.2,0.6" Height="0.2" TextValue="Text in a box" HandleSave="@2"/>
   <!-- Handles can be accepted as a list with ";" separator -->
 <UnSelect Handle="@1;@2;$24"/>        

Go to CADEditorX