How to close the prompt by rs?

I’m trying to export 3dm to skp by rhinoscriptsyntax.

However, there’s always a popup to warn me there’s something wrong with the mesh. I have to click the “ok” button to ignore the warning to continue.

Does anyone know how to click the “OK” or ignore the warning with rs? Thanks.

Anybody here?

Hi @devils,

please post the mesh you’re trying to export and the script you have problems with.

_
c.

image

mesh is not a problem.
I’m trying to build a script to export 3dm to skp. The above popup keeps confusing me because I could not close it via rs. Thanks.

It’s telling you there are 8 mesh edges that are not valid and might cause problems in Sketchup. Would have to have a test file to see if there is any workaround to avoid this popping up.

I have huge numbers of these kinds of 3dm. Almost all of them have the above prompt when I try to export.
Attached one of them. Thanks.
canape salon s.3dm (265.5 KB)

That surface is completely awful, no wonder it’s creating a bad mesh on export…

However, if you use the -dash version of the Export command i.e. _-Export, you will get the error message printed to the command line and not the dialog popping up.

Maybe the following batch export/convert script might help:

BatchExportToSKP.py (1.8 KB)

i use the Export Command “_-Export”,but it doesen’t work.

Thanks for your help.
Unfortunately there’s still a prompt during the exporting, which I have to click ‘Ok’ to continute.

Did you try my script above? It works on the file you posted above without the error dialog coming up. It uses SaveAs, not Export, but I think that may not matter. Because on that file as well, here (V7 SR22 RC) if run the -_Export command manually (not in a script), then browse to a location and specify Sketchup as the file format, it exports the file without the error dialog coming up.

The following test script also exports the object in your file above without the error dialog popping up:

import rhinoscriptsyntax as rs

def GetSKPSettings():
    e_str = "_SaveAsType=SketchUp2021 "
    e_str+= "_ExportPlanarRegionsAsPolygons=_Yes "
    e_str+= "_CullUnnecessaryVertices=_Yes "
    e_str+= "_MinimumFaceCount=2 "
    e_str+= "_Enter"
    return e_str

def TestSKPExport():
    objs=rs.GetObjects("Select objects to export",8+16+32,preselect=True,select=True)
    if not objs: return
    
    e_file_name=rs.SaveFileName("Save SKP","Sketchup Files (*.skp)|*.skp")
    if not e_file_name: return
    
    rs.Command('-_Export "{}" {}'.format(e_file_name,GetSKPSettings()),False)
TestSKPExport()

Many Thanks.

I tried your script and there’s no error dialog popped. However, I think I should append more clarifications.

SaveFileName gives out a dialog which let me choose the document and name the output file.

I could not use SaveAs here because this script should not involve any interaction from user before the final output.

OK, now we’re finally getting somewhere.

Yes, that was just a test script to see if the error message dialog on saving could be avoided - which you have seen it can.

There is no need to have any user interaction with either -_Export or -_SaveAs, you just need to supply a valid file name/path to the command string in the script. My script in post #7 above does that.

Feel free to post some code that is not working and someone will look.

Hi @Helvetosaur - Was interested in seeing what this script does, so I tried it out, but received the following pop up (and FYI, no biggie if you don’t get time to reply, but figured I’d post the info.)

image

EDIT: I looked at the script, and the final line calling the script has the wrong word in it: Convert instead of Export

Hmm, odd, I don’t even have that one saved here. Yes, if you change the last line, I guess it should work. Might have been a quick change that I didn’t do correctly but never saved. Thanks for the heads-up. :+1:

1 Like