For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Boolean operation

romain crespel's picture
Forums: 

Hi,

I'm trying to make a fuse boolean operation (Fuse) between  2 boxes.

OdDbEntityPtr MdModelisationTools::booleanFuse(QList<OdDbEntityPtr> &qlEntity)
{
    OdDbEntityPtr pEntRet;
    TopoDS_Shape fusedShape;

    try
    {
        int iCount = qlEntity.size();
        for(int i = 0; i < iCount; i++)
        {
            OdDbEntityPtr pEntity = qlEntity[i];
            TopoDS_Shape pTempShape = MdOCCACIS::entityToTopoDS_Shape(pEntity);
            if(!pTempShape.IsNull())
            {
                if(!fusedShape.IsNull())
                {
                    fusedShape = BRepAlgoAPI_Fuse(fusedShape, pTempShape);
                    if(!fusedShape.IsNull())
                    {
                        BRepTools::Update(fusedShape);
                    }
                }
                else
                {
                    fusedShape = pTempShape;
                }
            }
            else
            {
                // ne pas traiter
                qlEntity.removeAll(pEntity);
                i--;
                iCount--;
            }
        }

        if(!fusedShape.IsNull())
        {
            // conversion en solid ODA
            pEntRet = MdOCCACIS::entityFromOCCShape(fusedShape);
        }
    }
    catch(Standard_Failure &failure)
    {
        MdCoreApplication::Instance()->getPrompt()->writeError(failure.GetMessageString());
    }

    return pEntRet;
}

My mistake is the result object has useless edges (see image).

What I do wrong ?

thanks.

Attachments: 
Eugeny's picture

You need to apply ShapeUpgrade_UnifySameDomain to the result of Boolean operation. It should remove the "useless edges".