LibEagle Nurbs Extension LibOCC 


 

A development API library has been created that extends the LibEagle functions to support NURBS entities.

 The library extension adds the following functions:

 

a.       The OCC_init function is implemented to initialises the library.

 

Sample

 

 

void OCC_init( )
 

 

 

b.  The OCC_libvers function implements display of information relating to the library version.

 

Sample

 

 

void OCC_libvers ( )
 

 

 

c.   The OCC_open_model function is implemented to extend the currently available EIF_open_model function allowing reading and creating of a new type model file according to the changed specification described in the Save section. There are no signature changes with respect to the currently available EIF function.

 

Sample

 

 

void OCC_open_model(cname,length,read_write,firstit,error)

char     *cname;             /* <i> Name of the file to be opened                                    */

                                            /* <o> Name of the file to be open with the extension */

int       *length;              /* <i> Lenght of the file name                                                   */

char     *read_write;    /* <i> Flag read/write                                                                    */

Item   *firstit;                /* <o> Pointer to the first item                                                  */

int        *error;                 /* <o> Error flag                                                                               */

 

 

d.   The OCC_importBREP function is implemented to facilitate loading in the Eagle model the BREP file format described in import section.

 

Sample

 

 

void OCC_ImportBREP( fname, append, firstItem, error )
char    *fname;          /* <i> Name of the file to be imported              */
int        append;          /* <i> append flag                                                       */
Item    *firstItem;     /* <o> Pointer to the first imported  item         */
int         *error;            /* <o> Error flag                                                            */
 

 

 

e.  The OCC_importIGES function is implemented to facilitate loading in the Eagle model the IGES format described in the import section.

 

Sample

 

 

void OCC_ImportIGES( fname, append, firstItem, error )
char   *fname;              /* <i> Name of the file to be imported          */
int      append;              /* <i> append flag                                                   */
Item  *firstItem;         /* <o> Pointer to the first imported  item     */
int     *error;                  /* <o> Error flag                                                        */
 

 

 

f.   The OCC_addShape function is implemented to facilitate loading in the Eagle model an individual TopoDS_Shape entity.

 

Sample

 

 

int OCC_addShape( ptr, frag, style, hatch, fill, id )
unsigned ptr;           /* <i> Pointer to the TopoDS_Shape        */
int      frag;                 /* <i> The fragment of the item                  */
int      style;                /* <i> Linestyle                                                  */
int      hatch;               /* <i> Type of hatch                                         */
int      *fill;                  /* <i> Fill colour                                                 */
int      *id;                    /* <o> Item identificator                                */
 

 

 

g.  The OCC_getShape is implemented to retrieve a pointer to the TopoDS_Shape entity from the given OCC entity defined in the Eagle workspace.

 

Sample

 

 

void OCC_getShape(item_ptr, ptr, pos ,rotmat, max, min, rotflag,
                               strfac, colfill, pen, hatch, layer )
Item           item_ptr;  /* <i>   pointer to the Shape item             */                          
unsigned *ptr;            /* <o> Pointer to the TopoDS_Shape       */
double     *pos;           /* <o>  the position of the Body                 */   
double     *rotmat;    /* <o>  the post-mult rotation matrix      */
int               *rotflag;    /* <o>  rotation flag                                         */   
double      *strfac;      /* <o>  the stretching factors                       */
int               *colfil;,      /* <o>  colour fill                                               */   
int               *pen;          /* <o>  symbology information                   */   
int               *hatch;       /* <o>  hatch type                                              */
int               *layer;        /* <o>  layer                                                         */  

 

 

 

h. The OCC_addNurbsCurve is implemented to create a new Curve entity. This function returns a pointer to the created Curve entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_addNurbsCurve( degree,periodic numCpts, cPts, weights,
                                      numKnots, knots, mults )

int         degree;            /* <i>  degree                                                      */   
int         periodic;          /* <i>  periodic flag                                           */
int         numCpts;         /* <i>  number of control points                  */
double cPts[][3];         /* <i>  control points                                         */
double weights[];       /* <i>  weights on control points                  */
int          numKnots;     /* <i>  number of knots                                     */
double knots[];            /* <i>  knot values                                              */
  
double mults[];            /* <i>  multiplicity values                                */
    

 

 

i.  The OCC_addBezierCurve is implemented to create a new Curve entity. This function returns a pointer to the created Curve entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_addBezierCurve ( rational, numCpts, cPts, weights)
int          rational;           /* <i>  rational flag                                             */
int          numCpts;         /* <i>  number of control points                  */
double cPts[][3];          /* <i>  control points                                        */
double weights[];        /* <i>  weights on control points                 */    
 

 

 

j.  The OCC_initProfile is implemented to initialise the creation of a new Profile entity. It is used in conjunction with the next OCC_addItemToProfile and OCC_terminateProfile.

 

Sample

 

 

void OCC_initProfile( void ) 

 

 

k.  The OCC_addItemToProfile is implemented is implemented to allow adding a new item to the current Profile entity. The new item should be any of the basic Eagle items, among Lines, Arcs, Circles, Curves and also another Profile entity. The new item must be geometrically compatible with the existing Profile, which means that its start point must be coincident according to a specified tolerance to the end point of the existing Profile. Also, the individual components of the Profile must be planar. This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

int OCC_addItemToProfile( itemPointer)
Item itemPointer;      /* <i>  Pointer to the existing item to be added   */
 

 

 

 

