Skip to content
Snippets Groups Projects
Commit c7194e77 authored by Andreas Freise's avatar Andreas Freise
Browse files

change order of blocks when generating script. First come

all the read FTblocks, followed by the NO_BLOCK bits.
parent 2c40a2e4
No related branches found
No related tags found
No related merge requests found
...@@ -806,21 +806,11 @@ class kat(object): ...@@ -806,21 +806,11 @@ class kat(object):
print " ** removing line '{0}'".format(obj) print " ** removing line '{0}'".format(obj)
objs.remove(obj) objs.remove(obj)
def generateKatScript(self) : def generateKatScript(self) :
""" Generates the kat file which can then be run """ """ Generates the kat file which can then be run """
out = [] def writeBlock():
import datetime
strtoday = datetime.datetime.now()
out.append(strtoday.strftime("%% Generated by PyKat %d.%m.%Y %H:%M:%S\n") )
for key in self.__blocks:
objs = self.__blocks[key].contents
out.append("\n")
if key != NO_BLOCK and np.size(objs)>0:
out.append("%%% FTblock " + key + "\n")
for obj in objs: for obj in objs:
if isinstance(obj, str): if isinstance(obj, str):
out.append(obj + '\n') out.append(obj + '\n')
...@@ -835,9 +825,33 @@ class kat(object): ...@@ -835,9 +825,33 @@ class kat(object):
else: else:
out.append(txt + "\n") out.append(txt + "\n")
if key != NO_BLOCK and np.size(objs)>0:
out = []
import datetime
strtoday = datetime.datetime.now()
out.append(strtoday.strftime("%% Generated by PyKat %d.%m.%Y %H:%M:%S\n") )
# write the FTblocks
for key in self.__blocks:
objs = self.__blocks[key].contents
if key != NO_BLOCK:
if np.size(objs)>0:
out.append("\n")
out.append("%%% FTblock " + key + "\n")
writeBlock()
out.append("%%% FTend " + key + "\n") out.append("%%% FTend " + key + "\n")
# write the NO_BLOCK blocks
for key in self.__blocks:
objs = self.__blocks[key].contents
if key == NO_BLOCK:
if np.size(objs)>0:
out.append("\n")
writeBlock()
# now loop through all the nodes and get any gauss commands # now loop through all the nodes and get any gauss commands
for key in self.nodes.getNodes(): for key in self.nodes.getNodes():
txt = self.nodes.getNodes()[key].getFinesseText() txt = self.nodes.getNodes()[key].getFinesseText()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment