#
# You should have received a copy of the GNU General Public License
# along with Diffcalc.  If not, see <http://www.gnu.org/licenses/>.
###

"""
This script is referenced by b16 directly
"""

try:
    import diffcalc
except ImportError:
    from gda.data.PathConstructor import createFromProperty
    import sys

    diffcalc_path = createFromProperty("gda.root").split("/plugins")[0] + "/diffcalc"
    sys.path = [diffcalc_path] + sys.path
    print diffcalc_path + " added to GDA Jython path."
    import diffcalc
#####

from diffcalc.gdasupport.factory import create_objects, add_objects_to_namespace

demoCommands = []
demoCommands.append("newub 'cubic'")
demoCommands.append("setlat 'cubic' 1 1 1 90 90 90")
demoCommands.append("pos wl 1")
demoCommands.append("pos fivec [0 60 30 1 0]")
demoCommands.append("addref 1 0 0")
demoCommands.append("pos chi 91")
demoCommands.append("addref 0 0 1")
#
# Diffcalc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Diffcalc.  If not, see <http://www.gnu.org/licenses/>.
###

try:
	import diffcalc
except ImportError:
	from gda.data.PathConstructor import createFromProperty
	import sys
	diffcalc_path = createFromProperty("gda.root").split('/plugins')[0] + '/diffcalc' 
	sys.path = [diffcalc_path] + sys.path
	print diffcalc_path + ' added to GDA Jython path.'
	import diffcalc
#####

from gdascripts.pd.dummy_pds import DummyPD
from diffcalc.gdasupport.factory import create_objects, add_objects_to_namespace

demoCommands = []
demoCommands.append( "newub 'cubic'" )
demoCommands.append( "setlat 'cubic' 1 1 1 90 90 90" )
demoCommands.append( "pos wl 1" )
demoCommands.append( "pos fourc [60 30 90 0]" )
demoCommands.append( "addref 0 0 1" )
demoCommands.append( "addref 1 0 0 [60 30 0 0] 12.39842" )
# This file is part of Diffcalc.
#
# Diffcalc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Diffcalc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Diffcalc.  If not, see <http://www.gnu.org/licenses/>.
###

"""
This file contains an example of how to add Diffcalc to the GDA's Jython path.
It assumes Diffcalc is installed next to the gda's 'plugin' folder.
"""

import sys

from gda.data.PathConstructor import createFromProperty


gda_root = createFromProperty("gda.root")
diffcalc_path = gda_root.split('/plugins')[0] + '/diffcalc'
sys.path.insert(0, diffcalc_path)
print diffcalc_path + ' added to GDA Jython path.'