SilverScreen Solid Modeler



Previous topic Next topic  


Previous topic Next topic JavaScript is required for the print function  




SS_FACET_HANDLE prim_facets_collect(OBJECT_NODE *obj, PRIM_NODE *prim)



OBJECT_NODE *obj;   // A pointer to the OBJECT_NODE parent of prim

PRIM_NODE   *prim;  // A pointer to a PRIM_NODE




#include "silver.h"

#include "ssnodes.h"


The prim_facets_collect function facets a primitive, that is it represents a primitive by an approximation of lines.




obj is the object entity that contains prim

prim is the primitive that is to be faceted



Return Value

prim_facets_collect returns a handle that can be used to retrieve information about prim's facets if successful, otherwise it returns NULL




You must call prim_facets_release with a handle you obtained from prim_facets_collect when you are finished with it. If the primitive has holes, those facets will also be retrieved.



See Also

prim_facet_get, prim_facets_release, prim_facets_count




The following example allows the user to select a circle from the current drawing, then generates an object with a prefix of "facet" in the root block that contains the circles facets:

C / C++ Code


 #include "silver.h"

 #include "ssnodes.h"



 void main(void)


    char              prim_path[512];

    OBJECT_NODE       *obj;

    PRIM_NODE         *prim;


    SS_FACET_INFO     fi;

    int               i;



    if ( ! pick_primitive("Select a circle to facet",

                           BITS_CIRCLE, prim_path) )



    prim = get_prim(prim_path, &obj);


    if ( fh = prim_facets_collect(obj, prim) )


       ss_command("goto block \\");

       ss_command("create object facet*");


       ss_command("pen current color light-red linestyle solid width 1");


       for (i = 1; i <= prim_facets_count(fh); i++)


          if ( prim_facet_get(fh, i, &fi) )


             // Create the facet lines


             ss_command("draw line %z %z", &fi.points[0], &fi.points[1]);