Erase() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns an object created by erasing part of another object. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Erase( source_object, eraser_object )

source_object is an object, part of which is to be erased; cannot be a point or text object.

eraser_object is a closed object, representing the area that will be erased.

Return Value

Returns an object representing what remains of source_object after erasing eraser_object.

Description

The Erase() function erases part of an object, and returns an object expression representing what remains of the object.

The source_object parameter can be a linear object (line, polyline, or arc) or a closed object (region, rectangle, rounded rectangle, or ellipse), but cannot be a point object or text object. The eraser_object must be a closed object. The object returned retains the color and pattern styles of the source_object.

Example

' In this example, o1 and o2 are Object variables 
' that already contain Object expressions. 
If o1 Intersects o2 Then 
	If o1 Entirely Within o2 Then 
		Note "Cannot Erase; nothing would remain." 
	Else 
		o3 = Erase( o1, o2 ) 
	End If 
Else 
	Note "Cannot Erase; objects do not intersect." 
End If 

See Also:

Objects Erase statement, Objects Intersect statement