I use python for some scripting tasks in Vectorworks (CAD application). Vectorworks offers a visual programming interface like grasshopper with python under the hood called 'marionette'.
Now I have the following problem. Vectorworks offers a string 'node' to allow to input strings. Works great but: if I try to input text with a line break by pressing ctrl+ enter between two words the python code stops with an error message: 'EOL while scanning string literal'.
The underlying python code of the sting 'node' is as follows. Question: is there a way to modify the code in a way to accepting strings with line breaks?
The problem is: the user is making the input by entering text in a dialog that is served by the parent application (Vectorworks).
So the only way to solve the problem is to figure out how to modify the code shown below to cope with the input. The 'core' of the code is only made by two lines as it seems. Therefore it may be impossible to solve the problem?
Any help appreciated, kind regards, Um
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
#Name
this = Marionette.Node( 'String' )
this.SetDescription('A text string defined in the OIP')
#Input Ports
#OIP Controls
String = Marionette.OIPControl( 'string', Marionette.WidgetType.Text, '')
String.SetDescription('A text string')
#Output Ports
s = Marionette.PortOut()
s.SetDescription('The string')
#BEHAVIOR
def RunNode(self):
#inputs
s = self.Params.String.value
#script
#outputs
self.Params.s.value = s