4 Replies Latest reply on May 27, 2014 1:12 PM by Brian Catanzaro

    API / Founds Segments, How do you know that segments form a triangle / square / polygon...

    Brian Catanzaro

      The SolidWorks API Help has some great sample code:  Get Sketch Entities Example (VBA).  I've figured out how to use this to list all the line segments, circles, arcs, and ellipses.  However, if lines segments belong to a closed path (e.g. a rectangle, polygon, ...), shouldn't these segments be associated with some type of higher level object?

       

      I want to dump out a list of closed arbitrary polygons (not regular polygons) that a user has created on a sketch plane.  I could sift through all the line segment ends and connect them all.  Is there a more efficient method?

       

      Along the same train of thought, does the API come with a method to check to see if a polygon is a non-simple polygon (e.g. a bow-tie)?  Clearly SolidWorks checks for this when you try to extrude a bow-tie.  Likewise, are there methods to check for polygons that are interior to other polygons (e.g. donut or annulus) or intersecting polygons that cannot easily be extruded?

       

      Thanks!

       

      ( see:  http://www.cs.uu.nl/docs/vakken/ga/slides1.pdf on slide 4 for examples of convex hull, non-simple, and "donut" polygons)

       

      P.S.  Currently I'm working in VBA, but am hoping to eventually migrate to C#