6 Replies Latest reply on Jul 13, 2015 12:00 PM by Vincent Audet

    Calculate distance between points in differents sketches SolidWorks API

    Vincent Audet

      I have been working on a script for the application SolidWorks since about a month and a half and I would like to make it better since it is pretty slow.

      What my script does :
      1. It tells the user to select some specific component (using advanced Select).
      2. It makes a collection out of those components.
      3. It makes a collection out of those collection because I need them regroup depending of their configuration.
      4. In every component is a sketch with a single sketchPoint. I have to calculate the distance between this point and the origin of a predetermine point in a 3D sketch. So I bring the sketchPoint attach to my component into my 3Dsketch, I calculate, then I delete it.
      5. I Do this for every component (60++)

      The time consuming part is the one where I have to Edit my 3DSketch, bring one point into it, Close the edition, calculate the distance, Edit, delete, close again.

      I am currently doing a more oriented object approach so no more collection of collection, but still my problem stay. I was wondering if the IMath could be useful since I've seen this http://help.solidworks.com/2014/english/api/sldworksapi/Transform_Sketch_to_Model_Example_VB.htm
      but it does seems to work properly.

      Ah and I am aware of the measure tool but it won't work since I need the negative value if my sketchPoint is "behind" my origin.

      Thank you