comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to find if an object contains another
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to find if an object contains another [message #22144 is a reply to message #22138] Thu, 19 October 2000 00:00 Go to previous message
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
I would try

if obj_valid((model->get(/all,isa='idlgrsurface'))[0]) then $
print,'Has one or more surface' $
else $
print,'Has no surfaces'

or, better yet, because it provides a useful list as the result:

surf_list = model->get(/all,isa='idlgrsurface', count=n_surfs)
if n_surfs gt 0 then .....

Same thing about finding out if GetbyName returned a valid object.
Cheers,
Pavel

Dave Greenwood wrote:
>
> How do I determine if an object "contains" another one?
>
> For example, I can create a model object and add a surface object or
> a plot object. Given that model object, how would I find out whether
> or not a surface object has been added?
>
> The best I've come up with is something like:
>
> xx = model->get(/all,isa='idlgrsurface')
> s = size(xx)
> if s[1] eq 11 then $
> print,'Has one or more surface' $
> else $
> print,'Has no surfaces'
>
> Surely there's a simpler way?
>
> A related question is: how do I test if an object pointer (returned by
> the GetByName method, for example) is null?
>
> Thanks,
> Dave
> --------------
> Dave Greenwood Email: Greenwoodde@ORNL.GOV
> Oak Ridge National Lab %STD-W-DISCLAIMER, I only speak for myself
[Message index]
 
Read Message
Read Message
Previous Topic: HDF File Label and Description
Next Topic: Problems Compiling Projects

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 12:21:50 PDT 2025

Total time taken to generate the page: 0.55931 seconds