下边代码是获得联标中的关联数据的,与(cdr (assoc dxf_code ent_list))对应.
/********************************************************************/ int assoc_dxf_point(struct resbuf *rb,int dxf_code,ads_point result) { struct resbuf *rb1; if (dxf_type(dxf_code)!=RTPOINT) return RTERROR; if (rb==NULL) return RTERROR; for (rb1=rb;rb1!=NULL;rb1=rb1->rbnext) { if (rb1->restype==dxf_code) { result[X]=rb1->resval.rpoint[X]; result[Y]=rb1->resval.rpoint[Y]; result[Z]=rb1->resval.rpoint[Z]; return RTNORM; } } return RTERROR; } /********************************************************************/ int assoc_dxf_int(struct resbuf *rb,int dxf_code,short *result) { struct resbuf *rb1; if (dxf_type(dxf_code)!=RTSHORT) return RTERROR; if (rb==NULL) return RTERROR; for (rb1=rb;rb1!=NULL;rb1=rb1->rbnext) { if (rb1->restype==dxf_code) { *result=rb1->resval.rint; return RTNORM; } } return RTERROR; } /*************************************************************/ int assoc_dxf_str(struct resbuf *rb,int dxf_code,char *result) { struct resbuf *rb1; if (dxf_type(dxf_code)!=RTSTR) return RTERROR; if (rb==NULL) return RTERROR; for (rb1=rb;rb1!=NULL;rb1=rb1->rbnext) { if (rb1->restype==dxf_code) { strcpy(result,rb1->resval.rstring); return RTNORM; } } return RTERROR; } /******************************************************************/ int assoc_dxf_real(struct resbuf *rb,int dxf_code,ads_real *result) { struct resbuf *rb1; if (dxf_type(dxf_code)!=RTREAL) return RTERROR; if (rb==NULL) return RTERROR; for (rb1=rb;rb1!=NULL;rb1=rb1->rbnext) { if (rb1->restype==dxf_code) { *result=rb1->resval.rreal; return RTNORM; } } return RTERROR; }
|