- UID
- 69009
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-8-1
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2003-8-1 13:27:47
|
显示全部楼层
将DLLIMPEXP void polyeditCommand()中一段改为
else if (strcmp(option, "Thicken") == 0) {
if (!ent->isKindOf(AsdkPoly::desc())) {
ads_printf("\nNot Applicable");
continue;
}
eMode = PolyEdit::kThicken;
AOK(thickenPoly(poly));
// solid = AcDb3dSolid::cast(ent);
// assert(solid != NULL);
// poly = NULL;
// solid->draw();
}
将
static Acad::ErrorStatus
thickenPoly(AsdkPoly* poly)
{
Acad::ErrorStatus es = Acad::eOk;
for(int i=0;i<1000;i++)//
{
int i;
AcDbVoidPtrArray lines;
AcDbVoidPtrArray regions;
// Explode to a set of lines
if ((es = poly->explode(lines)) != Acad::eOk) {
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
//AcDbRegion*
// Create a region from the set of lines.
if ((es = AcDbRegion::createFromCurves(lines, regions)) != Acad::eOk) {
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
assert(regions.length() == 1);
AcDbRegion* region = AcDbRegion::cast((AcRxObject*)regions[0]);
assert(region != NULL);
// Extrude the region to create a solid.
/* double height;
if ((es = poly->getDistAtParam(6.28318530717958647692, height))
!= Acad::eOk)
{
for (i = 0; i < lines.length(); i++) {
delete lines;//(AcRxObject*)
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
height *= 0.25;
*/
/* AcDb3dSolid* solid = new AcDb3dSolid;
assert(solid != NULL);
if ((es = solid->extrude(region, height, 0.0)) != Acad::eOk) {
delete solid;
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
// Save up the data to flatten the solid.
//
savedCenter = poly->center();
savedStartPoint = poly->startPoint();
savedNumSides = poly->numSides();
savedNormal = poly->normal();
// Copy the poly name
//
strcpy(savedName, poly->name());
// Now we have a solid. Change the entity to be this solid
if ((es = solid->setPropertiesFrom(poly)) != Acad::eOk) {
delete solid;
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
ent = poly;
if ((es = ent->upgradeOpen()) != Acad::eOk) {
delete solid;
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
es = replaceEntity(ent, solid);
if ((es != Acad::eOk) && (es != Acad::eObjectToBeDeleted)) {
ent->downgradeOpen();
delete solid;
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
return es;
}
es = ent->downgradeOpen();
*/
for (i = 0; i < lines.length(); i++) {
delete (AcRxObject*)lines;//
}
for (i = 0; i < regions.length(); i++) {
delete (AcRxObject*)regions;
}
}
return es;
}
这样有内存泄漏,应该不存在上个贴子说的问题。
修改的代码是arx202里的polysmap例子,大家也试试。
真的有内存泄漏啊,我该怎么办?
在arx2002中,我也用了这个方法试了一下,一点问题都没有。
有没有arx202的补丁什么的? |
|