Automatically Match a Given Object

Navigation:  Appendix > Advanced Topics > Advanced Tool Topics >

Automatically Match a Given Object

Previous pageReturn to chapter overviewNext page

When you create a custom tool, there may be a particular given object that you would like to always match to the same object in your sketch. Normally you must match that given object each time you use the tool, even though you’re matching it to the same object each time.

To save the trouble of clicking the object each time and to make the tool easier to use, you can specify that the given object should be automatically matched to the same sketch object each time the tool is used. For example, suppose you create a tool that constructs one segment on a Poincaré disk model of the hyperbolic plane. Such a tool might have three given objects: a circle defining the Poincaré disk and two points defining the segment’s endpoints. Since you’d like to use the same tool repeatedly to construct multiple segments on the same Poincaré disk, it’s inconvenient to have to match the given circle to the same Poincaré disk each time you use the tool. You can change your tool to automatically match this given circle to the appropriate circle in your sketch, resulting in a tool that requires you to match only two points each time you use it. Since the Poincaré disk circle is matched automatically, this tool will always create segments on the same Poincaré disk.

To match a given object automatically:

1.Open the Properties dialog box for the sketch object you want to match automatically. Use the Label panel to assign a distinctive label to the object.

2.Choose Show Script View from the Custom Tools menu to show the Script View for the tool containing the given object to be matched automatically.

3.Double-click the given object in the object list to open the Properties dialog box.

4.On the Label panel, assign the same label to the script object that you assigned to the sketch object.

5.Check the Automatically match sketch object checkbox and close the Properties dialog box.

When you use the tool, it will automatically match the tool’s given object to the sketch object with the same label. Provided the appropriate checkbox is checked in Label Properties, a tool containing a given point labeled Center will automatically match the point labeled Center in your sketch. If no object in the sketch has a matching label, the tool will require you to match the given object manually.

If all the given objects for a tool match automatically, the tool completes its construction as soon as you choose the tool. The active tool is then changed back to the Selection Arrow tool.

When a given object in a tool is set to match automatically, it appears in the Assuming section of the script view, rather than the Given section.

(If a new tool has a coordinate system as one of its given objects, the coordinate system is automatically placed in the Assuming section of the script view, and the checkbox in the Label Properties dialog panel is Automatically match marked coordinate system.)