def UpdateClippingPlane(self, direction): tmp_plane = gp_Pln(self.myCenter, direction) equation = Graphic3d_ClipPlane(tmp_plane).GetEquation() self.myClippingPlane.SetEquation(equation) self.myGeomClippingPlane.SetPln(self.myClippingPlane.ToPlane()) self.myAIS_ClippingPlane.SetComponent(self.myGeomClippingPlane) self.myContext.Redisplay(self.myAIS_ClippingPlane, True) self.myContext.UpdateCurrentViewer()
def InitClippingPlane(self): # clip plane number one, by default xOy clip_plane = Graphic3d_ClipPlane( gp_Pln(self.myCenter, gp_Dir(1., 0., 0.))) # set hatch on clip_plane.SetCapping(True) clip_plane.SetCappingHatch(True) # off by default, user will have to enable it clip_plane.SetOn(True) # set clip plane color aMat = clip_plane.CappingMaterial() aColor = Quantity_Color(0.5, 0.6, 0.7, Quantity_TOC_RGB) aMat.SetAmbientColor(aColor) aMat.SetDiffuseColor(aColor) clip_plane.SetCappingMaterial(aMat) self.myClippingPlane = clip_plane self.myGeomClippingPlane = Geom_Plane(self.myClippingPlane.ToPlane()) self.myAIS_ClippingPlane = AIS_Plane(self.myGeomClippingPlane)
settings = ifcopenshell.geom.settings() # tells ifcopenshell to use pythonocc settings.set(settings.USE_PYTHON_OPENCASCADE, True) # read the ifc file print("Loading ifc file ...", end="") ifc_filename = "./assets/ifc_models/A_IFC_model.ifc" assert os.path.isfile(ifc_filename) ifc_file = ifcopenshell.open(ifc_filename) print("done.") # the clip plane # clip plane number one, by default xOy clip_plane_1 = Graphic3d_ClipPlane() # set hatch on clip_plane_1.SetCapping(True) clip_plane_1.SetCappingHatch(True) # off by default, user will have to enable it clip_plane_1.SetOn(False) # set clip plane color aMat = clip_plane_1.CappingMaterial() aColor = Quantity_Color(0.5, 0.6, 0.7, Quantity_TOC_RGB) aMat.SetAmbientColor(aColor) aMat.SetDiffuseColor(aColor) clip_plane_1.SetCappingMaterial(aMat)