Closed demisjohn closed 8 years ago
Eric (@estanton22), I see in _Waveguide.py, you have (line 423):
if update_node:
overwrite=True
node_num = self.num
else:
N_nodes = fimm.Exec(nodestring + ".numsubnodes()")
node_num = int(N_nodes+1)
wgString = self.parent.nodestring + ".addsubnode(rwguideNode,"+str(self.name)+")"+"\n" # make RWG node
self._checkNodeName(nodestring, overwrite=overwrite, warn=warn) # will alter the node name if needed
self.num = node_num
But if update_node=True
you don't want _checkNodeName
to delete the node.
Instead, move checkNodeName
into the conditional, so it only runs if update_node=False
, like so:
if update_node:
#- - removed overwrite
node_num = self.num
else:
#- - added checknondename here
self._checkNodeName(nodestring, overwrite=overwrite, warn=warn) # will alter the node name if needed
N_nodes = fimm.Exec(nodestring + ".numsubnodes()")
node_num = int(N_nodes+1)
wgString = self.parent.nodestring + ".addsubnode(rwguideNode,"+str(self.name)+")"+"\n" # make RWG node
self.num = node_num
This is implemented in d0004d176bdcc0a73e1a6be6d61fe7c07ec953f3
optional argument
add_nodes=True
.Put corresponding conditional on each line that actually adds a new node (as opposed to updating some value).
Eg. Orig:
New:
But leave all lines that don't add a new node, such as