Skip to content

Commit

Permalink
fix code for Switch
Browse files Browse the repository at this point in the history
  • Loading branch information
sunilshetye committed Dec 26, 2024
1 parent 5702c53 commit 07268b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 1 addition & 2 deletions blocks/Xcos/XmlParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def mergeLinks(vertex, key1, graph_link, removable_link):

sourceVertex = node.attrib.get('sourceVertex') # small link
targetVertex = node.attrib.get('targetVertex') # small link

if sourceVertex in link:
node2 = nodeList[sourceVertex]
link_data2 = edgeDict[sourceVertex] # big removed link
Expand Down Expand Up @@ -799,7 +799,6 @@ def mergeLinks(vertex, key1, graph_link, removable_link):
if sourceVertex not in LINKTOLINK and targetVertex not in LINKTOLINK:
continue


try:
point = {'x': nodeList[sourceVertex].attrib['tarx'], 'y': nodeList[sourceVertex].attrib['tary']}
result, i, left_array, right_array = identify_segment(LINKWAYPOINTS[sourceVertex], point)
Expand Down
2 changes: 1 addition & 1 deletion blocks/Xcos/blocks/STEP_FUNCTION.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def STEP_FUNCTION(outroot, attribid, ordering, geometry, parameters, parent=1, s
Array = addSuperBlkNode(SuperBlockDiagram, TYPE_ARRAY,
a="context",
scilabClass="String[]")
superAddNode(Array, TYPE_ADD, value="")
superAddNode(Array, TYPE_ADD, value=" ")

mxGraphModel = addmxGraphModelNode(SuperBlockDiagram,
TYPE_MODEL, a="model")
Expand Down
18 changes: 13 additions & 5 deletions blocks/Xcos/blocks/Switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,20 @@ def Switch(outroot, attribid, ordering, geometry, parameters, parent=1, style=No
for param in additionalScilabStrings:
addDataData(additionalStringNode, param)

realParts = ["0.01", "100000.0"]
additionalStringNode = addDataNode(nestedArrayNode,
'ScilabDouble',
height=2, width=1)
nestedNestedArrayNode = addArrayNode(nestedArrayNode,
scilabClass="ScilabList")
additionalDataNode = addDataNode(nestedNestedArrayNode,
'ScilabDouble',
height=1, width=1)
realParts = ["1.0E-5"]
for i, realPart in enumerate(realParts):
addDData(additionalDataNode, column=0, line=i, realPart=realPart)
realParts = ["1.0E8"]
additionalDataNode = addDataNode(nestedNestedArrayNode,
'ScilabDouble',
height=1, width=1)
for i, realPart in enumerate(realParts):
addDData(additionalStringNode, column=0, line=i, realPart=realPart)
addDData(additionalDataNode, column=0, line=i, realPart=realPart)

addgeometryNode(outnode, GEOMETRY, geometry['height'],
geometry['width'], geometry['x'], geometry['y'])
Expand Down

0 comments on commit 07268b8

Please sign in to comment.