Hello,
I am kinda new the whole Solidworks API thing, but here is what I am trying to do. I am making a stand-alone program, no macros, that my co-workers can use to look up a product according to sizes. Then when they have found the sizes they want, it will allow them to save a solidworks part file with a chosen name and the sizes they selected. I have a part file already drawn, that I will be using as a template. I was planning on having that file be opened, and saveAs to the new location, so that nothing on that will be changed. I then want to access the dimensions of the new file and change those to the sizes that the program has selected. Here is the method that I have so far:
Private Sub setSolidWorksInformation(ByVal loc As String)
Dim swApp As SldWorks.SldWorks
Dim part As SldWorks.ModelDoc2
Dim swIdDim, swOdDim, swLgDim, swHdDiamDim, swHdThkDim As SldWorks.Dimension
swApp = CreateObject("SldWorks.Application")
part = swApp.OpenDoc(getBushingFile(), 1)
part.SaveAs(loc)
swIdDim = part.Parameter("ID@Sketch1")
swOdDim = part.Parameter("OD@Sketch1")
swLgDim = part.Parameter("Length@Sketch1")
If HeadRadio.Checked = True Then
swHdDiamDim = part.Parameter("HeadDiam@Sketch1")
swHdThkDim = part.Parameter("HeadThick@Sketch1")
End If
swApp.ExitApp()
swApp = Nothing
End Sub
I have been successful in pulling the information out of the sketch items, but not been able to store the information into them. Any help would be greatly appreciated.
SolidworksApi macros