home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!charnel!rat!zeus!rrenzett
- From: rrenzett@zeus.calpoly.edu (Roberto Bertini Renzetti (aka "Bert Bert Renzo"))
- Newsgroups: alt.cad.autocad
- Subject: Help with ADS_ENTNEXT/ADS_SSGET
- Message-ID: <1992Nov23.200136.400399@zeus.calpoly.edu>
- Date: 23 Nov 92 20:01:36 GMT
- Organization: California Polytechnic State University, San Luis Obispo
- Lines: 80
-
- Hi !
-
- I need to access an attribute value of a block but I was not able
- to do it using the combination of ads_ssget and ads_entnext like the ADS
- manual suggests... To test the hint given by the manual I wrote the following
- function, list_dxf, that (theorically) would print out all the dxf codes
- of the entity selected. If the entity cointains sub-entities (in my case
- its a block with attributes), I should be able to see the dxf code and value
- of the attribute.
-
- HOWEVER... the program crashes (after printing "checkpoint 1" and before
- printing "checkpoint 2")... And it crashes with style ;-)
- Autocad prints out "Internal error: SCANDR 5" and kicks me out of the
- drawing editor.
-
- Did anyone ever used ads_ssget/ads_entnext to succesfully retrieve
- an attribute's value? Am I doing something totally wrong? (I enclosed the
- listing ahead).
-
- Any hints or comments will be REALLY appreciated... Thanks!!!
-
- Roberto Renzetti
- (rrenzett@nike.calpoly.edu)
-
-
- PS: While trying to figure out the problem, I did several experiments. I found
- out that ads_ssget and ads_entsel return different addresses (ads_name) for
- the same block. If both return the ads_name of the main entity why are the
- ads_names different?
-
- PS2: Ooops ! Almost forgot to say: I'm using ACAD r. 11 on a HP 730 under UNIX.
-
-
-
-
- /*****************************************************************************
- list_dxf()
-
- Prints the DXF codes of a selected entity.
- *****************************************************************************/
- void list_dxf()
- {
- struct resbuf *objrb, *temprb;
- ads_name objname, ssname;
- ads_point pt;
-
-
- ads_printf ("Please select an object (ssget): \n");
- /* The user will be asked to select the object by point and click */
- if (ads_ssget(NULL, NULL, NULL, NULL, ssname) != RTNORM)
- {
- ads_printf(" Didn't find anything with SSGET...\n");
- return;
- }
-
- ads_printf("Checkpoint 1\n");
- /* this should loop over the subentities */
- while ( ads_entnext (ssname, objname) == RTNORM)
- {
- if (ads_usrbrk() ==1)
- break;
-
- ads_printf("Checkpoint 2\n");
- objrb = ads_entget (objname);
-
- ads_printf("Checkpoint 3\n");
- if (objrb != NULL)
- {
- ads_printf("Checkpoint 4\n");
- for (temprb = objrb; temprb != NULL; temprb=temprb->rbnext)
- printdxf(temprb); /* same printdxf as in the ADS manual */
- }
- else
- ads_printf ("Didn't find anything within loop of entnext...\n");
-
- ads_relrb(objrb);
- ads_relrb(temprb);
- }
-
- }
-