l.  The OCC_terminateProfile is implemented to close the creation of a Profile entity. It is used in conjunction with previous OCC_initProfile and OCC_addItemToProfile. This function returns a pointer to the created Profile entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_terminateProfile( erase )
int    erase;          /* <i>  Flag to indicate if the added items must be

                                                           removed from the workspace  */ 

 

 

 

m.  The OCC_convert is implemented to converts one single entity from/to Eagle items to/from OCC-curves, according to the behaviour of the Convert command. This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

int OCC_convert( itemPointer)
Item itemPointer;       /* <i>  Pointer to the existing item to be converted */

 

 

n.  The OCC_extrusion is implemented to allow creating a Surface entity representing a extrusion of a curve between two points. This function returns a pointer to the created Shape entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_extrusion( pointer, p1 , p2 )  
Item     pointer;       /* <i>  Pointer to the Curve item                                  */        
double p1[3];           /* <i>  First point defining the extrusion vector      */   
double p2[3];           /* <i>  Second point defining the extrusion vector */  

 

 

o.  The OCC_revolution is implemented to allow creating a Surface entity representing the rotational sweep of a Curve around an axis by a given angle. This function returns a pointer to the created Shape entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_revolution( pointer, p1, p2 , angle)
Item      itemPointer; /* <i>  Pointer to the Curve item                          */                          
double p1[3];               /* <i>  First point defining the axis                       */   
double p2[3];               /* <i>  Second point defining the axis                 */
double angle;               /* <i>  The angle of revolution, in degrees       */
  

 

 

p.  The OCC_sweep is implemented to allow creating a Surface entity representing the sweep of a Curve along a Spine. This function returns a pointer to the created Shape entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_sweep( curvePointer, spinePointer )
Item curvePointer;       /* <i>  Pointer to the Curve item                 */   
Item spinePointer;       /* <i>  Pointer to the Spine item                 */ 

 

 

q.  The OCC_pointInShape is implemented that allows checking if a point belongs to an entity. If the specified item is a Body then returned values can be:

      1            if the point is inside the entity
      0            if the point is on the entity
     -1            if the point is
outside the entity

If the specified item is a Curve or a Shell then returned values could be:

       0            if the point is on the entity
     -1            if the point is
outside the entity

If the specified item is a Surface then returned values can be:

      0            if the point is on the entity
       1           if the point is in the same direction of the normal.
     -1           if the point is in the opposite direction of the normal.

This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

int OCC_pointInShape( itemPointer, pt, result )
Item      itemPointer;         /* <i>  Pointer to the item to be analysed     */
double *pt;                           /* <i>  Point on the item to be analysed         */
int          *result;                   /* <o>  Result of the check: 0, 1 or -1                 */

 

 

r.  The OCC_CalcSurfaceNormal  is implemented to allow calculating the normal of a Surface given a point on it. This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

int OCC_calcSurfaceNormal( itemPointer, pt,  normal )
Item      itemPointer;    /* <i>  Pointer to the item to be analysed                */
double *pt;                      /* <i>  Point on the item to be analysed                    */
double *normal;            /* <o>  Returned normal                                                  */

 

s.  The OCC_revolveProfile  is implemented to create a shell or a body by revolving a profile around an axis by a given angle. This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

Item OCC_ revolveProfile( itemPointer, p1, p2, angle, solid )

Item       itemPointer; /* <i>  Pointer to the Curve item                                               */   

double *p1;                    /* <i>  First point defining the axis                                           */  

double *p2;                    /* <i>  Second point defining the axis                                      */  

double angle;                /* <i>  Angle of revolution, in degrees                                    */  

int          solid;                  /* <i>  Flag to indicate if a solid or shell is to be created */

 

t. The OCC_sweepProfile  is implemented to create a shell or a body by sweeping a Profile along a Spine. This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

Item OCC_ revolveProfile( itemPointer, p1, p2, angle, solid )

Item      itemPointer;  /* <i>  Pointer to the Curve item                                             */   

double *p1;                    /* <i>  First point defining the axis                                          */  

double *p2;                    /* <i>  Second point defining the axis                                    */  

double angle;                /* <i>  Angle of revolution, in degrees                                   */  

int          solid;                  /* <i>  Flag to indicate if a solid or shell is to be created */

 

u. The OCC_extrudeProfile  is implemented to create a shell or a body by sweeping a Profile along a Spine. This function returns TRUE on success or FALSE on failure.

 

Sample

 

 

Item OCC_extrudeProfile( itemPointer, p1, p2, solid )

Item      itemPointer; /* <i>  Pointer to the profile item                                             */   

double *p1;                  /* <i>  First point defining the extrusion vector                   */  

double *p2;                  /* <i>  Second point defining the extrusion vector              */  

int          solid;                /* <i>  Flag to indicate if a solid or shell is to be created   */

 

u. The OCC_skin  is implemented to create a Shell entity representing the sweep of a Curve along a path. This function returns a pointer to the created Shape entity. A NULL pointer indicates that the creation process returned an error.

 

Sample

 

 

Item OCC_skin( pStart,pEnd,pPath )

Item pStart;               /* <i>  Pointer to the first Curve item                                */                          

Item pEnd;                 /* <i>  Pointer to the second Curve item                           */                          

Item pPath;                /* <i>  Pointer to a Curve item                                               */