|
6/11/2007 7:24:19 AM
|
IndyPin Posts 16
|
I have been unsuccessful at trying to use even the sample scripts for the Accuglobe help. Please see the "Scripting Question" post under General Questions.
Has anyone gotten any script to work in Accuglobe 07?
Give a man a fish, feed him for a day. Teach a man to fish, feed him for a lifetime.
|
|
9/10/2007 8:15:43 AM
|
Chris Posts 52
|
A more detailed script sample has been posted to the online help. It shows how to create a custom search dialog and perform an attribute query on a map layer.
Follow this link and select Scripting from the contents:
http://www.accuglobe.net/AccuGlobe2007_Help/Start.aspx
Chris DDTI
|
|
9/12/2007 9:15:22 AM
|
IndyPin Posts 16
|
I have started to get the scripting to work through the Web updates, however with the more detailed script Im having trouble getting it to execute completely.
The search box will pop up with my edited text, but when I actually hit the search button I get the following error.
DTMrSIDLayer has no attribute Records (more detailed description below)
Is this an error with the mapping engine or is there some omitted code that addresses this problem? Please comment. Thanks!
(I have a screenshot of the script and error if needed)
************** Exception Text ************** System.MissingMemberException: DTMrSIDLayer object has no attribute Records at IronPython.Runtime.Types.DynamicType.GetAttr(ICallerContext context, Object self, SymbolId name) at IronPython.Runtime.Operations.Ops.GetAttr(ICallerContext context, Object o, SymbolId name) at buttonPressed$f7##64(FunctionEnvironment4Dictionary , Object , Object , Object ) at IronPython.Runtime.Calls.Function3.Call(ICallerContext context, Object arg0, Object arg1, Object arg2) at IronPython.Runtime.Calls.Function3.Call(ICallerContext context, Object[] args) at IronPython.Runtime.Calls.PythonFunction.CallInstance(ICallerContext context, Object instance, Object[] args) at IronPython.Runtime.Calls.Method.Call(ICallerContext context, Object[] args) at IronPython.Runtime.Operations.Ops.Call(Object func, Object[] args) at IronPython.Runtime.Types.ReflectedEvent.EventDispatcher.Call(Object[] args) at IronPython.Runtime.Operations.Ops.Call(Object func, Object[] args) at IronPython.Runtime.Operations.Ops.Call(Object func, Object arg0, Object arg1) at System.Void(Object, EventArgs)##39(Object , Object , EventArgs ) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Give a man a fish, feed him for a day. Teach a man to fish, feed him for a lifetime.
|
|
9/12/2007 9:23:41 AM
|
Chris Posts 52
|
It appears to be trying to query a MrSID layer. You need to query a vector based layer, such as a shapefile, as raster layers cannot be queried. Change the layer = ActiveMap.Layers.Item(0) in the sample to point to a different layer. It is in the format .Item(layerIndex) where layerIndex is an integer representing the layer order in the legend. They start at 0 at the bottom of the legend (I think) and increase upwards. So the second layer from the bottom would be .Item(1) etc.
|
|
9/12/2007 11:59:56 AM
|
IndyPin Posts 16
|
Thank you very much for your prompt reply. That was a helpful bit of information. I actually was able to get the script to run properly (for returning a record result).
Following the instructions in the help file I changed the line layer.ExecuteRecordsQuery(oQuery) to layer.ExecuteSelectionQuery(oQuery) to allow the result to be selected. After the box pops up showing how many records are being searched, an error displays that exactly 3 arguments are needed but only 1 is provided. Also, is there an alternative to using the layer index, such as using a layer name or the active layer of the map?
Thanks again.
Give a man a fish, feed him for a day. Teach a man to fish, feed him for a lifetime.
|
|
9/12/2007 12:09:45 PM
|
Chris Posts 52
|
Yeah, I probably should have tested that one prior to putting it on the Online Help. ExecuteSelectionQuery does take 3 parameters. Try:
ExecuteSelectionQuery(oQuery, True, True)
The second parameter clears any existing selection on the layer (if true). The third parameter, if true, tells the method to select the features that match the query. If you set this to false, it unselects the features that match the query (assuming any are selected to begin with). You will need to remove any reference to oRecords also, as a selection query does not return any records (just selects them). We will post an updated sample on the Online Help soon.
|
|
pages:
1 |