home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / may94cad.zip / POLYPT.C < prev    next >
Text File  |  1994-04-25  |  1KB  |  34 lines

  1. /* POLYPT.C  (c)1994, Anthony Hotchkiss */
  2.  
  3. /* Entity modification example */
  4. int polypt (void)
  5. {
  6.    struct resbuf *elist, *item;
  7.    ads_name ename;
  8.    ads_point pt, pnew;
  9.  
  10.    if (ads_entsel("\nSelect polyline: ", ename, pt) != RTNORM)
  11.       {
  12.          ads_alert("No entity selected...");
  13.          return RTERROR;
  14.       }
  15.    ads_redraw(ename, 3);
  16.    ads_getpoint(NULL,"\nEnter a new point: ",pnew);
  17.    ads_entnext(ename,ename);  /* step to the first vertex */
  18.    ads_entnext(ename,ename);  /* step to the second vertex */
  19.    elist = ads_entget(ename);  /* get the dxf list of the vertex */
  20.    for (item=elist; item; item = item->rbnext)
  21.       if (item->restype == 10)  /* find the point group code */
  22.          {
  23.             item->resval.rpoint[X] = pnew[X]; /* replace X */
  24.             item->resval.rpoint[Y] = pnew[Y];  /* replace Y */
  25.             ads_entmod(elist);  /* modify the sub entity */
  26.          }
  27.    ads_entupd(ename);  /* update the sub entity
  28.                                               (also updates the entire entity) */
  29.    if (elist != NULL) 
  30.       ads_relrb(elist);
  31.    ads_retvoid();
  32. } /* polypt */
  33.  
  34.