OpenCasCade BrepFeat_MakeCylindricalHole (); funksjon

stemmer
0

For tiden jobber jeg med et prosjekt for å bore noen sylindriske hull på en gitt form.

Så for å gjøre det jeg gjorde bruk BRepFeat_MakeCylindricalHole();funksjon og brukesStandard_EXPORT void PerformThruNext (const Standard_Real Radius, const Standard_Boolean WithControl = Standard_True);

Fordi i dette tilfellet har jeg ikke dybden av sylinderen. Bruke performThruNext vil det bores, Top ansikt til bunn ansikt. Bruker vil bli gitt start- og endepunktene, deretter bruke som skal bore hull.

  1. ** 1. Når start- og sluttpunkt har desimalbrøk del (gp_pnt StartPnt (328.547,-4.325,97.412); gp_pnt EndPnt (291.841,-7.586,101.651);), betyr det ikke bore ansiktet riktig.

2. Når diameter få til en høyere verdi, skjer det samme,,

** følgende er min kode, alle hjelpe ville være høyt verdsatt. Takk!

skriv

skriv

void COCCAPPDoc::OnBox2()
{

ofstream out;
out.open(C:/Users/Dell/Desktop/Blade/areaInit.txt);
CString str;

TopoDS_Shape bladeWithCore,DrilledShape,DrilledShape2;

/* IMPORT bladeWithCore.brep FILE */
Standard_CString strFile = C:/Users/Dell/Desktop/Blade/bladeWithCore.brep;
BRep_Builder brepS;
BRepTools::Read(bladeWithCore,strFile,brepS);

TopoDS_Face Face_52;
Standard_CString strFace = C:/Users/Dell/Desktop/Blade/Face_52.brep;
BRep_Builder brepF;
BRepTools::Read(Face_52,strFace,brepF);

BRepClass3d_SolidClassifier classify;
classify.Load(bladeWithCore);
classify.PerformInfinitePoint(1.0e-6);
TopAbs_State state = classify.State();
if(state==TopAbs_IN) bladeWithCore.Reverse();

DrilledShape = bladeWithCore;

gp_Vec v1(gp_Pnt( 330,11,108),gp_Pnt(291,4,109)); //FINDING VECTOR FROM START TO THE END POINT
gp_Pnt point(330,11,108);

gp_Pnt startpoint (330,11,108);
TopoDS_Vertex aV1 = BRepBuilderAPI_MakeVertex (startpoint);
BRepTools::Write(aV1,C:/Users/Dell/Desktop/Blade/startpoint.brep);

/* gp_Vec v1(gp_Pnt( 330.208114,11.203318,108.480255),gp_Pnt(291.103558,4.265285,109.432663));
gp_Pnt point(330.208114,11.203318,108.480255);*/

gp_Dir d1(v1); //GETTING DIRECTION USING FOUND VECTOR
gp_Vec UnitVector(d1); //FINDING UNITVECTOR

gp_Dir dir_line(0,0,1);
gp_Vec UnitVector_line(dir_line);

gp_Pnt minPoint;
Standard_Real diameter = 0.1;

int noOfInstances =3;
int gap = -10;

for(int i=0; i {

point.Translate(UnitVector);

gp_Pnt newPoint = point;
newPoint.Translate(UnitVector_line*10);
BRepBuilderAPI_MakeEdge LINE(newPoint, point);
BRepBuilderAPI_MakeWire lineWire(LINE);

TopoDS_Wire wire = TopoDS::Wire(lineWire);
TopoDS_Shape lineShape = TopoDS_Shape(wire);
BRepTools::Write(lineShape,C:/Users/Dell/Desktop/Blade/linlineShapee.brep);

intersection( bladeWithCore,lineShape, point, minPoint);

TopoDS_Vertex checkPoint = BRepBuilderAPI_MakeVertex (minPoint);
BRepTools::Write(checkPoint,C:/Users/Dell/Desktop/Blade/checkPoint.brep);

gp_Ax1 location =gp_Ax1(minPoint,gp_Dir(0,0,1));
BRepFeat_MakeCylindricalHole drilled;
drilled.Init(DrilledShape,location);
drilled.PerformThruNext(diameter/2.0);

BRepFeat_Status status = drilled.Status();

if(status==BRepFeat_NoError)
{
DrilledShape = drilled.Shape();
BRepTools::Write(DrilledShape,C:/Users/Dell/Desktop/Blade/bladeWithCoreDrilled.brep);
}

}
Handle(AIS_InteractiveObject) obj3 = (new AIS_Shape(DrilledShape));
myAISContext->Display(obj3);
COCCAPPDoc:: Fit();
}

void COCCAPPDoc::intersection(TopoDS_Shape bladeWithCore,TopoDS_Shape lineShape,gp_Pnt point,gp_Pnt& minPoint)
{

BRepExtrema_DistShapeShape  interSection( bladeWithCore, lineShape, Extrema_ExtFlag_MIN, Extrema_ExtAlgo_Grad);
interSection.Perform();
Standard_Integer Solutions = interSection.NbSolution();

CArray disArray;
int minindex = 1;

for(int i = 1; i {

double distance = point.Distance((interSection.PointOnShape1(i)));
disArray.Add(distance);

}

for(int i = 1; i {

if(disArray[0] > disArray[i])
{
disArray[0] = disArray[i];
minindex = i;

}
}
minPoint = interSection.PointOnShape1(minindex);
TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex (minPoint);
BRepTools::Write(aV,C:/Users/Dell/Desktop/Blade/minPoint.brep);
}
Publisert på 14/08/2017 klokken 09:46
kilden bruker
På andre språk...                            

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more