Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4148

R8 problem with scripted _-Import and PDF

$
0
0

Hi there,

i got an R7 script which imports a PDF file using below syntax:

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)
if not rc:
    print "Error - failed to import file: {}".format(file_path_name)
    scriptcontext.doc.Views.RedrawEnabled = True
    return

it runs fine in R7 but R8 prints this to the CommandHistory window:

Name of the file to import ( Browse ): “C:\Temp\MyFile.pdf”
Successfully read file “C:\Temp\MyFile.pdf”
Command: _PreserveUnits=_Yes
Unknown command: _PreserveUnits=_Yes
Error - failed to import file: C:\Temp\MyFile.pdf

The file imports fine but the script shows me my own error message because rc which is returned from rs.Command() is not True.

After investigation i’ve found that scripting _-Import to suppress the dialog does not show any command line options at all when a PDF file is chosen using the Browse option. Is this intended now that Rhino.FileIO.FilePdf.Read exists in R8 ?

thanks,
c.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4148

Trending Articles