Import Points from Ascii File?

Discussion in 'SolidWorks' started by What-a-Tool, Aug 24, 2003.

  1. What-a-Tool

    What-a-Tool Guest

    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
     
    What-a-Tool, Aug 24, 2003
    #1
  2. What-a-Tool

    Tony O'Hara Guest

    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, Aug 24, 2003
    #2
  3. This is known as the "travelling salesman" problem.
    see http://www.ing.unlp.edu.ar/cetad/mos/TSPBIB_home.html 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...)
     
    Philippe Guglielmetti, Aug 24, 2003
    #3
  4. 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 http://swtools.cad.de and look for the macro called
    mm_24.zip, this one takes XYZ coordinates and generate a
    3D sketch with the points.

    HTH,
    Stefan

    --

    unofficial german SolidWorks helpsite
    http://solidworks.cad.de
    tools and programs for SolidWorks
    http://swtools.cad.de
     
    Stefan Berlitz, Aug 24, 2003
    #4
  5. you can also have a look at http://www.dynabits.com/sw/point_cloud.htm to
    learn how to convert your points in a STL solid for FREE.
     
    Philippe Guglielmetti, Aug 24, 2003
    #5
  6. What-a-Tool

    What-a-Tool Guest

    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
     
    What-a-Tool, Aug 24, 2003
    #6
  7. 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.
     
    Sean Phillips, Aug 24, 2003
    #7
  8. with a macro, like Stefan Berlitz said earlier:
     
    Philippe Guglielmetti, Aug 25, 2003
    #8
  9. 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.
     
    Philippe Guglielmetti, Aug 25, 2003
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.