コード例 #1
0
    def from_boolean_intersection(cls, A: 'BRep', B: 'BRep') -> 'BRep':
        """Construct a BRep from the boolean intersection of two other BReps.

        Parameters
        ----------
        A : :class:`~compas_occ.brep.BRep`
        B : :class:`~compas_occ.brep.BRep`

        Returns
        -------
        :class:`~compas_occ.brep.BRep`

        """
        common = BRepAlgoAPI_Common(A.shape, B.shape)
        if not common.IsDone():
            raise Exception(
                "Boolean intersection operation could not be completed.")
        brep = BRep()
        brep.shape = common.Shape()
        return brep
コード例 #2
0
ファイル: boolops_base.py プロジェクト: mirmik/zencad
def occ_pair_intersect(a, b):
    algo = BRepAlgoAPI_Common(a, b)
    algo.Build()
    if not algo.IsDone():
        raise Exception("warn: intersect algotithm failed\n")
    return algo.Shape()