Page 1 of 1
CELX command to display an arrow?
Posted: 26.08.2008, 17:06
by dams2008
Hello,
I would like to add in my CELX script a command allowing to display an arrow from an object pointing the sun or the magnetic field direction or even to display a frame.
Do you know the command? Is it possible to call directly the functions defined in the celestia source? RenderSunDirectionArrow? or RenderAxisArrows?
I would prefer not to use the mouse command in order to add an automatic sequence of displays...
I have searched in all available tutorials and I don't find anything.
Hope you could help me.
Thanks.
Dams.
Re: CELX command to display an arrow?
Posted: 26.08.2008, 19:48
by Vincent
You can add your reference mark using, e.g.:
Code: Select all
sel = celestia:getselection()
sel:addreferencemark{type = "sun direction", size = 5000, color = "yellow", tag = "sun_dir"}
Then use this line to remove it:
Code: Select all
sel:removereferencemark("sun_dir")
Here you'll find more about how to use reference marks in celx:
http://en.wikibooks.org/wiki/Celestia/C ... erencemark
Re: CELX command to display an arrow?
Posted: 26.08.2008, 21:40
by chris
Note that the reference mark functions are not present in version 1.5.1 and earlier. You'll need to have a SVN build of version of 1.6.0 (search the forum for the link) in order to enable reference marks via script.
--Chris
Re: CELX command to display an arrow?
Posted: 27.08.2008, 07:28
by dams2008
Thanks Chris and Vincent.
I have just a last question for you Chris... I am not sure to understand what you mean.
If I am using a version 1.5.0 (for example), I cannot use the reference marks functions. Right?
So, you explain that I need a SVN build of version 1.6.0... what is a SVN build of version 1.6.0 ?
Thanks.
Dams.
Re: CELX command to display an arrow?
Posted: 27.08.2008, 07:54
by dams2008
Ok ! sorry for this last question...
It's obvious. I have found two executables WIN32 on the website of Cartrite and Phoenix.
I have just to replace the celestia.exe file and it should work.
Do you know if a lot of things are changing with this version?
- deprecated functions?
- CELX commands difference?
- ...
Dams.
Re: CELX command to display an arrow?
Posted: 27.08.2008, 08:15
by chris
dams2008 wrote:Ok ! sorry for this last question...
It's obvious. I have found two executables WIN32 on the website of Cartrite and Phoenix.
I have just to replace the celestia.exe file and it should work.
Do you know if a lot of things are changing with this version?
- deprecated functions?
- CELX commands difference?
- ...
Many things are changing. There are no newly deprecated functions, however. The changes are mostly feature additions and bug fixes. There's no list of celx differences yet, but new celx functions are flagged with a green '1.6.0' in the reference on the WikiBook:
http://en.wikibooks.org/wiki/Celestia/C ... ua_MethodsIf you're creating add-ons, you might also be interested in new features for add-on creators:
http://en.wikibooks.org/wiki/Celestia/160Files--Chris
Re: CELX command to display an arrow?
Posted: 27.08.2008, 09:27
by dams2008
OK !
So, I think I have a problem with the install of the SVN build of version 1.6.0.
I have downloaded the r4407 (from Cartrite's website) and I do the followings steps:
- copy the r4407_celestia.exe in the Celestia directory.
- run the r4407_celestia.exe
- run my script (draw a satellite in orbit around earth)
=> but nothing is drawn excepted the earth!! The satellite object is not recognized if I try to go to the object manually.
- with the original executable, it works perfectly.
Do you have an idea? If there something else to modify to install in order to use the version 1.6.0?
Dams.
Re: CELX command to display an arrow?
Posted: 27.08.2008, 09:45
by chris
dams2008 wrote:OK !
So, I think I have a problem with the install of the SVN build of version 1.6.0.
I have downloaded the r4407 (from Cartrite's website) and I do the followings steps:
- copy the r4407_celestia.exe in the Celestia directory.
- run the r4407_celestia.exe
- run my script (draw a satellite in orbit around earth)
=> but nothing is drawn excepted the earth!! The satellite object is not recognized if I try to go to the object manually.
- with the original executable, it works perfectly.
Do you have an idea? If there something else to modify to install in order to use the version 1.6.0?
Is there an error message in the console? (You can enable it by pressing the tilde (~) key; use the up and down arrows to scroll.) Can you post the part of the script that draws the satellite? Is there a custom .ssc file involved as well?
--Chris
Re: CELX command to display an arrow?
Posted: 27.08.2008, 10:13
by dams2008
I have enabled the error message and I notice the following errors before running my celx script:
Loaded 10937 deep space objects
Error in the file .ssc (line 92): object 'TYC 3466-0819-1' .. not found
Error in the file .ssc (line 92): bad alternative surface
...
Body frame for GB2 is needed too deep (probably circular)
...
After running my script, nothing else is appearing.
The view is modified and correspond to the right view but without the satellite...
I have added alternative surface (new .ssc) for earth. Maybe it causes an issue...
Code: Select all
Here is the *.ssc script and *.celx script
------------------------ SSC -----------------
"GB2" "Sol/Earth"
{
Class "moon"
Mesh "gb2.3ds"
Radius 800
Beginning 2454993.782004444
OrbitFrame { EquatorJ2000 { Center "Sol/Earth" }}
BodyFrame { BodyFixed { Center "Sol/Earth/GB2" }}
SampledOrbit "gb2.xyz"
SampledOrientation "gb2.q"
Albedo 0.10
Orientation [90 1 0 0]
Ending 2454993.823671111
}
---------------------- CELX --------------------
while celestia:gettime()< 2454993.782004444 do celestia:flash(" Debut Script GB2 ",1) wait(0) end
-- Do not label the following objects
celestia:hidelabel("planets","moons","spacecraft","asteroids","constellations")
celestia:hidelabel("stars","galaxies","moon")
-- Label the following objects
-- celestia:showlabel("moon")
-- Do not render the following objects
celestia:setrenderflags{asteroids = flase,grid=flase,constellations=false}
-- Render the following objects
celestia:setrenderflags{atmosphere=true,stars=true}
-- Do not render the following objects
celestia:setlabelflags{planets = flase,spacecraft=false}
-- Set Time Rate
celestia:settimescale(2.0)
tt=celestia:find("Sol/Earth")
gb2=celestia:find("Sol/Earth/GB2")
celestia:unmark(tt)
celestia:unmark(gb2)
celestia:select(gb2)
obs = celestia:getobserver()
obs:lock(tt)
obs:center(gb2)
obs:track(gb2)
obs:chase(gb2)
obs:gotodistance(gb2,6000,5)
obs:lock(tt)
while celestia:gettime()< 2454993.823671111 do celestia:flash(" Fin Script GB2 ",1) wait(0) end
---------------- SSC for alternative surface ---------------
AltSurface "earth_real_color" "Sol/Earth"
{
Texture "earth_real_color.*"
}
AltSurface "earth_high_res" "Sol/Earth"
{
Texture "earth_high_res.*"
}
------------------------------------------------------------------
Re: CELX command to display an arrow?
Posted: 27.08.2008, 10:59
by chris
dams2008 wrote:I have enabled the error message and I notice the following errors before running my celx script:
Loaded 10937 deep space objects
Error in the file .ssc (line 92): object 'TYC 3466-0819-1' .. not found
Error in the file .ssc (line 92): bad alternative surface
...
Body frame for GB2 is needed too deep (probably circular)
It sounds like the problem is with your definition for GB2 in the ssc file. Could you cut and paste that into a forum post?
--Chris
Re: CELX command to display an arrow?
Posted: 27.08.2008, 11:10
by dams2008
[/quote]
It sounds like the problem is with your definition for GB2 in the ssc file. Could you cut and paste that into a forum post?
--Chris[/quote]
Do you mean in a new post or in this one?
Otherwise, the gb2.ssc file is already pasted in the previous message. I paste it again hereafter.
------------------------ SSC -----------------
"GB2" "Sol/Earth"
{
Class "moon"
Mesh "gb2.3ds"
Radius 800
Beginning 2454993.782004444
OrbitFrame { EquatorJ2000 { Center "Sol/Earth" }}
BodyFrame { BodyFixed { Center "Sol/Earth/GB2" }}
SampledOrbit "gb2.xyz"
SampledOrientation "gb2.q"
Albedo 0.10
Orientation [90 1 0 0]
Ending 2454993.823671111
}
Re: CELX command to display an arrow?
Posted: 27.08.2008, 12:31
by selden
Unfortunately, an object's BodyFrame cannot be defined relative to itself. Orbits and Rotations always are relative to other objects.
GB2 needs to be deleted from its BodyFrame declaration.
BodyFrame { BodyFixed { Center "Sol/Earth/GB2" }}
could be
BodyFrame { BodyFixed { Center "Sol/Earth" }}
or it could specify some other previously defined body.
Re: CELX command to display an arrow?
Posted: 27.08.2008, 12:50
by dams2008
Thanks for your answer. It works perfectly now.
I have another question.
I know (thanks to previous messages) how to display the sun direction, the body frame,... but I do not know how to display an arrow representing for instance the earth magnetic field direction or total angular momentum... it's not the same thing than drawing an arrow representing the direction from an object to another object.
Do I have to create a new frame and display one axis of this new frame?
Dams.
Re: CELX command to display an arrow?
Posted: 27.08.2008, 14:38
by selden
Dams,
Magnetic fields are not designed into Celestia.
Defining an appropriate body and displaying that body's axis does sound like a reasonable approach.
Re: CELX command to display an arrow?
Posted: 29.08.2008, 13:36
by dams2008
Ok I understand but I do not know how to proceed...
Would it be possible to have a simple explanation?
Thanks.
Dams.
Re: CELX command to display an arrow?
Posted: 29.08.2008, 14:24
by selden
I think Cham's "Magnetic Earth" Addon might be a good place to start. It's available on the MotherLode at
http://www.celestiamotherlode.net/catal ... on_id=1016