Solidworks -Macros

I am reaching out for assistance with a macro-related issue in SolidWorks. My goal is to automate the creation of springs from a set of XYZ coordinates provided in a text file. I will briefly explain the workflow I am currently using:

 

1. I prepare a text file containing a series of XYZ coordinates.

2. These points are imported into SolidWorks to define a 3D curve.

3. Using the curve, I create a spring by performing a sweep operation.

4. Once the spring is generated, I ground both ends of the spring at 270 degrees to fix its orientation.

The issue arises when I attempt to record a macro of these steps. While the manual process works fine, the recorded macro does not generalize well. Instead of generating a spring from any imported set of XYZ coordinates, the macro seems tied to the specific points or selections made during the recording.

My request:

I would like guidance (or an example macro code) that can automate this workflow so that:

The macro reads XYZ coordinates from a text file.

A spring is generated along the curve defined by these coordinates.

Both ends of the spring are grounded at 270 degrees, regardless of the coordinate set.

This would help in batch-processing multiple spring geometries without manually recreating the steps each time.

 

Could you please advise how this can be achieved, or provide example code/templates to make the macro more generic?

 

Edu SOLIDWORKS