Reply

Macro for exporting a curve coordinates to excel

Hello!

 

Since I have no experience with programming, I hope that someone here on the forum can help me with this problem.

I would need a x,y,z coordinates of a Solid Edge curve exported to Excel.
1. curve is created with any kind of curve command (curve in sketch, keypoint, intersection, project, cross, etc.)
2. reference coordinate system is created by the user
3. x,y,z coordinates of curve, according to this reference coordinate system should be exported to excel

 

How I think, such a macro should work:
1. user is selecting this new macro/command
2. user is now selecting one curve or all curves
3. user can select the number of points on the curve. At least 500 points should be exported. If more curves are selected, then every curve has the same number of points.
4. point should be equaly distributed along the curve
5. now, xyz coordinates are exported to Excel

 

Format of exported curves in Excel:
1. cell A1 is name of the curve (name of the curve in Pathfinder)
2. from second row on there are xyz coordinates (first column is x, second column is y and third is z column)

3. all exported curves are copied in the same sheet. So, after the last coordinate, new curve is written (first the name of the curve, then all the coordinates).

 

If this is possible to create, I would really appreciate.
If it is to much work to do for such a macro and can not be created for free, let me know.

 

Thanks.
Kind Regards.

13 REPLIES

Re: Macro for exporting a curve coordinates to excel

The macro you are asking is surely possible but it would require an ammount of time to develop it.

My main concerns are about your point 4.
I had a look at SDK and it seem to be possible, but it will need some time to develop it correctly.

Eventually PM me for further infos.

Francesco

Re: Macro for exporting a curve coordinates to excel

[ Edited ]

I have done this before. It's a piece of cake.

Can make the macro both free (for personal use) and paid (if you are a reseller).

   

~Tushar

 

Re: Macro for exporting a curve coordinates to excel

I had a look at the APIs and wonder how do you populate the curve collection to use the GetParamAtLenght method.

 

Thanks

Re: Macro for exporting a curve coordinates to excel

[ Edited ]

Solid Edge API help is of little or no use.

Generally, I look up Solid Works on line API help for general understanding and the plentiful examples since these basic curve functions are almost similar  in name and behavior.

 

I think Param is the range of the curve from 0 to 1

and this function is used to calculate the length of a segment of the curve over a range of two params - starting and ending.

for e.g. length of segment between params 0.26 to 0.82 which roughly correspond to 26% and 82 % of the length.

Other similar functions are Evaluate, GetLengthAtParam, GetParamAtPoint, GetPointAtParam, etc. of which I find myself using the last one more frequently.

Re: Macro for exporting a curve coordinates to excel

Yes I know hot that method works, my question is how do you populate the curve collection to be able to use it. For my enderstanding this methods are available only in the curve collection but I don't know how do I put for example keypointscurve in this collection.

Thanks

Re: Macro for exporting a curve coordinates to excel

Hello Francesco:

 

I am sorry about not being able to understand the question correctly.

Where is the curves collection argument ?

 

2016June22_01.png

 

For KeyPointCurve, the closest function is GetAllPoints and it does not seem to return 500 points as expected in Pt. (3) of the initial post.

 

2016June22_02.png

Re: Macro for exporting a curve coordinates to excel

I found the method GetPointAtParam be part of the curve object, the KeyPointCurve object, as you said, doesn't have this method.

I then found the GetPointAtParam being part of Edge objects that I can found in the construction bodys.
Now I need a way to find what edge belong to a specific KeyPointCurve feature.

Re: Macro for exporting a curve coordinates to excel

[ Edited ]

@Tushar said:

"Solid Edge API help is of little or no use.

Generally, I look up Solid Works on line API help for general understanding and the plentiful examples since these basic curve functions are almost similar  in name and behavior."

Is that not a sad commentary?

Bruce Shand
ST9 MP8 - Insight - Win10 - K4200

Re: Macro for exporting a curve coordinates to excel

@bshand

I am looking up the meaning of the phrase "sad commentary" on Google but no results so far.

We rarely use that combination of words in this part of the English speaking world.

   

Yes, it does make me feel sad when the API help proves to be of little or no help.

What is the meaning of the phrase you used ?