// Builds a fused shape of all fuselage segments PNamedShape CCPACSFuselage::BuildLoft(void) { // Get Continuity of first segment // TODO: adapt lofting to have multiple different continuities TiglContinuity cont = segments.GetSegment(1).GetContinuity(); Standard_Boolean ruled = (cont == C0? true : false); // Ne need a smooth fuselage by default // @TODO: OpenCascade::ThruSections is currently buggy and crashes, if smooth lofting // is performed. Therefore we swicth the 2. parameter to Standard_True (non smooth lofting). // This has to be reverted, as soon as the bug is fixed!!! BRepOffsetAPI_ThruSections generator(Standard_True, ruled, Precision::Confusion() ); for (int i=1; i <= segments.GetSegmentCount(); i++) { generator.AddWire(segments.GetSegment(i).GetStartWire()); } generator.AddWire(segments.GetSegment(segments.GetSegmentCount()).GetEndWire()); generator.SetMaxDegree(2); //surfaces will be C1-continuous generator.SetParType(Approx_Centripetal); generator.CheckCompatibility(Standard_False); generator.Build(); TopoDS_Shape loftShape = generator.Shape(); std::string loftName = GetUID(); std::string loftShortName = GetShortShapeName(); PNamedShape loft(new CNamedShape(loftShape, loftName.c_str(), loftShortName.c_str())); return loft; }
MStatus fullLoft::compute( const MPlug& plug, MDataBlock& data ) { MStatus stat; if ( plug == outputSurface ) // loft inputCurves into surface { MArrayDataHandle inputArrayData = data.inputArrayValue( inputCurve, &stat ); PERRORfail("fullLoft::compute getting input array data"); MDataHandle surfHandle = data.outputValue( fullLoft::outputSurface ); PERRORfail("fullLoft::compute getting output data handle"); MFnNurbsSurfaceData dataCreator; MObject newSurfData = dataCreator.create( &stat ); PERRORfail("fullLoft::compute creating new nurbs surface data block"); /* MObject newSurf = */ loft(inputArrayData, newSurfData, stat ); // No error message is needed - fullLoft::loft will output one if (!stat) return stat; // newSurf is the new surface object, but it has been packed // into the datablock we created for it, and the data block // is what we must put onto the plug. stat = surfHandle.set( newSurfData ); PERRORfail("fullLoft::compute setting surface handle"); stat = data.setClean( plug ); PERRORfail("fullLoft::compute cleaning outputSurface plug"); } else { return MS::kUnknownParameter; } return MS::kSuccess; }