Created
April 10, 2014 13:56
-
-
Save jseger/10385034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim swApp As SldWorks.SldWorks | |
Dim swModel As SldWorks.ModelDoc2 | |
Dim swSketchMgr As SldWorks.SketchManager | |
Dim swExcel As Excel.Application | |
Dim exSheet As Excel.Worksheet | |
Dim i As Integer | |
Dim xpt As Double | |
Dim ypt As Double | |
Dim zpt As Double | |
Sub main() | |
Set swApp = Application.SldWorks | |
Set swModel = swApp.ActiveDoc | |
Set swExcel = GetObject(, "Excel.Application") | |
Set exSheet = swExcel.ActiveSheet | |
Set swModel = swApp.ActiveDoc | |
Set swSketchMgr = swModel.SketchManager | |
swSketchMgr.Insert3DSketch (True) | |
Dim skPoint As SketchPoint | |
swSketchMgr.AddToDB = True | |
i = 1 | |
Do While exSheet.Cells(i, 1).Value <> "" | |
xpt = exSheet.Cells(i, 1).Value | |
ypt = exSheet.Cells(i, 2).Value | |
zpt = exSheet.Cells(i, 3).Value | |
Set skPoint = swSketchMgr.CreatePoint(xpt, ypt, zpt) | |
i = i + 1 | |
Loop | |
swSketchMgr.InsertSketch (True) | |
swSketchMgr.AddToDB = False | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment