![]() |
|
|||||||
| Add-on & Script Development Creating add-ons and scripts for World Wind. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Dec 2006
Location: Kitchener, Ontario
Posts: 52
|
TerminallyIll is an embedded Python console World Wind plugin.
http://ranenghosh.com/WorldWind/TerminallyIll/ Name will change to something respectable once the console's capabilities are respectable. Right now you get nothing more than IronPython with IronTextBox in a World Wind plugin form (no specialized environment setup, no utilities, no examples, ...). First enhancement to Python support in WW on my list doesn't affect this plugin directly -- it's adding support for plugins written in IronPython. |
|
|
|
|
|
#2 |
|
What?
Join Date: Apr 2005
Location: San Francisco, California
Posts: 2,464
|
Neat.
To get it to load you have to delete the REFERENCES: line in the header and put the dlls in the same directory as WorldWind.exe. Now to learn how to make it do something besides calculator... ![]() |
|
|
|
|
|
#3 |
|
Member
Join Date: Dec 2006
Location: Kitchener, Ontario
Posts: 52
|
Oops! Heh, that's why I started the version number at 0.1
![]() http://ranenghosh.com/WorldWind/Term...llyIll_0_2.zip Edit: Oh yeah, I put the dlls in the same dir as the plugin (manually created a Plugins/TerminallyIll directory and put them in there), seems to also work Sorry I was mistaken, the dlls were in the WorldWind.exe directory all along, so withak was right. Last edited by rghosh; 02-26-2007 at 05:23 AM. Reason: wrong advice |
|
|
|
|
|
#4 |
|
Super Member
Join Date: Nov 2006
Location: 35.0376,-117.9688
Posts: 1,519
|
Will be very interested in how this is implemented.
An interesting note: IronPython is an implementation of Python that runs atop the .NET's Common Language Runtime. It's still a new project, but its initial performance is promising. Lead developer Jim Hugunin was hired by Microsoft to work on dynamic language support for the CLR, and one of his tasks will be to complete the IronPython implementation. Last edited by nlneilson; 02-25-2007 at 09:17 PM. |
|
|
|
|
|
#5 |
|
Member
Join Date: Dec 2006
Location: Kitchener, Ontario
Posts: 52
|
Ah, OK, so I figured out how to get a reference to the world:
Code:
import clr
clr.AddReferenceByPartialName("System.Windows.Forms")
clr.AddReferenceByPartialName("WorldWind")
from WorldWind import MainApplication
from System.Windows.Forms import Control
app = Control.FromHandle( MainApplication.GetWWHandle() )
world = app.WorldWindow.CurrentWorld
So then I can mess around: Code:
>>>world.RenderableObjects <WorldWind.Renderable.RenderableObjectList object at 0x000000000000002E [Earth]> >>>dir(world.RenderableObjects) ['Add', 'BuildContextMenu', 'ChildObjects', 'CompareTo', 'Count', 'Delete', 'Description', 'DisableExpansion', 'Dispose', 'Enable', 'Equals', 'Finalize', 'GetHashCode', 'GetObject', 'GetObjects', 'GetType', 'IconImage', 'IconImagePath', 'Initialize', 'Initialized', 'IsOn', 'MakeDynamicType', 'MemberwiseClone', 'MetaData', 'Name', 'OnDbfInfo', 'OnDeleteClick', 'OnGotoClick', 'OnInfoClick', 'OnPropertiesClick', 'Opacity', 'Orientation', 'ParentList', 'PerformSelectionAction', 'Position', 'Reduce', 'ReferenceEquals', 'RefreshTimer', 'Remove', 'RemoveAll', 'Render', 'RenderPriority', 'ShowOnlyOneLayer', 'SortChildren', 'StartRefreshTimer', 'Thumbnail', 'ThumbnailImage', 'ToString', 'TurnOffAllChildren', 'Update', 'World', '__class__', '__doc__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__str__', '_metaData', 'dbfIsInZip', 'dbfPath', 'isInitialized', 'isOn', 'isSelectable', 'm_children', 'm_description', 'm_iconImage', 'm_iconImagePath', 'm_opacity', 'm_propertyBrowser', 'm_renderPriority', 'm_thumbnailImage', 'm_world', 'name', 'orientation', 'position'] >>>world.RenderableObjects.Count 15
All of these operations rely on expressions of arbitrary structure and so are possibly better suited to a console interface than an ordinary gui interface Edit: Oh yeah and apparently IronPython.CodeDom.PythonProvider() is incomplete and broken (admittedly so by IronPython, as it apparently breaks some of the tests that IronPython ships with, and there is debate over whether it should actually be removed since Python is a dynamic language), so adding a code provider to WorldWind/PluginEngine/PluginCompiler.cs doesn't work, so there is no clean and simple way to add support for IronPython plugins. A cruddy way that should work is to have a c# plugin that acts as a manager for all python plugins. Last edited by rghosh; 02-26-2007 at 05:10 AM. Reason: append |
|
|
|
|
|
#6 | |
|
What?
Join Date: Apr 2005
Location: San Francisco, California
Posts: 2,464
|
Excellent. I got it to find the WW classes but couldn't figure out how to get the mainapplication reference.
![]() Quote:
Last edited by withak; 02-26-2007 at 02:38 PM. |
|
|
|
|
|
|
#7 |
|
Member
Join Date: Dec 2006
Location: Kitchener, Ontario
Posts: 52
|
Version 0.3:
http://ranenghosh.com/WorldWind/Term...llyIll_0_3.zip Basic env setup:
|
|
|
|
|
|
#8 |
|
Super Member
Join Date: Nov 2006
Location: 35.0376,-117.9688
Posts: 1,519
|
Downloaded v0.3, put the .dll files in the dir with WorldWind.exe
Made a dir TerminallyIll in the plugins dir for the env.py file Put TerminallyIll.cs in the WorldWind dir so a breakpoint when debugging will work Tried the dir(env.world) and dir(env.app) at the prompt, OK Opened up the Console, surprise, surprise, a help with 9 commands, GPSTracker has a help file also, there may be other plugins that have some type of help but they are in a slim minority. Is the Big Snake (Python) going to help in getting "Help" into WW? Last edited by nlneilson; 03-01-2007 at 03:18 PM. |
|
|
|
|
|
#9 |
|
What?
Join Date: Apr 2005
Location: San Francisco, California
Posts: 2,464
|
http://www.codeplex.com/IronPython/R...x?ReleaseId=47
The tutorial that comes with IronPython itself is pretty good, and there are a ton of other samples there as well. With the environment set for you up it's basically just a matter of translating anything you would do in a C# plugin into python. It just takes a little longer because there isn't any kind of tab completion. ![]() I asked the IronTextBox guy on codeproject about tab completion, he says he is looking into it. ![]() Last edited by withak; 03-01-2007 at 03:46 PM. |
|
|
|
|
|
#10 |
|
Super Member
Join Date: Nov 2006
Location: 35.0376,-117.9688
Posts: 1,519
|
Just downloaded IronPython, the IronPython IDE and the Zeus IDE trial a few days ago and have not tinkered with it very much, may be able to use PyScripter as well as Idle. Python has byte of python, dive into python and py_grimoire that is probably applicable to IronPython also, will go thru the IPy tutorial.
Good job on getting this in. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| General abilities of World Wind | globpat | WorldWind General | 14 | 02-28-2007 04:07 PM |
| Download Console | michaeltoe | Suggestion Box | 3 | 11-07-2004 06:54 PM |