AnsweredAssumed Answered

Importing objects using a macro

Question asked by Matt Nixon on Apr 16, 2013
Latest reply on Apr 25, 2013 by Matt Nixon

I'm sure this is a very basic question (please excuse my ignorance, I am not a regular solidworks user), but I haven't been able to find any information on it (quite possibly searching the wrong terms).


Currently, I'm importing a list of 3D coordinates from a text file using a macro somebody had posted on another forum (below). What I would actually like to do is have spheres (all same diameter), with their centre at each coordinate point. I'm guessing I could do this either via altering the macro to place a sphere at each coordinate, rather than just a point, or by changing the points to spheres once imported?


If anybody could suggest an edit to the macro script or otherwise explain how to achive this, that would be great!



The macro script:


Dim swApp As Object

Sub main()


Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

swApp.ActiveDoc.ActiveView.FrameState = 1

Dim skPoint As Object


Open "D:\Spiloxene\Modelling RCP\March 13\22 15^3 box\xyz.txt" For Input As #1

Part.SketchManager.Insert3DSketch True

Do While Not EOF(1)

Input #1, X, Y, Z

Set skPoint = Part.SketchManager.CreatePoint(X, Y, Z)


Close #1


Part.ShowNamedView2 "*Iscmetric", 7


End Sub