Import Points from Ascii File?

Aug 23, 2003 10 Replies

Have a list of points given in XYZ Coordinates. My CAM application can import these from a text file if given in the correct format. Anyone know of a way to do this in SolidWorks?



Also, am involved in a little mind exercise on another news group which involves finding the shortest path between 400 points scattered at random across a plane. The routing line feature is the closest thing I am able to find to connecting the dots in an optimised path in SW, but this isn't quite what is required. Anyone know of a feature in SW that can accomplish this. Thanks, Sean


If you are using VB or VBA, try using the API call "Part.CreateLine2"

retval = ModelDoc2.CreateLine2 ( xStart, yStart, zStart, xEnd, yEnd, zEnd ) Input: (double)p1x X value of the line start point Input: (double)p1y Y value of the line start point Input: (double)p1z Z value of the line start point Input: (double)p2x X value of the line end point Input: (double)p2y Y value of the line end point Input: (double)p2z Z value of the line end point Return: (LPDISPATCH) retval pointer to a dispatch object, the newly created SketchSegment object. If the operation fails, then NULL will be returned.

-- Tony O'Hara Melbourne, Australia.

I think he would like to create lines between the points in such a manner that, given a known starting point, goes to all the points with the shortest total distance. Knowing what this distance is would probably be nice too.

HTH

This is known as the "travelling salesman" problem. see

formatting link
for a complete reference. What you need is a program that would "sort" your list of points along the shortest path. Then, a macro such as Tony's above could draw it in SolidWorks. I searched the web for such a program (it should exist) but didn't find one yet that works in 3D. How much would you pay for such a tool ? (I can write one quite easily...)

"What-a-Tool" schrieb im Newsbeitrag news:jcT1b.16130$Zw4.10823@lakeread03...

If you only want to import the 3D points as a pointcloud you may want to try one of my macros. Goto the macro section at

formatting link
and look for the macro called mm_24.zip, this one takes XYZ coordinates and generate a

3D sketch with the points.

HTH, Stefan

you can also have a look at

formatting link
to learn how to convert your points in a STL solid for FREE.

Try "Simulated Annealing" .

formatting link
might be of note as well.

Or just

We are having a nice little thread called "Shortest Path that includes all points" in alt.machines.cnc. All interested are invited. Trolls too .

Thanks for the info - I am already in the process of writing some code to search thru the points for the shortest path. Was hoping there was already a method built into Solid Works for this task to use as a comparison. Saw someone else had gotten results on this task with ProE, and thought maybe SW had something in it that I had never run across. Not really interested in doing the extra work of writing the VBA code to work with SW at this moment though.

Thanks, Sean

is there one point on either side of the sketch that you want it to go from: to: it would take me 5 min to write if so.

with a macro, like Stefan Berlitz said earlier:

I could compile concorde on Windows and it works pretty well in 2D now. Will modify it for 3D and ask Princeton if they allow me to release the code for free, because their license restricts to academic research. Stay tuned.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required