- //Add a Projection function
- Handle(GEOM_Function) aFunction =
- aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
+ TopoDS_Shape aTarget = theTarget->GetValue();
+ if ( aTarget.IsNull() ) return NULL;
+ if ( aTarget.ShapeType() == TopAbs_EDGE ||
+ aTarget.ShapeType() == TopAbs_WIRE )
+ {
+ // a TPythonDump prevents dumping ProjectPointOnWire(),
+ // dump of MakeProjection() is done at the end of this function
+ GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
+ Standard_Integer dummy;
+ ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
+ if ( aCopy.IsNull() || !IsDone() )
+ return NULL;
+ }
+ else
+ {
+ //Add a new Projection object
+ aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);