home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / cad / autocad / 1571 < prev    next >
Encoding:
Internet Message Format  |  1992-11-24  |  2.8 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!charnel!rat!zeus!rrenzett
  2. From: rrenzett@zeus.calpoly.edu (Roberto Bertini Renzetti (aka "Bert Bert Renzo"))
  3. Newsgroups: alt.cad.autocad
  4. Subject: Help with ADS_ENTNEXT/ADS_SSGET
  5. Message-ID: <1992Nov23.200136.400399@zeus.calpoly.edu>
  6. Date: 23 Nov 92 20:01:36 GMT
  7. Organization: California Polytechnic State University, San Luis Obispo
  8. Lines: 80
  9.  
  10. Hi !
  11.  
  12.     I need to access an attribute value of a block but I was not able
  13. to do it using the combination of ads_ssget and ads_entnext like the ADS 
  14. manual suggests... To test the hint given by the manual I wrote the following
  15. function, list_dxf, that (theorically) would print out all the dxf codes
  16. of the entity selected. If the entity cointains sub-entities (in my case
  17. its a block with attributes), I should be able to see the dxf code and value
  18. of the attribute.
  19.  
  20.     HOWEVER... the program crashes (after printing "checkpoint 1" and before
  21. printing "checkpoint 2")... And it crashes with style ;-)  
  22. Autocad prints out "Internal error: SCANDR 5" and kicks me out of the 
  23. drawing editor.
  24.  
  25.     Did anyone ever used ads_ssget/ads_entnext to succesfully retrieve
  26. an attribute's value? Am I doing something totally wrong? (I enclosed the
  27. listing ahead).
  28.  
  29. Any hints or comments will be REALLY appreciated... Thanks!!!
  30.  
  31. Roberto Renzetti
  32. (rrenzett@nike.calpoly.edu)
  33.  
  34.  
  35. PS: While trying to figure out the problem, I did several experiments. I found
  36. out that ads_ssget and ads_entsel return different addresses (ads_name) for
  37. the same block. If both return the ads_name of the main entity why are the
  38. ads_names different?
  39.  
  40. PS2: Ooops ! Almost forgot to say: I'm using ACAD r. 11 on a HP 730 under UNIX. 
  41.  
  42.  
  43.  
  44.  
  45. /*****************************************************************************
  46.    list_dxf()
  47.  
  48.    Prints the DXF codes of a selected entity.
  49. *****************************************************************************/
  50. void list_dxf()
  51. {
  52.   struct resbuf *objrb, *temprb;
  53.   ads_name objname, ssname;
  54.   ads_point pt;
  55.  
  56.  
  57.   ads_printf ("Please select an object (ssget): \n");
  58.   /* The user will be asked to select the object by point and click */
  59.   if (ads_ssget(NULL, NULL, NULL, NULL, ssname) != RTNORM)
  60.   {
  61.     ads_printf(" Didn't find anything with SSGET...\n");
  62.     return;
  63.   }
  64.  
  65.   ads_printf("Checkpoint 1\n");
  66.   /* this should loop over the subentities */
  67.   while ( ads_entnext (ssname, objname) == RTNORM)
  68.   {
  69.     if (ads_usrbrk() ==1)
  70.       break;
  71.  
  72.     ads_printf("Checkpoint 2\n");
  73.     objrb = ads_entget (objname); 
  74.     
  75.     ads_printf("Checkpoint 3\n");
  76.     if (objrb != NULL)
  77.     {
  78.        ads_printf("Checkpoint 4\n");
  79.        for (temprb = objrb; temprb != NULL; temprb=temprb->rbnext) 
  80.          printdxf(temprb);  /* same printdxf as in the ADS manual */
  81.     }
  82.     else
  83.        ads_printf ("Didn't find anything within loop of entnext...\n");
  84.  
  85.     ads_relrb(objrb);
  86.     ads_relrb(temprb);
  87.   }
  88.  
  89. }
  90.