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

  1. /* POYLPT2.C  (c)1994, Anthony Hotchkiss */
  2.  
  3. int polypt2 (void)
  4. {
  5.    struct resbuf *elist, *item, *cblks, from, to;
  6.    ads_matrix xmat;
  7.    ads_name ename;
  8.    ads_point pt, pnew, pnew2;
  9.    int x; 
  10.    x = ads_nentselp(NULL,ename,pt,0,xmat,&cblks);
  11.    if (x != RTNORM) 
  12.       return RTERROR;
  13.    ads_redraw(ename, 3);
  14.    ads_getpoint(NULL,"\nEnter a new point: ",pnew);
  15.    from.restype = RTSHORT;  /* Note that a coordinate  */
  16.    to.restype = RTSHORT;      /* transformation is made */
  17.    from.resval.rint = 1;   /* on the selected new position  */
  18.    to.resval.rint = 0;       /* of the vertex to be moved. */
  19.    x = ads_trans(pnew,&from,&to,0,pnew2); 
  20. /*  The ads_trans function is used to transform the user
  21.    supplied new point from its current UCS to the world
  22.    coordinate system before the ads_entmod change is made */
  23.    if (x != RTNORM) 
  24.       return RTERROR;   
  25.    elist = ads_entget(ename);
  26.    for (item=elist; item; item = item->rbnext)
  27.       if (item->restype == 10)
  28.          {
  29.             item->resval.rpoint[X] = pnew2[X];  /* replace X  */
  30.             item->resval.rpoint[Y] = pnew2[Y];   /* replace Y  */
  31.             item->resval.rpoint[Z] = pnew2[Z];   /* replace Z  */
  32.             ads_entmod(elist);  /*  modify the sub entity  */
  33.          }
  34.    ads_entupd(ename);  /*  modify the entire entity  */
  35.    if (elist != NULL) 
  36.       ads_relrb(elist);
  37.    if (cblks != NULL) 
  38.       ads_relrb(cblks);
  39.    ads_retvoid();
  40. } /* polypt2 */
  41.