R8 problem with scripted _-Import and PDF

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.

@tim - is this something you can help with?

Hi Clement,

I’ll have a look at that. My guess is that got messed up when I hooked up the ability to import PDF via dotnet. I’ll make myself a YT to pursue this and get on it asap. I’ll link the YT here in a bit.

Thanks for doing the initial research, btw. I’m pretty sure that’s what’s going on based on what you’ve described.

Tim

1 Like

https://mcneel.myjetbrains.com/youtrack/issue/RH-80170/PDF-import-does-not-give-command-line-interface-for-import-open

You get command line options now in (8.5.24033.6001, 2024-02-02) and beyond.

I did notice that if you run -open on the Mac it gives you the dialog UI regardless. Looking into that now. It happens for all plugins though so it’s unrelated to this PDF bug.

Hi @tim, that’s good to know as i’m trying to use the same code to script _-Import on Mac and Win in R7 and R8. I’ll report how that goes.

thanks,
c.

-import works ok on Mac. It’s only -open. This is the YT for that one if you care. https://mcneel.myjetbrains.com/youtrack/issue/RH-80206/Open-on-Mac-does-presents-dialog-UI-not-scripted