자료실 Q&A
글 수 2,319
||||_$
_$ resbuf* assoc(resbuf* ebuf,int restype)
{
while((ebuf != NULL) && (ebuf->restype != restype))
ebuf = ebuf->rbnext;
return ebuf;
}
void Z0()//Z Value Zero
{
ads_name ename, entGroup;
resbuf *entGet, *assocSp, *assocEp,*assocEnt;
long count=0;
resbuf* rbFilter = ads_buildlist (-4, "<or",RTDXF0, "CIRCLE",RTDXF0, "LINE", RTDXF0, "ARC", RTDXF0, "LWPOLYLINE", RTDXF0, "POLYLINE", -4, "or>", 0) ;
if(ads_ssget(NULL, NULL, NULL, rbFilter, entGroup) != RTNORM) return;
ads_sslength(entGroup, &count);
for(int i=0; i < count; i++)
{
ads_ssname(entGroup,i,ename);
entGet = ads_entget(ename);
assocEnt = assoc(entGet, 0);
if(strcmp(assocEnt->resval.rstring, "LINE") == 0)
{
assocSp = assoc(assocEnt, 10);
assocEp = assoc(assocEnt, 11);
if(assocSp->resval.rpoint[2] != 0.0)
assocSp->resval.rpoint[2] = 0.0;
if(assocEp->resval.rpoint[2] != 0.0)
assocEp->resval.rpoint[2] = 0.0;
}
else if(strcmp(assocEnt->resval.rstring, "ARC") == 0 || strcmp(assocEnt->resval.rstring, "CIRCLE") == 0)
{
assocSp = assoc(assocEnt, 10);
if(assocSp->resval.rpoint[2] != 0.0)
assocSp->resval.rpoint[2] = 0.0;
}
else if(strcmp(assocEnt->resval.rstring, "LWPOLYLINE") == 0)
{
assocSp = assoc(assocEnt, 38);
if(assocSp->resval.rreal != 0.0)
assocSp->resval.rreal = 0.0;
}
else if(strcmp(assocEnt->resval.rstring, "POLYLINE") == 0)
{
assocSp = assoc(assocEnt, 10);
if(assocSp->resval.rpoint[2] != 0.0)
assocSp->resval.rpoint[2] = 0.0;
}
else;
ads_entmod(entGet);
}
}
_$ resbuf* assoc(resbuf* ebuf,int restype)
{
while((ebuf != NULL) && (ebuf->restype != restype))
ebuf = ebuf->rbnext;
return ebuf;
}
void Z0()//Z Value Zero
{
ads_name ename, entGroup;
resbuf *entGet, *assocSp, *assocEp,*assocEnt;
long count=0;
resbuf* rbFilter = ads_buildlist (-4, "<or",RTDXF0, "CIRCLE",RTDXF0, "LINE", RTDXF0, "ARC", RTDXF0, "LWPOLYLINE", RTDXF0, "POLYLINE", -4, "or>", 0) ;
if(ads_ssget(NULL, NULL, NULL, rbFilter, entGroup) != RTNORM) return;
ads_sslength(entGroup, &count);
for(int i=0; i < count; i++)
{
ads_ssname(entGroup,i,ename);
entGet = ads_entget(ename);
assocEnt = assoc(entGet, 0);
if(strcmp(assocEnt->resval.rstring, "LINE") == 0)
{
assocSp = assoc(assocEnt, 10);
assocEp = assoc(assocEnt, 11);
if(assocSp->resval.rpoint[2] != 0.0)
assocSp->resval.rpoint[2] = 0.0;
if(assocEp->resval.rpoint[2] != 0.0)
assocEp->resval.rpoint[2] = 0.0;
}
else if(strcmp(assocEnt->resval.rstring, "ARC") == 0 || strcmp(assocEnt->resval.rstring, "CIRCLE") == 0)
{
assocSp = assoc(assocEnt, 10);
if(assocSp->resval.rpoint[2] != 0.0)
assocSp->resval.rpoint[2] = 0.0;
}
else if(strcmp(assocEnt->resval.rstring, "LWPOLYLINE") == 0)
{
assocSp = assoc(assocEnt, 38);
if(assocSp->resval.rreal != 0.0)
assocSp->resval.rreal = 0.0;
}
else if(strcmp(assocEnt->resval.rstring, "POLYLINE") == 0)
{
assocSp = assoc(assocEnt, 10);
if(assocSp->resval.rpoint[2] != 0.0)
assocSp->resval.rpoint[2] = 0.0;
}
else;
ads_entmod(entGet);
}
}