Page 1 of 7

SolidWorks Exporter

Posted: Sat Jul 21, 2007 10:32 am
by jeffr
I have have finally completed a SolidWorks exporter to a point where I can share it for testing.

I have made two versions. One version exports all the geometry data into one Indigo file in Indigo format(Indigo_Geometry_Export). The other version exports the geometry in an OBJ file that is linked to the Indigo file.

It's still not up to the level I want it but I'm hoping some SW users get hold of this and want to help get it there.

I can also use any other help with some of the more Indigo specific things like materials, etc.

Right now I can't make use of any materials that need uv coordinates (albedo or bump mapped) . I can't see where SW can give me any uv's and don't know how to generate them from the geometry data I do get.

Place the macro into a folder you create "C:\Program Files\SW_Indigo_Exporter" and also create a folder within this folder called Materials. Any materials will be put in this folder. A button can be added to the SW toolbar to call the macro.

To use materials the user simply picks a material from the list in Solidworks as they might normally assign a material. There needs to be a corresponding material file in the Materials folder. Example - you can assign Chrome to a part in SW. If you have a material file called Chrome, it will be used by that part and the final rendering will show this part to be Chrome.

Because of some naming issues I found with some materials I suggest creating a new material library in SW with custom named materials that use one word names. ( I ran into problems where SW has materials called 'Cast Carbon Steel' , 'Cast Stainless Steel', etc. It sees both only as Cast. Not sure if this is the case with both versions but is with the OBJ export version.)

I could use help getting material files created for different materials for the library if anyone is interested. I also could use some help from anyone else who knows anything about the SW API programming.


*****Edit***** Now it's strictly one version. The exporter exports the model geometry into an obj file and creates an Indigo scene file that calls it.
At the moment the appearance settings in Solidworks do not do anything other than match the colour.

Change the settings for appearance by right clicking the part name in the left panel of an assembly and selecting appearance .

Posted: Sat Jul 21, 2007 4:51 pm
by OnoSendai
Great, thanks Jeffr!

Posted: Sun Jul 22, 2007 2:51 am
by jeffr
I'm motivated by having the use of such a great renderer :wink:

Posted: Fri Jul 27, 2007 7:32 am
by xrok1
this is what i get when i try to use it. i'm using solidworks '06 if that helps.

P.S thank you soooo much this is great! :P

Posted: Fri Jul 27, 2007 7:49 am
by xrok1
this is what i get in the debugger.

Posted: Fri Jul 27, 2007 8:01 am
by jeffr
xrok1

are you rendering a part or an assembly? (**edit - silly me, I can see it's a part from where it stopped. I'll dig into it and see if I can fix it )

I've really neglected to test with a part file it's always been assemblies. I also have a problem with sub-assemblies within an assembly right now.

I have some updates that I'll get up soon. I've solved my UV problem (I think) so textures and bump maps can be used, I've been able to get the colour, difuse, specularity etc. from solidworks now so materials can be created and used on the fly right out of solidworks.

Oh yes I just remembered. I forgot to include the light meshes in the download. If you convert sw lights it won't work for you at the moment. (until I fix the download)

It's still in the early stages so forgive me for the bugs but I think it's going to be pretty good once it gets the kinks worked out.

Anythink that you think would improve the interface or anything else let me know. I appreciate your feedback.

Cheers
Jeff

Posted: Fri Jul 27, 2007 8:34 am
by xrok1
here my attempt at an assembly.

can't comment on the interface i havn't seen it yet :lol: expect lots of suggestions/comments from me, and i'll help if i can.

i can't tell you how excited and appreciative i am that you're doing this.

Posted: Fri Jul 27, 2007 8:43 am
by xrok1
maybe this thread could get moved to the forum index since i think its officially an exporter now. i'm sure it would get a lot more feedback if it were more visible. did i mention how great this is.

P.S even if the macro only worked with assemblies one could still insert their single part into an assembly so don't sweat it.

Posted: Fri Jul 27, 2007 8:51 am
by xrok1
there is one more thing i think solidworks has always lacked and since you're code is already going looking the materials, maybe you could add a little form for select by material. this is a real pain in SW cause you have to select every single face manually (if you don't want to paint the whole feature, body...) and if you want to change it later you have to do it all again. it would be like grouping by material which should be standard anyway but isn't for some strange reason.

P.S i wish i could code the SW api like you can, i'd add a lot of common sense functionality the program lacks. but alas i've only writen a couple of macro's, nothing too complicated. it seems their API info is hard to come by and even harder to discifer. if you have some good info on it i'd appreciate a copy and would love to help you where i could.

Posted: Fri Jul 27, 2007 8:57 am
by jeffr
hmmm

that last problem is a mystery.
I tried something on the assumption you were running the macro by going Tools->Macro->Run and then loading the macro and I got the same problem.
What's strange is that I've made a custom button to run the macro and it works fine that way.

Try this and see if you get it to work. (In case you don't already know this)
Right click on the toolbar. Select 'Customize. Go to the Commands tab and select Macro. Click on the icon for 'New Macro Button' and drag it to the toolbar. In the popup window under action where it say Macro browse to the macro so it goes in here. Click ok.

Try running it now from this and let me know if it brings up the interface.

Posted: Fri Jul 27, 2007 9:08 am
by xrok1
yes that works to bring up the interface but now i get runtime error '91' when i hit the export button.

P.S not to get side tracked but did you see my P.S i added to my last post?

Posted: Fri Jul 27, 2007 9:28 am
by xrok1
i got rid of the runtime error '91' by adding a camera.

then i got a path error so i renamed my indigo directory to just indigo, it was named (\indigo_08_stable) even though i had the indigo.exe path named correctly in your form it didn't work till i did this change.

now i get this with .obj or .igi export. and when i go to the SW_Indigo_Exporter dir. the only file in there is an .ini file which contains the indigo.exe path.

Posted: Fri Jul 27, 2007 9:37 am
by jeffr
I just uploaded exactly what I have at the moment. That way we can be at the same place.

Sorry I don't really have any documentation to direct you to for macro's. I've just doing allot of experimenting with the examples etc. in the API help file. If you go to http://www.solidworks.com/pages/service ... pport.html there are more resources there. Feel free to pick my brain all you want. I don't think of myself as much of a master either but I'll help if I can.

Posted: Fri Jul 27, 2007 9:38 am
by jeffr
The light thing will be fixed with the updated files.
This one is a 'dummy me' moment for not including it in the first place.

Posted: Fri Jul 27, 2007 9:57 am
by xrok1
ok my bad. i didn't copy the macros to \SW_Indigo_Exporter. now i can get the geometry_export to work but not the indigo_export to work.

BUT...here is the result.