Importing Solidworks (sldprt) files into Grasshopper

Hi Guys

I am writing a definition to import CAD file (solidworks sldprt format).

Background:
Due to the nature of solidworks files, the up axis is Y and not the conventional Z, hence, this checkbox exist prior to import sldprt into Rhino

I would like to know if there is any way to make sure that the “Map Solidworks Y to Rhino Z” is always disabled?

FYI: I am using Pancake plugin for the file import and I have no idea what to input. Or a python script or something?

Hope you can help me on this.

Thanks in advance!
Chua

1 Like

@tim do you know if this is possible?

I looked at the code for the plugin and the default for that setting is true (checked). However, the settings for that plugin are supposed to get saved between runs and sessions. If you open an SW file once (plain Rhino, not in GH) and uncheck that, and then try it again, does it remain unchecked? What about if you close Rhino and the reopen and try again, still unchecked? If it remains unchecked then I think you can be pretty sure that anything using that plugin will use those options.

In V8 there is a way to open files (SW included) and set all of the options in your code and not present any UI. Unfortunately, I’m not up to speed on how to do that with GH. There are lots of talented people on the forum that can chime in though.

Let me know if this isn’t what you’re asking because I’m not sure I understood what you were asking.

Tim

@tim I think you are referring to this method? Looks like there is a slight error in that document file, where it refers to Sketchup options, but other than that @chuachinghong I think that is what you should be able to use. I suspect instead of the Sketchup Options you should be able to make this work using the SolidWorks read options.

Yes, that is the method I was referring to. I don’t know how to get to that page to fix the skp error. Do you know how to do that? I’ll make sure the comments in the source code are right in case it’s generated from that.

Good catch. The code was wrong. In fact, Rhino.FileIO.FileSW.Read would have worked for diddly since it was asking for sketchup options. Fixing that now.

1 Like