1 Reply Latest reply on Nov 7, 2013 1:46 PM by Keith Rice

    Generating text files for geometry

    Paul Bradshaw

      I am trying to generate a text file for simple part geometry to load into a x-ray simulation program. I'll need to be able to output the parts center of mass location, orientation, and size and a few other things.  Is there a place where I can research how to do this?  The x-ray programs only supports a few basic geometries, like cylinders and rectangles, and spheres so it shouldnt be too hard.  Being able to model these in Solidworks would take a lot of effort out of the troubleshooting process as there is no 3d viewer in the simulation program.




        • Re: Generating text files for geometry
          Keith Rice

          Hi Paul,


          Welcome to the forums!


          If you're new to the API, you can find a lot of free beginner resources at my site (see link below). If you want to know specifically what API interfaces to use, you'll want to look at IMassProperty. If you want to determine whether a part is cylindrical, you would need to look at methods like ISurface::IsCylinder or ISurface::IsPlane. As for orientation, you could get the normal values of faces (IFace2::Normal) or you could get the transform data using IMathTransform. I will warn you, though, using component transforms with the API can be tough if you're a novice API user. We have a premium tutorial that covers component transforms, FYI. See lesson 5.3.



          SolidWorks API Tutorials