Re: importing variables into iTools programmatically [message #37224] |
Mon, 08 December 2003 07:10 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Erica Stanley writes:
> I have an IDLgrModel of a camera that I would like to import into the
> ivolume data manager. With a function, camera() that returns an
> object reference of the camera model, I can enter cam1= camera() at
> the command line, call ivolume and import cam1 via the file/import
> menu, but I would like to be able to do this programmatically.
>
> Does any one have a method for importing variables into iTools from
> within a procedure?
I don't know of a way to programmatically add an IDLgrMODEL
object to an iTool. The iTools seem to be able to import
models as an "IDL graphics object" (although see the other
iTool thread today about fatal errors that result when you
exit a tool for which you have imported at least some models).
All I can find are ways to import *data* into an iTool programmatically.
I presume that models are added by decomposing them into their component
atomic objects and data, but I can't find where this happens, and
I don't find any mention of adding models in the documentation.
I have a model that produces a surface. To use the function
that produces the surface with XObjView, for example, I do
this:
IDL> XObjView, SurfModel()
To load the surface data into an iSurface object programmatically,
I have to extract the IDLgrSurface object from the model (it is the
first object in the model container), get the data out of this,
and add the data to the Data Manager like this.
surfModel = SurfModel() ; Get the model.
iSurface ; Start an iTool.
oSys = _IDLitSys_GetSystem() ; Obtain the iTool system.
oTool = oSys->_GetCurrentTool() ; Get the current tool.
surfObj = surfModel ->Get(/All) ; Extract IDLgrSurface from model.
surfObj[0] -> GetProperty, Data=thedata ; Extract the actual data.
objData = OBJ_NEW('IDLitData', Reform(theData[0,*,*]), $
IDENTIFIER='SURFMODELDATA, $
NAME='SURFDATA', TYPE='IDL2DArray')
oTool -> AddByIdentifier, '/Data Manager', objData
Now I can use the "SURFDATA" in a visualization in the iSurface tool,
or in any tool that can process data of type IDL2DARRAY.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|