Issues with rs.TextExplode on Mac

textentity
ghpythonlib
usertext

#1

Hey,
I’m trying to understand how to script components in python for Mac usage.

Right now I’m trying to make a simple text preview and bake component using the GHpython component. It is meant to preview the text as outline curves since grasshopper has no text object available, and then bake the same text as a rhino text object so that it can be edited further as text in for example illustrator etc. What I’ve writtin so far works fine on my PC, but I’m having issues running the component in the Mac version of Grasshopper.

As far as I understand, I’m supposed to be able to use the RhinoScriptSyntax functions (found here: http://developer.rhino3d.com/api/RhinoScriptSyntax/win/#application) when coding in Python, but the rs.ExplodeText doesn’t seem to work on Mac. It returns the text as a text object one more time and no outline curves, even though “delete” is set to “True”. the rs.AddText only works within the If statement on Mac, and doesn’t continuously output text as it does on my PC.

Here is the GHpython code and attached is an example file:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino as r<a class="attachment" href="/uploads/default/original/3X/0/6/06ea5eb4d68d9d4e288ae8303286483aa4e0f0c8.gh">BakeAsText.gh</a> (7.9 KB)


sc.doc = r.RhinoDoc.ActiveDoc

geoList = []

preText = rs.AddText(text, plane, height, font, font_style=fontStyle, justification=None) #justification = höger/center/vänsterställd text (int type)
textGeo = rs.ExplodeText(preText, True)

for i in textGeo:
    geoList.append(rs.coercegeometry(i))


for i in textGeo:
    rs.DeleteObject(i)

if BAKE == True:
    bakeText = rs.AddText(text, plane, height, font, font_style=0, justification=None)

Would be very grateful for any pointers on what I’m doing wrong? Is it that I cant use the RhinoscriptSyntax functions if I want to run it on Mac? Where can I find a list of Mac compatible functions to call from the GHpython component?

Thanks a bunch for any answer!!


(Giulio Piacentino) #2

Hi @Mertzi

is this still the case? What happens if you run your code with the _RunPythonScript command?

Thanks

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com