Hi everyone,
I have a tube with walls made out of honeycomb lines. I have the coordinates of the points in a text file and I'm able to import them in Solidworks(API). I've managed to create 3D sketch lines according to the point cloud. For the next step, I'm trying to create small cylinders around each of those lines. To do that I want to create a referance plane which is perpendicular to each line. And after this I want to create circles and extrude them as seen in the following picture.
I've written this code in API:
Dim swApp As Object
Dim skSgment As Object
Dim boolstatus As Boolean
Dim swRefPlane As SldWorks.RefPlane
Dim swSelMgr As SldWorks.SelectionMgr
Dim swRefPlaneFeatureData As SldWorks.RefPlaneFeatureData
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
swApp.ActiveDoc.ActiveView.FrameState = 1
Dim skSegment As Object
Open "C:\Users\mylaptop\Desktop\honeycomb.txt" For Input As #1
swModel.SketchManager.Insert3DSketch True
Do While Not EOF(1)
Input #1, X1, Y1, Z1, X2, Y2, Z2
Set skSegment = swModel.SketchManager.CreateLine(1000 * X1, 1000 * Y1, 1000 * Z1, 1000 * X2, 1000 * Y2, 1000 * Z2)
Dim myRefPlane As Object
Set myRefPlane = swModel.FeatureManager.InsertRefPlane(1000 * X1, 1000 * Y1, 1000 * Z1, 0, 0, 0)
Loop
Close #1
End Sub
However, this code doesn't work for me. I'd be happy if someone can help me with this problem.