Feb-24-2019, 08:04 PM
Hi there this is how it looks like BEFORE and AFTER, for the problem am trying to solve using Python. I have been trying for weeks. And am failing so miserable to tell python to do the following:
STEP1: If you find on this document: "LinkedTo=" (Example value: Node_3)
STEP2: Then Stop
STEP3: Go to the previous NodePosX= and copy the value (Example value: 10)
STEP4: Go to the previous NotePosY= and copy the value (Example value: 100)
STEP5: Then find the next "Node_3" on the document
STEP6: And replace inside the NodePosX=30 and NodePosY=300 for the copied values 10 and 100
STEP7: Then look for the next "LinkedTo=" (Example value: Node_5) and repeat the STEP2 to STEP5
This is how it looks like BEFORE runing the Python script:
Any better sugestions for the title to this problem?
Best regards!
STEP1: If you find on this document: "LinkedTo=" (Example value: Node_3)
STEP2: Then Stop
STEP3: Go to the previous NodePosX= and copy the value (Example value: 10)
STEP4: Go to the previous NotePosY= and copy the value (Example value: 100)
STEP5: Then find the next "Node_3" on the document
STEP6: And replace inside the NodePosX=30 and NodePosY=300 for the copied values 10 and 100
STEP7: Then look for the next "LinkedTo=" (Example value: Node_5) and repeat the STEP2 to STEP5
This is how it looks like BEFORE runing the Python script:
Output:Begin
----Name="Node_1"
----NodePosX=10
----NodePosY=100
----LinkedTo=Node_3
----LinkedTo=Node_5
End Object
Begin
----Name="Node_2"
----NodePosX=20
----NodePosY=200
End Object
Begin
----Name="Node_3"
----NodePosX=30
----NodePosY=300
End Object
Begin
----Name="Node_4"
----NodePosX=40
----NodePosY=400
End Object
Begin
----Name="Node_5"
----NodePosX=50
----NodePosY=500
End Object
This is how it should look like AFTER runing the Python script:Output:Begin
----Name="Node_1"
----NodePosX=10
----NodePosY=100
----LinkedTo=Node_3
----LinkedTo=Node_5
End Object
Begin
----Name="Node_2"
----NodePosX=20
----NodePosY=200
End Object
Begin
----Name="Node_3"
----NodePosX=10
----NodePosY=100
End Object
Begin
----Name="Node_4"
----NodePosX=40
----NodePosY=400
End Object
Begin
----Name="Node_5"
----NodePosX=10
----NodePosY=100
End Object
Do you think am asking to much from python to do? Any better sugestions for the title to this problem?
Best regards!