How to create sample parts in solidworks using .net c#?
Please guide me.
Start SolidWorks and then create a part.
You should find some API examples on SolidWorks website.
There is also .net tutorial in SolidWorks tutorials.
You can also download SolidWorks SDK with .net templates
I searched API samples and Tutorials.. The page is not displayed..
How to create sample parts in SolidWorks using .net?
Please send code or link..
If you install the api sdk, you will get some samples if you use the templates.
For further reference see Solidworks API reference.
After Installing the api sdk, I did not get the code.
I could not find API for creating parts in solidworks using c#.
The page is looking the same as above image..
It should add template to Visual Studio.
Perhaps there is such addin in API training files. You can find them on SWX website.
If you just want to create a new part this should work:
static void Main()
Type lvSolidworksType = Type.GetTypeFromProgID("SldWorks.Application");
SldWorks SWApp = Activator.CreateInstance(lvSolidworksType) as SldWorks;
string PartPath = SWApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);
ModelDoc2 NewModel = SWApp.NewDocument(PartPath, 0, 0, 0);
SWApp.Visible = true;
On my workstation references required are located in:
C:\Program Files\SolidWorks Corp\SolidWorks
libraries needed for this example are:
To add references in VS (at least in 2012):
Solution explorer -> right click you project's References -> Add reference -> Browse
Retrieving data ...