Solidworks Design Table
Solidworks Design Table
(OP)
Hello all,
I am looking for some help creating macros in excel/solid works. Let me give you a brief explanation of the project I was assigned, and what I am trying to do. One of our major product lines for the company I work for is machined plastic rings. We currently have ~1,000 different styles, with endless configurations in each style. The dimensions of the ring are based of equations. In most cases I will be imputing a cross section and I.D. dimension, which will drive the equations to create the ring. I just finished drawing all ~1,200 rings in solid works, and linked them to appreciate equations in excel. This is working great, however I was asked to create a button/macro in excel that will do the following.
Open/Save/Close the model and drawing, the model and drawing should be saved as the part number which is derived from the dimension of the part and is located in the cell label part number in excel. I created a example ring, for reference(See attached excel /solid works file). And to make it even more difficult, I need to destroy the link to the design table when it saves each part. Any help I could get would be greatly appreciated!
Thanks you,
David S.
I am looking for some help creating macros in excel/solid works. Let me give you a brief explanation of the project I was assigned, and what I am trying to do. One of our major product lines for the company I work for is machined plastic rings. We currently have ~1,000 different styles, with endless configurations in each style. The dimensions of the ring are based of equations. In most cases I will be imputing a cross section and I.D. dimension, which will drive the equations to create the ring. I just finished drawing all ~1,200 rings in solid works, and linked them to appreciate equations in excel. This is working great, however I was asked to create a button/macro in excel that will do the following.
Open/Save/Close the model and drawing, the model and drawing should be saved as the part number which is derived from the dimension of the part and is located in the cell label part number in excel. I created a example ring, for reference(See attached excel /solid works file). And to make it even more difficult, I need to destroy the link to the design table when it saves each part. Any help I could get would be greatly appreciated!
Thanks you,
David S.






RE: Solidworks Design Table
RE: Solidworks Design Table
--
Hardie "Crashj" Johnson
SW 2010 SP 2.1
HP Pavillion Elite HPE
RE: Solidworks Design Table
.
RE: Solidworks Design Table
1. change the scale of a view in a drawing. ?
2. turn on import annotations(design annotations)?
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
sOutputFolder = Left(swModel.GetPathName(), Len(swModel.GetPathName()) - Len(swModel.GetTitle()) - 7)
vConfs = swModel.GetConfigurationNames()
For i = 0 To UBound(vConfs)
Set swDraw = swApp.NewDocument(sDrTemplate, 0, 0, 0)
Dim swDrawModel As SldWorks.ModelDoc2
Set swDrawModel = swDraw
swDraw.InsertModelInPredefinedView swModel.GetPathName()
Set swView = swDraw.GetFirstView
While Not swView Is Nothing
swView.ReferencedConfiguration = vConfs(i)
Set swView = swView.GetNextView
Wend
swDrawModel.ForceRebuild3 False
swDraw.InsertModelAnnotations3 swImportModelItemsSource_e.swImportModelItemsFromEntireModel, 32776, False, True, False, False
Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("Drawing View4")
boolstatus = Part.ActivateView("Drawing View5")
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateLine(0#, 0.03128, 0#, 0#, 0.05127, 0#)
Dim myView As Object
Dim excludedComponents As Variant
Set myView = Part.CreateSectionViewAt5(0.2062697090198, 0.1044204373142, 0, "B", 20, (excludedComponents), 0)
boolstatus = Part.ActivateView("Drawing View7")
Part.ClearSelection2 True
swDrawModel.Extension.SaveAs sOutputFolder + swModel.GetTitle() + "_" + vConfs(i) + ".slddrw", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, 0, 0
swApp.CloseDoc swDrawModel.GetTitle()
Next
End Sub
Thanks again,
dAVID