Avoid overwriding again and again, how? - revisioncloud

Hello dynaos,GetSetParameter.dyn (15.4 KB)

my task was to combine comments with the revision number in the comments. It works very well! in my script.
BUT! when i do my script severail times, it is adding the revisionnumber again and again!
How can i avoid that? I would like to have always the actual number of the revison.
the “rerun” should replace the number not add+!

KR

Andreas2019-04-01_11h33_53

2019-04-01_11h38_57

Your probably best to generate some way of creating rules/filtering within your script.

EG if max length is 5 character after the additional element has been added, then you filter out all revision elements that have characters prior to then adding the parameters together.

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

comment = IN[0]
number = IN[1]

for i in comment:
if int(comment) > 4:
x = i.replace(number, ‘’)

OUT = strings

I did something like that, but it doesn`t work, I can count my letter, I can split my strings but i got not deeper! My idea is to replace all caracters after the 4th index by the revisionnumber - but how.

Where is the point where i need a integer@level and when i work with strings direktly.
Can i use codeBlock? I can delete strings but i have to count them! Can say delete all after the 3[index]

2019-04-01_15h29_29

I tried without python code … it is still manualy but it would work to reverse the string to his origin!


Can i put it in a if sentence, maybe true take “in” false take out

right now is writing “function{}” in my comment node :slight_smile: