Rhino Python Editor Questions

editor
python

#1

Is the current python editor a plugin? If so, is it c#?

Is it possible for one to author an editor using ironpython+eto and:

I seem to be able to run simple scripts using .Execute(), but I am wondering if there is some looming roadblock or hurdle that will eventually make this a bad idea.

Thanks,

Nathan


(Steve Baer) #2

You should be able to do this and if you run into any problems we can probably fix them pretty quick.


#3

OK Thanks. One thing I didn’t understand is that

__name__ == '__builtin__'

If run with .ExecuteScript(). For now, probably dangerously, I am pre-process the script and set

__name__ == '__main__'

in order to test with existing scripts. Am I not setting up the PythonScript object correctly?

Is there more description of the PythonScript object methods/properties somewhere? I looked around on the rhinocommon docs but it doesn’t seem to have any deeper descriptions. Is this some kind of .net object under the hood that perhaps has more documentation out there? I googled around for hosting ironpython but nothing seemed obvious. Is there any further info available in the dll, if I install Visual Studio and use that to view the object?

Switching gears to eto, I cannot get eto.Forms.RichTextArea.Buffer.Delete() to work. I bring it up here because I see:
image
So maybe Range is still in progress? What does the Range’1 mean?

I get this in the exception when using .Delete():

Value cannot be null. Parameter name: textData

I pass it a Range with:

forms.Range.FromLength(1, 2)

I can use the same range with .SetBackground() and it seems to work. I’m not sure how/if I can use Range’1? It doesn’t show up in intellisense, but it seems to match the eto documentation.

Thanks for the info. It is nice to know that I’m not wasting too much time experimenting with this.


#4

Never mind about the RichTextArea questions. I think I won’t worry about it for now. Rtf seems like a lot of overhead to learn, and the CaretIndex doesn’t seem to care about tabs or \r\n, which makes it difficult to know where the caret really is. TextArea seems to count them, so I’ll try that for now.