About manipulating the text on hatches

A hatch definition may or may not be labeled. When labeled, you have control over things such as the text symbol that is used and whether the text will automatically be flipped as the direction of the route changes.

By default, the text associated with a hatch is the route measure at the hatch location. This text can be supplemented with a prefix and/or suffix value.

For more advanced needs, you can programmatically generate a hatch's text by writing a script in Microsoft VBScript or JavaScript. Your script can include any valid statements those programming languages support.

When writing a script, you access the route measure for each hatch using the esri_measure constant value.

The following script, which could be used in step 10 of How to generate the text on hatches using a script, tells the hatching algorithm to not label a hatch if its measure value is within 0.1 measure units of the value stored in a field named MMAX. This method can be used instead of an end hatch tolerance that tells the hatch algorithm not to draw either the hatch or its label.

Function FindLabel (esri__measure, [MMAX]) 
	mmax = [MMAX] 
	m = esri__measure 
	if (mmax - m) <= 0.1 then 
	  FindLabel = "" 
	else
	  FindLabel = cstr(round(m,2)) 
	end if 
End Function

For more information on VBScript and/or JavaScript, click the Help button on the Hatch Text Expression dialog box.

Related Topics

3/3/2014