Problem with scripted PDF import (Mac)

Hi there, i am trying to import a pdf file from disc and suppress the command options on mac. Below snipped is run from a script saved on disk and works fine under Windows but not under Mac:

# build command string
cmd = "_-Import {} ".format(chr(34) + file_path_name + chr(34))
cmd += "_PreserveUnits=_Yes "
cmd += "_PDFScale=1 "
cmd += "_Unit=mm "
cmd += "_RhinoScale=1 "
cmd += "_LoadText=_No "
cmd += "_EnterEnd "
rc = rs.Command(cmd, True)

It gets stuck in the command prompt and displays:

Unknown Command: PreserveUnits

it seems, the space after the file path is ignored. If i put in an extra space in front of the second line like so:

cmd += " _PreserveUnits=_Yes "

the command prompt seems to be suppressed as it should, but only for this session. Next time i re-open Rhino for mac and run the same script, it gets stuck in the prompts again. So far i’ve tried even to include the missing space using a charcode like below:

cmd = "_-Import {0}{1}{0}{2}".format(chr(34), file_path_name, chr(32))

but it still gets stuck. I’ve i use above and put another space in front of _PreserveUnits, it works for this session, but after re-opening Rhino for Mac, it gets stuck again in the command prompt.

Is this a bug someone could take a look at or suggest a cross platform solution ?


Just curious if a chr(160) non-breaking space would help? No way here to test…

Hi @Helvetosaur, unfortunately adding chr(160) to the command string makes the import fail.

Overall i’ve spend 2 hours today on this issue trying different ways. Sometimes i think i got it and the prompt does not show up anymore. But as soon as i reopen Rhino and run the script which worked before, it is stuck again at the command prompt which i am trying to suppress.