Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/get_object_count.html
Jump to: Description · Example · Bugs · See Also


AHELP for CIAO 4.11 ChIPS v1

get_object_count

Context: utilities

Synopsis

Get the number of instances of the specified object type

Syntax

get_object_count(object_type)
get_object_count(id, object_type)

Description

The function arguments.

Argument Description
object The type of object, such as chips_label or chips_plot. See the Object Type section of "ahelp chipsopt".
id A ChipsId structure identifying the item, or a string containing the name of the object.

The get_object_count command retrieves the object count of a number of current chips objects. Currency is not affected.


Example

chips> clear()
chips> add_frame(0.1, 0.1, 0.5, 0.5)
chips> (x1, y1) = ([1,2,4,6], [2,4.4,2.8,3])
chips> add_curve(x1, y1, "line.color=green symbol.color=yellow")
chips> add_frame(.5, .5, .9, .9)
chips> (x2, y2) = ([10,20,30,40,50,60,70,80],[23,25,27,25,22,19,18,21])
chips> add_curve(x2, y2, "line.color=coral")
chips> add_curve([0.5,2,4,6], [1,4,4,2.5], "line.color=blue")
chips> print(get_object_count(chips_axis))
2
chips> print(get_object_count(chips_curve))
1
chips> current_curve("all")
chips> print(get_object_count(chips_curve))
2
chips> id = ChipsId()
chips> id.frame = "frm1"
chips> print(get_object_count(id, chips_curve))
1

This example creates a window with two frames. In the first frame (frm1) the script inserts a curve; in the second frame (frm2) the script places two curves. Frame "frm2" is current. The number of axis objects, in that frame, is retrieved, and then the number of curve objects is retrieved. As there is only one current curve in "frm2", the value of "1" is returned. Both curves are then made current and the number of curve objects is requested. This time the command returns the value "2" as there are two current curves in that frame. A Chips id structure is instantiated and the frame member is filled in with "frm1". The "get_object_count" command is issued, using the id structure, and requesting the number of curves. The expected value of "1" is returned.


Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

See Also

concepts
setget
frames
add_frame, arrange_frames, blink_frames, current_frame, delete_frame, display_frame, get_frame, hide_frame, move_frame, next_frame, reposition_frame, set_frame, tile, view_placed_frame, view_single_frame
utilities
erase, set_current