#599 | 可以解析出来曲面的点了。由于形状组合很多,需要有多种表示,或者转换为一种(或者直接不要别的种类)。 if(new_shape.ShapeType()==6){ double first, last; if(BRep_Tool::Degenerated(TopoDS::Edge(new_shape))){ printf("degenerated "); }else{ Handle(Geom_Curve) my_curve = BRep_Tool::Curve(TopoDS::Edge(new_shape),first,last); printf("type is %s ", my_curve->DynamicType()->Name()); if(my_curve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))){ Handle(Geom_BSplineCurve) spline = Handle(Geom_BSplineCurve)::DownCast(my_curve); printf("%d knots, %d poles", spline->NbKnots(),spline->NbPoles()); TColgp_Array1OfPnt poles = spline->Poles(); for(Standard_Integer i=poles.Lower(); i<=poles.Upper(); i++){ gp_Pnt p = poles(i); printf("\n"); for(int i=0;i<level;i++){ printf(" "); } printf("* %f, %f, %f", p.X(), p.Y(), p.Z()); } }else if(my_curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))){ Handle(Geom_TrimmedCurve) spline = Handle(Geom_TrimmedCurve)::DownCast(my_curve); Handle(Geom_Curve) basis = spline->BasisCurve(); printf("%f - %f", spline->FirstParameter(),spline->LastParameter()); } } } | |