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:

clip0022

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" -->
 <add>
   <cstLWPolyline HandleSave="@1">    
   <SubEntities>                
   <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"/>      
   </SubEntities>
   </cstLWPolyline>
 </add>
   <!-- Select polyline -->
 <Select Handle="@1"/>    
   <!-- Create hatch -->
 <createhatch/>
   <!-- Set red color, it's index is 1 -->
 <apply Color="0;1;"/>
 
<add>  
   <!-- Create text in box -->
   <cstMText Point="0.2,0.6" Height="0.2" TextValue="Text in a box" HandleSave="@2"/>
</add>                      
 <ShowSelectedEntities/>
   <!-- Handles can be accepted as a list with ";" separator -->
 <UnSelect Handle="@1;@2;$24"/>        
</cadsofttools>

Go to CADEditorX