Deselect of objects not working
I have a large script that I am preparing for a public observing meeting.
I do several tours of the night sky and in one of these I select and highlight each visible constellation by using StelMovementMgr
StelMovementMgr
core.wait(1);
StelMovementMgr
core.wait(5);
StelMovementMgr
core.wait(1);
StelMovementMgr
core.wait(7);
I use the zoomTo function to prevent the autoZoomIn going too far.
After this I use the following sequence to allow me to turn the constellation art etc off before highlighting another constellation.
// turn off constellation
ConstellationMg
ConstellationMg
ConstellationMg
// appear to need this to force the deselection of all the other previously selected objects
core.selectObje
However after using theAutoZoomIn() functon I cannot deselect the object and so the view tracks round with the night sky which is not what I want to do.
How do I deselect all objects so that the view no longer tracks the movement of the sky due to Earth's rotation?
Thanks
Ian
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Stellarium Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Ian Hargraves
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
You can use core.selectObje
Revision history for this message
|
#2 |
There are two options:
1.
core.clear(
2.
To deselect all objects, switch to another sky culture then back to western. For example:
core.setSkyCult
.
.
core.setSkyCult
Revision history for this message
|
#3 |
Hi Khalid,
I have been playing around with the various fixes suggested by you and Alex and none of them seem to fix the problem.
I was under the impression that either the core.selectObje
Is there a way that I can send you a 500 line script to look at? It is well structured using function calls and I will give you a guide to what is going wrong with it.
Thanks
Ian
Revision history for this message
|
#4 |
Hi Khalid,
Sorry, I used the wrong response button, so here it is again.
I have been playing around with the various fixes suggested by you and Alex and none of them seem to fix the problem.
I was under the impression that either the core.selectObje
Is there a way that I can send you a 500 line script to look at? It is well structured using function calls and I will give you a guide to what is going wrong with it.
Thanks
Ian
Revision history for this message
|
#5 |
Hi,
Here is a minimised script that reproduces the problem.
The main part of the program is at the foot of the listing;
1) It initialises Stellarium and theobservers location and telescope to altaz;
2) Then it calls the function SpinProcession(
3) Then it calls DispConstellation twice once with Orion and then with Cetus. Each time the function is called it isolates the constellation, displays the isolated constellation art and then deselects the constellation and deletes the constellation art.
4) Then SpinProcession is called a second time.
There are two POSSIBLE bugs highlighted here:
Bug 1) The ConstellationMg
Bug 2) When I first run the script in a newly launched instance of Stellarium the first call to SpinProcession results in the expected behaviour with the stars processing and the mount stationary due south. Then following one or two calls to DispConstellation the next call to SpinProcession results in the mount tracking the sky.
If the two calls to DispConstellation are commented out then the two calls to SpinProcession work OK but only if Stellarium is relaunched.
The problem is that I want to be able to loop the full script indefinitely all night for an unattended sky show.
Sorry its so long but I could not shorten it any more without generating loads of parsing errors etc.
///////
// Debugging sky stracking problem
//=====
// Name: waituntil alternative to core.waitfor function which does not work any more
// License: Public Domain
// Author: Khalid AlAjaji with accuracy mods by Ian Hargraves
// Description: example
//=====
function WaitUntil(jd)
{
var minFPS=0.0;
tr = core.getTimeRate(); //get time rate
if (tr!=0)
{ //only wait if tr <>0
//core.debug("tr not equal to 0");
minFPS = core.getMinFps();
//core.
//speed up the core to minimise timing inaccuracies
core.setMinFps(
var dfTimeNow = 0;
if (tr > 0)
{
do
{
dfTimeNow = core.getJDay();
}
while( dfTimeNow < jd); // let time go by
}
else
{
do
{
dfTimeNow = core.getJDay();
}
while( dfTimeNow > jd); // let time go by
}
//restore original core speed to save processor power
core.setMinFps(
} //only run the function if tr <>0
} // end of WaitUntil()
//=====
//=====
// Name: Display constellation function
// License: copyright Ian Hargraves 2012
// Author: Ian Hargraves
// Description: Displays named constellation art and zooms to it then turns it off afterwards
//
// ConstNamestr = name of constellation to display, ConstDescstr = additional description string
// ZoomLvl = numeric level to zoom in to for each constellation
// ZoomOutLvl = numeric level to zoom back out to
//=====
function DispConstellati
{
Strid = LabelMgr.
LabelMgr.
core.selectObje
ConstellationMg
ConstellationMg
ConstellationMg
StelMovementMgr
core.wait(1);
StelMovementMgr
core.wait(5);
StelMovementMgr
core.wait(1);
StelMovementMgr
core.wait(7);
LabelMgr.
// turn off constellation
ConstellationMg
ConstellationMg
ConstellationMg
// need to select Pluto to force the deselection of all the other previously selected objects
core.selectObje
//core.
core.selectObje
}//end DispConstellation()
//=====
//=====
// INITIALISATION SEQUENCE (Location, mount and zoom setup)
//=====
function InitObserver(
{
core.setJDay(
core.wait(1);
// set up SGL event location
core.debug(
core.setObserve
// make sure mount is in alt-az mode
core.setMountMo
// dont track the objects
StelMovementMgr
core.selectObje
}//end InitObserver()
//=====
// SGL Spin Procession of the stars (Initilase due south at sunset)
//=====
function SpinProcession(
{
StelMovementMgr
LandscapeMgr.
core.setJDay(
core.wait(1);
// point 40 degrees alt due south to start with on first night
core.debug("Move to 40, 180")
core.moveToAltA
core.debug("move to 40,180");
core.wait(5);
StelMovementMgr
core.wait(2);
core.setTimeRat
WaitUntil(
core.setTimeRat
core.setJDay(
LabelMgr.
core.wait(1);
LandscapeMgr.
}//end SpinProcession()
//=====
///////
///////
// Main Program sequence
///////
///////
//set SGLSunsetTime
core.setDate(
SGLSunsetTime = core.getJDay();
core.setDate(
SGLObserveTime = core.getJDay();
//set SGLSunriseTime
core.setDate(
SGLSunriseTime = core.getJDay();
id = LabelMgr.
ScrnHigh=
ScrnWide=
InitObserver(
GuideTitleid=
SpinProcessionT
ConstellationMg
// Initialise display start time to sunset
core.setJDay(
LabelMgr.
core.wait(3);
LabelMgr.
SpinProcession(
// Debuggng call to dispconstellation
DispConstellati
DispConstellati
core.setSkyCult
core.setSkyCult
core.clear(
core.clear(
ConstellationMg
SpinProcession(
core.setMinFps(10);
Revision history for this message
|
#6 |
Hi Ian,
The script works for me if I remove all StelMovementMgr
My modification are marked with ***
///////
// Debugging sky stracking problem
//=====
// Name: waituntil alternative to core.waitfor function which does not work any more
// License: Public Domain
// Author: Khalid AlAjaji with accuracy mods by Ian Hargraves
// Description: example
//=====
function WaitUntil(jd)
{
var minFPS=0.0;
tr = core.getTimeRate(); //get time rate
if (tr!=0)
{ //only wait if tr <>0
//core.debug("tr not equal to 0");
minFPS = core.getMinFps();
//core.
//speed up the core to minimise timing inaccuracies
core.setMinFps(
var dfTimeNow = 0;
if (tr > 0)
{
do
{
dfTimeNow = core.getJDay();
}
while( dfTimeNow < jd); // let time go by
}
else
{
do
{
dfTimeNow = core.getJDay();
}
while( dfTimeNow > jd); // let time go by
}
//restore original core speed to save processor power
core.setMinFps(
} //only run the function if tr <>0
} // end of WaitUntil()
//=====
//=====
// Name: Display constellation function
// License: copyright Ian Hargraves 2012
// Author: Ian Hargraves
// Description: Displays named constellation art and zooms to it then turns it off afterwards
//
// ConstNamestr = name of constellation to display, ConstDescstr = additional description string
// ZoomLvl = numeric level to zoom in to for each constellation
// ZoomOutLvl = numeric level to zoom back out to
//=====
function DispConstellati
{
Strid = LabelMgr.
LabelMgr.
core.selectObje
ConstellationMg
ConstellationMg
ConstellationMg
StelMovementMgr
core.wait(1);
StelMovementMgr
StelMovementMgr
core.wait(5);
StelMovementMgr
core.wait(1);
StelMovementMgr
core.wait(7);
LabelMgr.
// turn off constellation
ConstellationMg
ConstellationMg
ConstellationMg
// need to select Pluto to force the deselection of all the other previously selected objects
core.selectObje
//core.
core.selectObje
}//end DispConstellation()
//=====
//=====
// INITIALISATION SEQUENCE (Location, mount and zoom setup)
//=====
function InitObserver(
{
core.setJDay(
core.wait(1);
// set up SGL event location
core.debug(
core.setObserve
// make sure mount is in alt-az mode
core.setMountMo
// dont track the objects
//StelMovementM
core.selectObje
}//end InitObserver()
//=====
// SGL Spin Procession of the stars (Initilase due south at sunset)
//=====
function SpinProcession(
{
//StelMovementM
LandscapeMgr.
core.setJDay(
core.wait(1);
// point 40 degrees alt due south to start with on first night
core.debug("Move to 40, 180")
core.moveToAltA
core.debug("move to 40,180");
core.wait(5);
StelMovementMgr
core.wait(2);
core.setTimeRat
WaitUntil(
core.setTimeRat
core.setJDay(
LabelMgr.
core.wait(1);
LandscapeMgr.
}//end SpinProcession()
//=====
///////
///////
// Main Program sequence
///////
///////
//set SGLSunsetTime
core.setDate(
SGLSunsetTime = core.getJDay();
// *** alternatively you can use the following instead of the previous 2 lines
//SGLSunsetTime = core.jdFromDate
core.setDate(
SGLObserveTime = core.getJDay();
//set SGLSunriseTime
core.setDate(
SGLSunriseTime = core.getJDay();
id = LabelMgr.
ScrnHigh=
ScrnWide=
InitObserver(
GuideTitleid=
SpinProcessionT
ConstellationMg
// Initialise display start time to sunset
core.setJDay(
LabelMgr.
core.wait(3);
LabelMgr.
SpinProcession(
// Debuggng call to dispconstellation
DispConstellati
DispConstellati
//core.
//core.
//core.
//core.
ConstellationMg
SpinProcession(
core.setMinFps(10);
Revision history for this message
|
#7 |
Dear Khalid,
Thank-you so much for sorting out my scripting problem.
I have now made all of your suggested changes in my full script and it appears to be working well.
I note that I have obviously misunderstood the correct use of the StelMovementMgr
Also many thanks for pointing out the function core.jdFromDate
Revision history for this message
|
#8 |
continued:
Also many thanks for pointing out the function core.jdFromDate
Did you have time to look at the problem that I was experiencing with turning off the constellation lines in DispConstellation. Don't worry too much about this as I am using a work round in my script.
I am very grateful for your help as it has now allowed me to get the full script working.
Regards
Ian
Revision history for this message
|
#9 |
Hi Ian,
I don't think you misunderstood the correct use of the StelMovementMgr
For turning off the constellation, I do not know any direct way to perform that other than what you did or alternatively switching sky cultures.
I have another implementation of the waituntil function which is simpler if you want to look at it:
// Name: WaitUntil
// License: Public Domain
// Author: Khalid AlAjaji
// Description: alternative to core.waitfor function which does not work after 0.10.4
function WaitUntil(
{
//example format of datestring "2010:04:
tr = core.getTimeRate();
JD = core.jdFromDate
if ( tr != 0 )
{
td = (JD-core.
}
core.debug("time rate is " + tr + " time difference is " + td);
if ((tr != 0) && (td > 0))
{
core.wait(td);
}
} // end of WaitUntil()
// Sample usage
core.moveToAltA
core.setTimeRat
core.setDate(
WaitUntil(
core.setTimeRat
// Now move view direction south and up
core.moveToAltA
Revision history for this message
|
#10 |
It looks like that I didn't get any credit for solving the question. The question status is "solved" and the solved by is "Ian Hargraves".
Revision history for this message
|
#11 |
Dear Khalid,
I don't know why you didn't get any credit for solving my problem for me.
You most certainly did and very rapidly as well.
I was just having a cup of coffee with a mutual friend of ours from the UK when the fix arrived.
Don't know why I would have been credited with the fix, sorry if it was anything that I did......
Regards
Ian
Revision history for this message
|
#12 |
Don't worry. No problem. Enjoy the sky, coffee and friendship. They certainly make life more pleasant.