mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-28 18:00:49 +05:00
New functions from PAL development
This commit is contained in:
parent
eacbf1f19e
commit
3d72ae1930
@ -52,6 +52,7 @@
|
||||
#include "GEOM_AISShape.hxx"
|
||||
#include "GEOM_AssemblyBuilder.h"
|
||||
#include "GEOM_InteractiveObject.hxx"
|
||||
#include "GEOM_Displayer.h"
|
||||
|
||||
#include "SALOME_Event.hxx"
|
||||
|
||||
@ -64,11 +65,14 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -174,7 +178,8 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry)
|
||||
"GEOM",
|
||||
const_cast<char*>( obj->GetID().c_str()));
|
||||
|
||||
if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
|
||||
GEOM_Displayer(ActiveStudy).Display(anIO, true);
|
||||
/*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
|
||||
SVTK_View* aView = aViewWindow->getView();
|
||||
int aMode = aView->GetDisplayMode();
|
||||
|
||||
@ -196,7 +201,7 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry)
|
||||
aSh->setIO(anIO);
|
||||
ic->Display(aSh);
|
||||
ic->AddOrRemoveCurrentObject(aSh,true);
|
||||
}
|
||||
}*/
|
||||
// update object browser
|
||||
SalomeApp_Application* app = NULL; //dynamic_cast<SalomeApp_Application*>(app);
|
||||
if (app) {
|
||||
@ -464,3 +469,136 @@ bool GEOM_Swig::initGeomGen()
|
||||
{
|
||||
return ProcessEvent(new TInitGeomGenEvent());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
|
||||
{
|
||||
class TEvent: public SALOME_Event
|
||||
{
|
||||
std::string myEntry;
|
||||
bool myFromAllWindows;
|
||||
public:
|
||||
TEvent(const char* theEntry, bool fromAllWindows):
|
||||
myEntry(theEntry), myFromAllWindows(fromAllWindows)
|
||||
{}
|
||||
virtual void Execute()
|
||||
{
|
||||
SUIT_Application* app = SUIT_Session::session()->activeApplication();
|
||||
if (!app) return;
|
||||
SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
|
||||
if (!ActiveStudy) return;
|
||||
|
||||
Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
|
||||
|
||||
GEOM_Displayer(ActiveStudy).Erase(aIO, true);
|
||||
/* if (myFromAllWindows) {
|
||||
QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
|
||||
SUIT_ViewWindow* aWin = 0;
|
||||
for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
|
||||
EraseObject(aWin, aIO);
|
||||
}
|
||||
} else {
|
||||
SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
|
||||
if (aWin)
|
||||
EraseObject(aWin, aIO);
|
||||
}*/
|
||||
}
|
||||
|
||||
/* private:
|
||||
void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
|
||||
{
|
||||
if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
|
||||
OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
|
||||
if ( vw ) {
|
||||
OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
|
||||
if ( vm ) {
|
||||
SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
|
||||
if (aViewer) {
|
||||
SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
|
||||
if (aPrs) {
|
||||
SALOME_OCCPrs* aOccPrs = dynamic_cast<SALOME_OCCPrs*>(aPrs);
|
||||
if (aOccPrs) {
|
||||
aViewer->Erase(aOccPrs);
|
||||
aViewer->Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
|
||||
SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
|
||||
if (aViewWindow) {
|
||||
aViewWindow->Erase(theIO);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
};
|
||||
ProcessVoidEvent(new TEvent(Entry, allWindows));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
|
||||
{
|
||||
class TEvent: public SALOME_Event {
|
||||
std::string myEntry;
|
||||
float myParam;
|
||||
public:
|
||||
TEvent(const char* theEntryArg, float theParam):
|
||||
myEntry(theEntryArg), myParam(theParam)
|
||||
{}
|
||||
virtual void Execute() {
|
||||
SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
|
||||
if (!anApp) return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO =
|
||||
new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
|
||||
|
||||
if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
|
||||
vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
|
||||
aActors->InitTraversal();
|
||||
while (vtkActor* aAct = aActors->GetNextActor()) {
|
||||
if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
|
||||
if (aGeomActor->hasIO()) {
|
||||
Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
|
||||
if (aNextIO->isSame(anIO)) {
|
||||
aGeomActor->setDeflection(myParam);
|
||||
aViewWindow->Repaint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// aView->SetTransparency(anIO, myParam);
|
||||
//aView->Repaint();
|
||||
} else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
|
||||
Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
|
||||
AIS_ListOfInteractive aAISList;
|
||||
aContext->DisplayedObjects(aAISList);
|
||||
AIS_ListIteratorOfListOfInteractive it(aAISList);
|
||||
for (; it.More(); it.Next()) {
|
||||
Handle(SALOME_InteractiveObject) aObj =
|
||||
Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
|
||||
if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
|
||||
if (!aShape.IsNull()) {
|
||||
Handle(AIS_Drawer) aDrawer = aShape->Attributes();
|
||||
if (aDrawer.IsNull())
|
||||
aDrawer = new AIS_Drawer();
|
||||
aDrawer->SetDeviationCoefficient(myParam);
|
||||
aShape->SetAttributes(aDrawer);
|
||||
aContext->Redisplay(aShape, true, true);
|
||||
aContext->UpdateCurrentViewer();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ProcessVoidEvent(new TEvent (theEntry, theDeflect));
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,12 @@ public:
|
||||
~GEOM_Swig();
|
||||
|
||||
void createAndDisplayGO(const char* Entry);
|
||||
void eraseGO(const char* Entry, bool allWindows);
|
||||
void createAndDisplayFitAllGO(const char* Entry);
|
||||
void setDisplayMode(const char* Entry, int mode);
|
||||
void setColor(const char* Entry, int red, int green, int blue);
|
||||
void setTransparency(const char* Entry, float transp);
|
||||
void setDeflection(const char* Entry, float deflect);
|
||||
|
||||
int getIndexTopology(const char *SubEntry, const char *Entry);
|
||||
const char* getShapeTypeString(const char *Entry);
|
||||
|
@ -37,6 +37,7 @@ class GEOM_Swig
|
||||
~GEOM_Swig();
|
||||
|
||||
void createAndDisplayGO(const char* Entry);
|
||||
void eraseGO(const char* Entry, bool allWindows);
|
||||
void createAndDisplayFitAllGO(const char* Entry);
|
||||
int getIndexTopology(const char *SubEntry, const char *Entry);
|
||||
const char* getShapeTypeString(const char *Entry);
|
||||
@ -44,6 +45,7 @@ class GEOM_Swig
|
||||
void setDisplayMode(const char* Entry, int mode);
|
||||
void setColor(const char* Entry, int red, int green, int blue);
|
||||
void setTransparency(const char* Entry, float transp);
|
||||
void setDeflection(const char* Entry, float deflect);
|
||||
const char* getShapeTypeIcon(const char *Ior);
|
||||
|
||||
bool initGeomGen();
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <GEOMImpl_CylinderDriver.hxx>
|
||||
#include <GEOMImpl_PrismDriver.hxx>
|
||||
#include <GEOMImpl_PipeDriver.hxx>
|
||||
#include <GEOMImpl_ThruSectionsDriver.hxx>
|
||||
#include <GEOMImpl_RevolutionDriver.hxx>
|
||||
#include <GEOMImpl_ShapeDriver.hxx>
|
||||
#include <GEOMImpl_BlockDriver.hxx>
|
||||
@ -104,6 +105,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeDriver::GetID(), new GEOMImpl_PipeDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ThruSectionsDriver::GetID(), new GEOMImpl_ThruSectionsDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RevolutionDriver::GetID(), new GEOMImpl_RevolutionDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SphereDriver::GetID(), new GEOMImpl_SphereDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TorusDriver::GetID(), new GEOMImpl_TorusDriver());
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <GEOMImpl_RevolutionDriver.hxx>
|
||||
#include <GEOMImpl_ShapeDriver.hxx>
|
||||
#include <GEOMImpl_FillingDriver.hxx>
|
||||
#include <GEOMImpl_ThruSectionsDriver.hxx>
|
||||
|
||||
#include <GEOMImpl_IBox.hxx>
|
||||
#include <GEOMImpl_ICylinder.hxx>
|
||||
@ -56,6 +57,8 @@
|
||||
#include <GEOMImpl_IRevolution.hxx>
|
||||
#include <GEOMImpl_IShapes.hxx>
|
||||
#include <GEOMImpl_IFilling.hxx>
|
||||
#include <GEOMImpl_IThruSections.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
|
||||
@ -933,3 +936,242 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
|
||||
SetErrorCode(OK);
|
||||
return aFilling;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeThruSections
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
|
||||
const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
|
||||
bool theModeSolid,
|
||||
double thePreci,
|
||||
bool theRuled)
|
||||
{
|
||||
Handle(GEOM_Object) anObj;
|
||||
SetErrorCode(KO);
|
||||
if(theSeqSections.IsNull())
|
||||
return anObj;
|
||||
|
||||
Standard_Integer nbObj = theSeqSections->Length();
|
||||
if (!nbObj)
|
||||
return anObj;
|
||||
|
||||
//Add a new ThruSections object
|
||||
Handle(GEOM_Object) aThruSect = GetEngine()->AddObject(GetDocID(), GEOM_THRUSECTIONS);
|
||||
|
||||
|
||||
//Add a new ThruSections function
|
||||
|
||||
int aTypeFunc = (theRuled ? THRUSECTIONS_RULED : THRUSECTIONS_SMOOTHED);
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aThruSect->AddFunction(GEOMImpl_ThruSectionsDriver::GetID(), aTypeFunc);
|
||||
if (aFunction.IsNull()) return anObj;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_ThruSectionsDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IThruSections aCI (aFunction);
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
|
||||
|
||||
Standard_Integer i =1;
|
||||
for( ; i <= nbObj; i++) {
|
||||
|
||||
Handle(Standard_Transient) anItem = theSeqSections->Value(i);
|
||||
if(anItem.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem);
|
||||
if(!aSectObj.IsNull())
|
||||
{
|
||||
Handle(GEOM_Function) aRefSect = aSectObj->GetLastFunction();
|
||||
if(!aRefSect.IsNull())
|
||||
aSeqSections->Append(aRefSect);
|
||||
}
|
||||
}
|
||||
|
||||
if(!aSeqSections->Length())
|
||||
return anObj;
|
||||
|
||||
aCI.SetSections(aSeqSections);
|
||||
aCI.SetSolidMode(theModeSolid);
|
||||
aCI.SetPrecision(thePreci);
|
||||
|
||||
//Compute the ThruSections value
|
||||
try {
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("ThruSections driver failed");
|
||||
return anObj;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
pyDump << aThruSect << " = geompy.MakeThruSections([";
|
||||
|
||||
for(i =1 ; i <= nbObj; i++) {
|
||||
|
||||
Handle(Standard_Transient) anItem = theSeqSections->Value(i);
|
||||
if(anItem.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem);
|
||||
if(!aSectObj.IsNull()) {
|
||||
pyDump<< aSectObj;
|
||||
if(i < nbObj)
|
||||
pyDump<<", ";
|
||||
}
|
||||
}
|
||||
|
||||
pyDump<< "],"<<theModeSolid << "," << thePreci <<","<< theRuled <<")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aThruSect;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakePipeWithDifferentSections
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
|
||||
const Handle(TColStd_HSequenceOfTransient)& theBases,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theLocations,
|
||||
const Handle(GEOM_Object)& thePath,
|
||||
bool theWithContact,
|
||||
bool theWithCorrections)
|
||||
{
|
||||
Handle(GEOM_Object) anObj;
|
||||
SetErrorCode(KO);
|
||||
if(theBases.IsNull())
|
||||
return anObj;
|
||||
|
||||
Standard_Integer nbBases = theBases->Length();
|
||||
|
||||
if (!nbBases)
|
||||
return anObj;
|
||||
|
||||
Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length());
|
||||
//Add a new Pipe object
|
||||
Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
|
||||
|
||||
//Add a new Pipe function
|
||||
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_DIFFERENT_SECTIONS);
|
||||
if (aFunction.IsNull()) return anObj;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
|
||||
|
||||
GEOMImpl_IPipeDiffSect aCI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
|
||||
if(aRefPath.IsNull())
|
||||
return anObj;
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
|
||||
Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient;
|
||||
|
||||
Standard_Integer i =1;
|
||||
for( ; i <= nbBases; i++) {
|
||||
|
||||
Handle(Standard_Transient) anItem = theBases->Value(i);
|
||||
if(anItem.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
|
||||
if(aBase.IsNull())
|
||||
continue;
|
||||
Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
|
||||
if(aRefBase.IsNull())
|
||||
continue;
|
||||
if(nbLocs)
|
||||
{
|
||||
Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
|
||||
if(anItemLoc.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
|
||||
if(aLoc.IsNull())
|
||||
continue;
|
||||
Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
|
||||
if(aRefLoc.IsNull())
|
||||
continue;
|
||||
aSeqLocs->Append(aRefLoc);
|
||||
}
|
||||
aSeqBases->Append(aRefBase);
|
||||
}
|
||||
|
||||
if(!aSeqBases->Length())
|
||||
return anObj;
|
||||
|
||||
aCI.SetBases(aSeqBases);
|
||||
aCI.SetLocations(aSeqLocs);
|
||||
aCI.SetPath(aRefPath);
|
||||
aCI.SetWithContactMode(theWithContact);
|
||||
aCI.SetWithCorrectionMode(theWithCorrections);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Pipe with defferent section driver failed");
|
||||
return anObj;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
pyDump << aPipeDS << " = geompy.MakePipeWithDifferentSections([";
|
||||
|
||||
for(i =1 ; i <= nbBases; i++) {
|
||||
|
||||
Handle(Standard_Transient) anItem = theBases->Value(i);
|
||||
if(anItem.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
|
||||
if(!anObj.IsNull()) {
|
||||
pyDump<< anObj;
|
||||
if(i < nbBases)
|
||||
pyDump<<", ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pyDump<< "], [";
|
||||
|
||||
for(i =1 ; i <= nbLocs; i++) {
|
||||
|
||||
Handle(Standard_Transient) anItem = theLocations->Value(i);
|
||||
if(anItem.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
|
||||
if(!anObj.IsNull()) {
|
||||
pyDump<< anObj;
|
||||
if(i < nbLocs)
|
||||
pyDump<<", ";
|
||||
}
|
||||
}
|
||||
|
||||
pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections<<")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aPipeDS;
|
||||
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "GEOM_Engine.hxx"
|
||||
#include "GEOM_Object.hxx"
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
public:
|
||||
@ -73,6 +74,17 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeThruSections(const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
|
||||
bool theModeSolid,
|
||||
double thePreci,
|
||||
bool theRuled);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakePipeWithDifferentSections(
|
||||
const Handle(TColStd_HSequenceOfTransient)& theBases,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theLocations,
|
||||
const Handle(GEOM_Object)& thePath,
|
||||
bool theWithContact,
|
||||
bool theWithCorrections);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -221,6 +221,55 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
|
||||
return aPoint;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeTangentOnCurve
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
|
||||
(const Handle(GEOM_Object)& theCurve, double theParameter)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (theCurve.IsNull()) return NULL;
|
||||
|
||||
//Add a new Vector object
|
||||
Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
|
||||
|
||||
//Add a new Point function for creation a point relativley another point
|
||||
Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR);
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IVector aVI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
|
||||
if (aRefFunction.IsNull()) return NULL;
|
||||
|
||||
aVI.SetCurve(aRefFunction);
|
||||
aVI.SetParameter(theParameter);
|
||||
|
||||
//Compute the vector value
|
||||
try {
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Vector driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aVec << " = geompy.MakeTangentOnCurve("
|
||||
<< theCurve << ", " << theParameter << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aVec;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
@ -641,3 +690,61 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
|
||||
SetErrorCode(OK);
|
||||
return aMarker;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeTangentPlaneOnFace
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
|
||||
double theParamU,
|
||||
double theParamV,
|
||||
double theSize)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (theFace.IsNull()) return NULL;
|
||||
|
||||
//Add a new Plane object
|
||||
Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
|
||||
|
||||
//Add a new Plane function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_TANGENT_FACE);
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IPlane aPI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRef = theFace->GetLastFunction();
|
||||
if (aRef.IsNull()) return NULL;
|
||||
|
||||
aPI.SetFace(aRef);
|
||||
aPI.SetSize(theSize);
|
||||
aPI.SetParameterU(theParamU);
|
||||
aPI.SetParameterV(theParamV);
|
||||
|
||||
//Compute the Plane value
|
||||
try {
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Plane driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakeTangentPlaneOnFace("
|
||||
<< theFace << ", " <<theParamU <<", "<<theParamV <<", "<< theSize << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aPlane;
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,9 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeVectorTwoPnt (Handle(GEOM_Object) thePnt1,
|
||||
Handle(GEOM_Object) thePnt2);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeTangentOnCurve(const Handle(GEOM_Object)& theCurve,
|
||||
double theParameter);
|
||||
|
||||
// Line
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1,
|
||||
Handle(GEOM_Object) thePnt2);
|
||||
@ -70,6 +73,12 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeMarker (double theOX, double theOY, double theOZ,
|
||||
double theXDX, double theXDY, double theXDZ,
|
||||
double theYDX, double theYDY, double theYDZ);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
|
||||
double theParamU,
|
||||
double theParamV,
|
||||
double theSize);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,6 +19,8 @@
|
||||
//
|
||||
//NOTE: This is an intreface to a function for the Pipe creation.
|
||||
|
||||
#ifndef _GEOMImpl_IPIPE_HXX_
|
||||
#define _GEOMImpl_IPIPE_HXX_
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
@ -37,7 +39,9 @@ class GEOMImpl_IPipe
|
||||
Handle(GEOM_Function) GetBase() { return _func->GetReference(PIPE_ARG_BASE); }
|
||||
Handle(GEOM_Function) GetPath() { return _func->GetReference(PIPE_ARG_PATH); }
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
Handle(GEOM_Function) _func;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,10 @@
|
||||
|
||||
#define PLN_ARG_REF 6
|
||||
|
||||
#define PLN_ARG_PARAM_U 7
|
||||
|
||||
#define PLN_ARG_PARAM_V 8
|
||||
|
||||
class GEOMImpl_IPlane
|
||||
{
|
||||
public:
|
||||
@ -59,6 +63,12 @@ class GEOMImpl_IPlane
|
||||
Handle(GEOM_Function) GetPoint1() { return _func->GetReference(PLN_ARG_PNT1); }
|
||||
Handle(GEOM_Function) GetPoint2() { return _func->GetReference(PLN_ARG_PNT2); }
|
||||
Handle(GEOM_Function) GetPoint3() { return _func->GetReference(PLN_ARG_PNT3); }
|
||||
|
||||
void SetParameterU(double theParamU) { _func->SetReal(PLN_ARG_PARAM_U, theParamU); }
|
||||
double GetParameterU() { return _func->GetReal(PLN_ARG_PARAM_U); }
|
||||
|
||||
void SetParameterV(double theParamV) { _func->SetReal(PLN_ARG_PARAM_V, theParamV); }
|
||||
double GetParameterV() { return _func->GetReal(PLN_ARG_PARAM_V); }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -29,6 +29,10 @@
|
||||
#define VEC_ARG_PNT1 4
|
||||
#define VEC_ARG_PNT2 5
|
||||
|
||||
#define VEC_ARG_CURVE 6
|
||||
#define VEC_ARG_PARAM 7
|
||||
|
||||
|
||||
class GEOMImpl_IVector
|
||||
{
|
||||
public:
|
||||
@ -49,6 +53,14 @@ class GEOMImpl_IVector
|
||||
Handle(GEOM_Function) GetPoint1() { return _func->GetReference(VEC_ARG_PNT1); }
|
||||
Handle(GEOM_Function) GetPoint2() { return _func->GetReference(VEC_ARG_PNT2); }
|
||||
|
||||
void SetCurve(Handle(GEOM_Function) theRef) { _func->SetReference(VEC_ARG_CURVE, theRef); }
|
||||
|
||||
Handle(GEOM_Function) GetCurve() { return _func->GetReference(VEC_ARG_CURVE); }
|
||||
|
||||
void SetParameter(double theParam) { _func->SetReal(VEC_ARG_PARAM, theParam); }
|
||||
|
||||
double GetParameter() { return _func->GetReal(VEC_ARG_PARAM); }
|
||||
|
||||
private:
|
||||
|
||||
Handle(GEOM_Function) _func;
|
||||
|
@ -35,10 +35,18 @@
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <BRepOffsetAPI_MakePipeShell.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include "utilities.h"
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
@ -67,51 +75,195 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
||||
{
|
||||
if (Label().IsNull()) return 0;
|
||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||
|
||||
GEOMImpl_IPipe aCI (aFunction);
|
||||
GEOMImpl_IPipe* aCI= 0;
|
||||
Standard_Integer aType = aFunction->GetType();
|
||||
if(aType == PIPE_BASE_PATH)
|
||||
aCI = new GEOMImpl_IPipe(aFunction);
|
||||
else if(aType == PIPE_DIFFERENT_SECTIONS)
|
||||
aCI = new GEOMImpl_IPipeDiffSect(aFunction);
|
||||
else
|
||||
return 0;
|
||||
|
||||
Handle(GEOM_Function) aRefPath = aCI->GetPath();
|
||||
TopoDS_Shape aShapePath = aRefPath->GetValue();
|
||||
|
||||
|
||||
if (aShapePath.IsNull())
|
||||
{
|
||||
cout<<"Driver : path is null"<<endl;
|
||||
if(aCI) delete aCI;
|
||||
Standard_NullObject::Raise("MakePipe aborted : null path argument");
|
||||
}
|
||||
|
||||
// Get path contour
|
||||
TopoDS_Wire aWirePath;
|
||||
if (aShapePath.ShapeType() == TopAbs_WIRE) {
|
||||
aWirePath = TopoDS::Wire(aShapePath);
|
||||
}
|
||||
else {
|
||||
if (aShapePath.ShapeType() == TopAbs_EDGE) {
|
||||
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aShapePath);
|
||||
aWirePath = BRepBuilderAPI_MakeWire(anEdge);
|
||||
}
|
||||
else {
|
||||
if(aCI) delete aCI;
|
||||
Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge");
|
||||
}
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (aType == PIPE_BASE_PATH) {
|
||||
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
||||
Handle(GEOM_Function) aRefPath = aCI.GetPath();
|
||||
if (aType == PIPE_BASE_PATH)
|
||||
{
|
||||
|
||||
Handle(GEOM_Function) aRefBase = aCI->GetBase();
|
||||
|
||||
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||
TopoDS_Shape aShapePath = aRefPath->GetValue();
|
||||
if (aShapeBase.IsNull() || aShapePath.IsNull()) {
|
||||
Standard_NullObject::Raise("MakePipe aborted : null shape argument");
|
||||
}
|
||||
|
||||
// Get path contour
|
||||
TopoDS_Wire aWire;
|
||||
if (aShapePath.ShapeType() == TopAbs_WIRE) {
|
||||
aWire = TopoDS::Wire(aShapePath);
|
||||
} else {
|
||||
if (aShapePath.ShapeType() == TopAbs_EDGE) {
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aShapePath);
|
||||
aWire = BRepBuilderAPI_MakeWire(anEdge);
|
||||
} else {
|
||||
Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge");
|
||||
}
|
||||
|
||||
if (aShapeBase.IsNull()) {
|
||||
if(aCI) delete aCI;
|
||||
Standard_NullObject::Raise("MakePipe aborted : null base argument");
|
||||
}
|
||||
|
||||
// Make pipe
|
||||
aShape = BRepOffsetAPI_MakePipe(aWire, aShapeBase);
|
||||
}
|
||||
else {
|
||||
aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase);
|
||||
}
|
||||
|
||||
//building pipe with different sections
|
||||
else if (aType == PIPE_DIFFERENT_SECTIONS)
|
||||
{
|
||||
GEOMImpl_IPipeDiffSect* aCIDS = (GEOMImpl_IPipeDiffSect*)aCI;
|
||||
//GEOMImpl_IPipeDiffSect* aCIDS = static_cast<GEOMImpl_IPipeDiffSect*>(aCI);
|
||||
BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
|
||||
Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases ();
|
||||
Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations ();
|
||||
Standard_Boolean aWithContact = (aCIDS->GetWithContactMode());
|
||||
Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode());
|
||||
|
||||
Standard_Integer i =1, nbBases = aBasesObjs->Length(),
|
||||
nbLocs = (aLocObjs.IsNull() ? 0 :aLocObjs->Length());
|
||||
|
||||
if(nbLocs && nbLocs != nbBases)
|
||||
{
|
||||
if(aCI) delete aCI;
|
||||
Standard_ConstructionError::Raise("Number of sections is not equal to number of locations ");
|
||||
}
|
||||
TopTools_SequenceOfShape aSeqBases;
|
||||
TopTools_SequenceOfShape aSeqLocs;
|
||||
TopTools_SequenceOfShape aSeqFaces;
|
||||
for( ; i <= nbBases; i++)
|
||||
{
|
||||
Handle(Standard_Transient) anItem = aBasesObjs->Value(i);
|
||||
if(anItem.IsNull())
|
||||
continue;
|
||||
Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem);
|
||||
if(aRefBase.IsNull())
|
||||
continue;
|
||||
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||
if(aShapeBase.IsNull())
|
||||
continue;
|
||||
TopAbs_ShapeEnum aTypeBase = aShapeBase.ShapeType();
|
||||
|
||||
//if for section was specified face with a few wires then a few
|
||||
// pipes were build and make solid
|
||||
if(aTypeBase == TopAbs_FACE)
|
||||
{
|
||||
//for case one path should be used other type function
|
||||
aSeqFaces.Append(aShapeBase);
|
||||
TopExp_Explorer aExpW(aShapeBase,TopAbs_WIRE);
|
||||
for( ; aExpW.More(); aExpW.Next())
|
||||
{
|
||||
TopoDS_Shape aWireProf = aExpW.Current();
|
||||
aSeqBases.Append(aWireProf);
|
||||
}
|
||||
}
|
||||
else if(aTypeBase == TopAbs_WIRE || aTypeBase == TopAbs_VERTEX)
|
||||
aSeqBases.Append(aShapeBase);
|
||||
else if(aTypeBase == TopAbs_EDGE)
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aShapeBase);
|
||||
TopoDS_Shape aWireProf = BRepBuilderAPI_MakeWire(anEdge);
|
||||
aSeqBases.Append(aWireProf);
|
||||
}
|
||||
if(nbLocs)
|
||||
{
|
||||
Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i);
|
||||
if(anItemLoc.IsNull())
|
||||
continue;
|
||||
Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc);
|
||||
TopoDS_Shape aShapeLoc = aRefLoc->GetValue();
|
||||
if(aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX)
|
||||
continue;
|
||||
aSeqLocs.Append(aShapeLoc);
|
||||
}
|
||||
}
|
||||
|
||||
nbLocs = aSeqLocs.Length();
|
||||
Standard_Integer nbShapes = aSeqBases.Length();
|
||||
Standard_Integer step = nbShapes/nbBases;
|
||||
|
||||
if(nbShapes < nbBases || fmod(nbShapes,nbBases))
|
||||
{
|
||||
if(aCI) delete aCI;
|
||||
Standard_ConstructionError::Raise("Invalid sections were specified for building pipe");
|
||||
}
|
||||
|
||||
Standard_Integer ind =0;
|
||||
for( i=1; i <= nbShapes && ind < nbShapes; i++) //i+nbBases <= nbShapes
|
||||
{
|
||||
TopTools_SequenceOfShape usedBases;
|
||||
Standard_Integer j = 1;
|
||||
for( ; j <= nbBases ; j++)
|
||||
{
|
||||
ind = i + (j-1)*step;
|
||||
|
||||
TopoDS_Shape aWireProf = aSeqBases.Value(ind);
|
||||
usedBases.Append(aWireProf);
|
||||
if(nbLocs)
|
||||
{
|
||||
TopoDS_Shape aShapeLoc = aSeqLocs.Value(j);
|
||||
TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc);
|
||||
aBuilder.Add(aWireProf,aVert,aWithContact,aWithCorrect);
|
||||
}
|
||||
else
|
||||
aBuilder.Add(aWireProf,aWithContact,aWithCorrect);
|
||||
}
|
||||
if(!aBuilder.IsReady())
|
||||
{
|
||||
if(aCI) delete aCI;
|
||||
Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
|
||||
}
|
||||
aBuilder.Build();
|
||||
aShape = aBuilder.Shape();
|
||||
aSeqFaces.Append(aShape);
|
||||
for( j = 1; j <=usedBases.Length(); j++)
|
||||
aBuilder.Delete(usedBases.Value(j));
|
||||
}
|
||||
|
||||
//for case if section is face
|
||||
if(aSeqFaces.Length() >1)
|
||||
{
|
||||
BRep_Builder aB;
|
||||
TopoDS_Compound aComp;
|
||||
aB.MakeCompound(aComp);
|
||||
for( i = 1; i <= aSeqFaces.Length(); i++)
|
||||
aB.Add(aComp,aSeqFaces.Value(i));
|
||||
aShape = aComp;
|
||||
}
|
||||
}
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
||||
BRepCheck_Analyzer ana (aShape, Standard_False);
|
||||
if (!ana.IsValid()) {
|
||||
if(aCI) delete aCI;
|
||||
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
||||
}
|
||||
|
||||
aFunction->SetValue(aShape);
|
||||
|
||||
log.SetTouched(Label());
|
||||
|
||||
if(aCI) delete aCI;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <ShapeAnalysis.hxx>
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -42,6 +44,8 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
@ -126,7 +130,45 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_TypeMismatch::Raise("Plane creation aborted: non-planar face given as argument");
|
||||
}
|
||||
aShape = BRepBuilderAPI_MakeFace(aGS, -aSize, +aSize, -aSize, +aSize).Shape();
|
||||
} else {
|
||||
}
|
||||
else if (aType == PLANE_TANGENT_FACE)
|
||||
{
|
||||
Handle(GEOM_Function) aRefFace = aPI.GetFace();
|
||||
TopoDS_Shape aShape1 = aRefFace->GetValue();
|
||||
if(aShape1.IsNull())
|
||||
Standard_TypeMismatch::Raise("Plane was not created.Basis face was not specified");
|
||||
TopoDS_Face aFace = TopoDS::Face(aShape1);
|
||||
|
||||
Standard_Real aKoefU = aPI.GetParameterU();
|
||||
Standard_Real aKoefV = aPI.GetParameterV();
|
||||
Standard_Real aUmin,aUmax,aVmin,aVmax;
|
||||
ShapeAnalysis::GetFaceUVBounds(aFace,aUmin,aUmax,aVmin,aVmax);
|
||||
Standard_Real aDeltaU = aUmax - aUmin;
|
||||
Standard_Real aDeltaV = aVmax - aVmin;
|
||||
Standard_Real aParamU = aUmin + aDeltaU*aKoefU;
|
||||
Standard_Real aParamV = aVmin + aDeltaV*aKoefV;
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
|
||||
if(aSurf.IsNull())
|
||||
Standard_TypeMismatch::Raise("Plane was not created.Base surface is absent");
|
||||
gp_Vec aVecU,aVecV;
|
||||
gp_Pnt aPLoc;
|
||||
aSurf->D1(aParamU,aParamV,aPLoc,aVecU,aVecV);
|
||||
BRepTopAdaptor_FClass2d clas(aFace,Precision::PConfusion());
|
||||
|
||||
TopAbs_State stOut= clas.PerformInfinitePoint();
|
||||
gp_Pnt2d aP2d(aParamU,aParamV);
|
||||
TopAbs_State st= clas.Perform(aP2d);
|
||||
if(st == stOut)
|
||||
Standard_TypeMismatch::Raise("Plane was not created.Point lies outside the face");
|
||||
gp_Vec aNorm = aVecU^aVecV;
|
||||
gp_Ax3 anAxis(aPLoc,gp_Dir(aNorm),gp_Dir(aVecU));
|
||||
gp_Pln aPlane(anAxis);
|
||||
BRepBuilderAPI_MakeFace aTool(aPlane, -aSize, +aSize, -aSize, +aSize);
|
||||
if(aTool.IsDone())
|
||||
aShape = aTool.Shape();
|
||||
}
|
||||
|
||||
else {
|
||||
}
|
||||
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
@ -79,6 +79,8 @@
|
||||
|
||||
#define GEOM_MARKER 39
|
||||
|
||||
#define GEOM_THRUSECTIONS 40
|
||||
|
||||
//GEOM_Function types
|
||||
|
||||
#define COPY_WITH_REF 1
|
||||
@ -90,13 +92,16 @@
|
||||
#define POINT_XYZ 1
|
||||
#define POINT_XYZ_REF 2
|
||||
#define POINT_CURVE_PAR 3
|
||||
//#define POINT_FACE_PAR 4
|
||||
|
||||
#define VECTOR_TWO_PNT 1
|
||||
#define VECTOR_DX_DY_DZ 2
|
||||
#define VECTOR_TANGENT_CURVE_PAR 3
|
||||
|
||||
#define PLANE_PNT_VEC 1
|
||||
#define PLANE_FACE 2
|
||||
#define PLANE_THREE_PNT 3
|
||||
#define PLANE_TANGENT_FACE 4
|
||||
|
||||
#define LINE_TWO_PNT 1
|
||||
#define LINE_PNT_DIR 2
|
||||
@ -152,6 +157,10 @@
|
||||
#define REVOLUTION_BASE_AXIS_ANGLE 1
|
||||
|
||||
#define PIPE_BASE_PATH 1
|
||||
#define PIPE_DIFFERENT_SECTIONS 2
|
||||
|
||||
#define THRUSECTIONS_RULED 1
|
||||
#define THRUSECTIONS_SMOOTHED 2
|
||||
|
||||
#define BOOLEAN_COMMON 1
|
||||
#define BOOLEAN_CUT 2
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
@ -67,7 +69,7 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
GEOMImpl_IVector aPI (aFunction);
|
||||
Standard_Integer aType = aFunction->GetType();
|
||||
if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT) return 0;
|
||||
if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT && aType != VECTOR_TANGENT_CURVE_PAR) return 0;
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
@ -98,7 +100,32 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_ConstructionError::Raise("The end points are too close");
|
||||
}
|
||||
aShape = BRepBuilderAPI_MakeEdge(V1, V2).Shape();
|
||||
} else {
|
||||
}
|
||||
else if(aType == VECTOR_TANGENT_CURVE_PAR) {
|
||||
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
|
||||
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_EDGE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Tangent On Curve creation aborted : curve shape is not an edge");
|
||||
}
|
||||
Standard_Real aFParam =0., aLParam =0., aParam =0.;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFParam, aLParam);
|
||||
if(aCurve.IsNull()) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Tangent On Curve creation aborted : curve is null");
|
||||
}
|
||||
|
||||
aParam = aFParam + (aLParam - aFParam) * aPI.GetParameter();
|
||||
gp_Pnt aPoint1,aPoint2;
|
||||
gp_Vec aVec;
|
||||
aCurve->D1(aParam,aPoint1,aVec);
|
||||
if(aVec.Magnitude() < gp::Resolution())
|
||||
Standard_TypeMismatch::Raise
|
||||
("Tangent On Curve creation aborted : invalid value of tangent");
|
||||
aPoint2.SetXYZ(aPoint1.XYZ() + aVec.XYZ());
|
||||
BRepBuilderAPI_MakeEdge aBuilder(aPoint1,aPoint2);
|
||||
if(aBuilder.IsDone())
|
||||
aShape = aBuilder.Shape();
|
||||
}
|
||||
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
@ -18,6 +18,7 @@ FF1BBB16-5D14-4df2-980B-3A668264EA16 // Sphere
|
||||
FF1BBB17-5D14-4df2-980B-3A668264EA16 // Prism (Extrusion)
|
||||
FF1BBB18-5D14-4df2-980B-3A668264EA16 // Revolution
|
||||
FF1BBB19-5D14-4df2-980B-3A668264EA16 // Pipe
|
||||
FF1BB971-E99C-4f89-B989-5B48E061049B //ThruSections
|
||||
|
||||
FF1BBB21-5D14-4df2-980B-3A668264EA16 // Boolean
|
||||
FF1BBB22-5D14-4df2-980B-3A668264EA16 // Partition
|
||||
|
@ -59,6 +59,7 @@ LIB_SRC = GEOMImpl_IBasicOperations.cxx \
|
||||
GEOMImpl_TorusDriver.cxx \
|
||||
GEOMImpl_PrismDriver.cxx \
|
||||
GEOMImpl_PipeDriver.cxx \
|
||||
GEOMImpl_ThruSectionsDriver.cxx \
|
||||
GEOMImpl_RevolutionDriver.cxx \
|
||||
GEOMImpl_ShapeDriver.cxx \
|
||||
GEOMImpl_BlockDriver.cxx \
|
||||
|
@ -484,3 +484,101 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeThruSections
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
|
||||
CORBA::Boolean theModeSolid,
|
||||
CORBA::Double thePreci,
|
||||
CORBA::Boolean theRuled)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
|
||||
int ind, aLen;
|
||||
|
||||
//Get the shapes
|
||||
aLen = theSeqSections.length();
|
||||
for (ind = 0; ind < aLen; ind++) {
|
||||
if (theSeqSections[ind] == NULL) continue;
|
||||
Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
|
||||
(theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
|
||||
if (!aSh.IsNull())
|
||||
aSeqSections->Append(aSh);
|
||||
}
|
||||
if(!aSeqSections->Length())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
// Make shell or solid
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakePipeWithDifferentSections
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
|
||||
const GEOM::ListOfGO& theLocations,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Boolean theWithContact,
|
||||
CORBA::Boolean theWithCorrections)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
|
||||
Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
|
||||
int ind=0, aNbBases =0,aNbLocs=0;
|
||||
|
||||
//Get the shapes
|
||||
aNbBases = theBases.length();
|
||||
aNbLocs = theLocations.length();
|
||||
|
||||
if( aNbLocs && aNbBases != aNbLocs)
|
||||
return aGEOMObject._retn();
|
||||
|
||||
Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
|
||||
(thePath->GetStudyID(), thePath->GetEntry());
|
||||
if(aPath.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
for (ind = 0; ind < aNbBases; ind++) {
|
||||
if (theBases[ind] == NULL) continue;
|
||||
Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
|
||||
theBases[ind]->GetEntry());
|
||||
if(aBase.IsNull())
|
||||
continue;
|
||||
if(aNbLocs)
|
||||
{
|
||||
Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
|
||||
(theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
|
||||
if(aLoc.IsNull())
|
||||
continue;
|
||||
aSeqLocations->Append(aLoc);
|
||||
}
|
||||
aSeqBases->Append(aBase);
|
||||
}
|
||||
if(!aSeqBases->Length())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
// Make pipe
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
|
||||
theWithContact,theWithCorrections);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
@ -94,6 +94,17 @@ class GEOM_I3DPrimOperations_i :
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
|
||||
CORBA::Boolean theModeSolid,
|
||||
CORBA::Double thePreci,
|
||||
CORBA::Boolean theRuled);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
|
||||
const GEOM::ListOfGO& theLocations,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Boolean theWithContact,
|
||||
CORBA::Boolean theWithCorrections);
|
||||
|
||||
::GEOMImpl_I3DPrimOperations* GetOperations()
|
||||
{ return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
|
||||
};
|
||||
|
@ -136,6 +136,37 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeTangentOnCurve
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentOnCurve
|
||||
(GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
if (theCurve == NULL) return aGEOMObject._retn();
|
||||
|
||||
//Get the reference curve
|
||||
|
||||
Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
|
||||
(theCurve->GetStudyID(), theCurve->GetEntry());
|
||||
if (aRefernce.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the point
|
||||
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeTangentOnCurve(aRefernce, theParameter);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
@ -388,3 +419,39 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeTangentPlaneOnFace
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentPlaneOnFace
|
||||
(GEOM::GEOM_Object_ptr theFace,
|
||||
CORBA::Double theParameterU,
|
||||
CORBA::Double theParameterV,
|
||||
CORBA::Double theTrimSize)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
if (theFace == NULL) return aGEOMObject._retn();
|
||||
|
||||
//Get the reference face
|
||||
|
||||
Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject
|
||||
(theFace->GetStudyID(), theFace->GetEntry());
|
||||
if (aRef.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the plane
|
||||
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeTangentPlaneOnFace(aRef, theParameterU,theParameterV,theTrimSize);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,9 @@ class GEOM_IBasicOperations_i :
|
||||
GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve,
|
||||
CORBA::Double theParameter);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
|
||||
CORBA::Double theParameter);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX,
|
||||
CORBA::Double theDY,
|
||||
CORBA::Double theDZ);
|
||||
@ -81,6 +84,11 @@ class GEOM_IBasicOperations_i :
|
||||
CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
|
||||
CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace,
|
||||
CORBA::Double theParameterU,
|
||||
CORBA::Double theParameterV,
|
||||
CORBA::Double theTrimSize);
|
||||
|
||||
::GEOMImpl_IBasicOperations* GetOperations() { return (::GEOMImpl_IBasicOperations*)GetImpl(); }
|
||||
};
|
||||
|
||||
|
@ -536,6 +536,17 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the
|
||||
return myBasicOp->MakePointOnCurve(theRefCurve, theParameter);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeTangentOnCurve:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
|
||||
CORBA::Double theParameter)
|
||||
{
|
||||
MESSAGE("GEOM_Superv_i::MakeTangentOnCurve");
|
||||
getBasicOp();
|
||||
return myBasicOp->MakeTangentOnCurve(theRefCurve, theParameter);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeVectorDXDYDZ:
|
||||
//=============================================================================
|
||||
@ -619,6 +630,19 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarker
|
||||
return myBasicOp->MakeMarker(theOX, theOY, theOZ, theXDX, theXDY, theXDZ, theYDX, theYDY, theYDZ);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeTangentPlaneOnFace:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace,
|
||||
CORBA::Double theParameterU,
|
||||
CORBA::Double theParameterV,
|
||||
CORBA::Double theTrimSize)
|
||||
{
|
||||
MESSAGE("GEOM_Superv_i::MakeTangentPlaneOnFace");
|
||||
getBasicOp();
|
||||
return myBasicOp->MakeTangentPlaneOnFace(theFace, theParameterU,theParameterV,theTrimSize);
|
||||
}
|
||||
|
||||
//================= Primitives Construction : 3DPrimOperations ================
|
||||
//=============================================================================
|
||||
// MakeBox:
|
||||
@ -845,6 +869,32 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape
|
||||
return myBoolOp->MakeBoolean(theShape1, theShape2, theOperation);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeThruSections:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
|
||||
CORBA::Boolean theModeSolid,
|
||||
CORBA::Double thePreci,
|
||||
CORBA::Boolean theRuled)
|
||||
{
|
||||
MESSAGE("GEOM_Superv_i::MakeThruSections");
|
||||
get3DPrimOp();
|
||||
return my3DPrimOp->MakeThruSections(theSeqSections, theModeSolid,thePreci,theRuled);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakePipe:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
|
||||
const GEOM::ListOfGO& theLocations,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Boolean theWithContact,
|
||||
CORBA::Boolean theWithCorrections)
|
||||
{
|
||||
MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections");
|
||||
get3DPrimOp();
|
||||
return my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections);
|
||||
}
|
||||
//=============================================================================
|
||||
// MakeFuse:
|
||||
//=============================================================================
|
||||
|
@ -142,6 +142,8 @@ public:
|
||||
CORBA::Double theZ);
|
||||
GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
|
||||
CORBA::Double theParameter);
|
||||
GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
|
||||
CORBA::Double theParameter);
|
||||
GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX,
|
||||
CORBA::Double theDY,
|
||||
CORBA::Double theDZ);
|
||||
@ -162,6 +164,11 @@ public:
|
||||
CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
|
||||
CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace,
|
||||
CORBA::Double theParameterU,
|
||||
CORBA::Double theParameterV,
|
||||
CORBA::Double theTrimSize);
|
||||
|
||||
//-----------------------------------------------------------//
|
||||
// Primitives Construction : 3DPrimOperations //
|
||||
//-----------------------------------------------------------//
|
||||
@ -218,6 +225,17 @@ public:
|
||||
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
|
||||
CORBA::Double theTol2D, CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
|
||||
CORBA::Boolean theModeSolid,
|
||||
CORBA::Double thePreci,
|
||||
CORBA::Boolean theRuled);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
|
||||
const GEOM::ListOfGO& theLocations,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Boolean theWithContact,
|
||||
CORBA::Boolean theWithCorrections);
|
||||
|
||||
//-----------------------------------------------------------//
|
||||
// BooleanOperations //
|
||||
|
@ -184,6 +184,20 @@ def MakeVertexOnCurve(theRefCurve, theParameter):
|
||||
print "MakePointOnCurve : ", BasicOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
def MakeTangentOnCurve(theRefCurve, theParameter):
|
||||
"""
|
||||
* Create a tangent, corresponding to the given parameter on the given curve.
|
||||
* \param theRefCurve The referenced curve.
|
||||
* \param theParameter Value of parameter on the referenced curve.
|
||||
* \return New GEOM_Object, containing the created tangent.
|
||||
|
||||
*
|
||||
"""
|
||||
anObj = BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
|
||||
if BasicOp.IsDone() == 0:
|
||||
print "MakeTangentOnCurve : ", BasicOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
## Create a vector with the given components.
|
||||
# @param theDX X component of the vector.
|
||||
# @param theDY Y component of the vector.
|
||||
@ -668,6 +682,45 @@ def MakeRevolution(theBase, theAxis, theAngle):
|
||||
print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
def MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled):
|
||||
"""
|
||||
* Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
|
||||
* \param theSeqSections - set of specified sections.
|
||||
* \param theModeSolid - mode defining building solid or shell
|
||||
* \param thePreci - precision 3D used for smoothing by default 1.e-6
|
||||
* \param theRuled - mode defining type of the result surfaces (ruled or smoothed).
|
||||
* \return New GEOM_Object, containing the created shell or solid.
|
||||
|
||||
* Example: see GEOM_TestAll.py
|
||||
"""
|
||||
anObj = PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
|
||||
if PrimOp.IsDone() == 0:
|
||||
print "MakeThruSections : ", PrimOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection):
|
||||
"""
|
||||
* Create a shape by extrusion of the profile shape along
|
||||
* the path shape. The path shape can be a wire or an edge.
|
||||
* the several profiles can be specified in the several locations of path.
|
||||
* \param theSeqBases - list of Bases shape to be extruded.
|
||||
* \param theLocations - list of locations on the path corresponding
|
||||
* specified list of the Bases shapes. Number of locations
|
||||
* should be equal to number of bases or list of locations can be empty.
|
||||
* \param thePath - Path shape to extrude the base shape along it.
|
||||
* \param theWithContact - the mode defining that the section is translated to be in
|
||||
* contact with the spine.
|
||||
* \param - WithCorrection - defining that the section is rotated to be
|
||||
* orthogonal to the spine tangent in the correspondent point
|
||||
* \return New GEOM_Object, containing the created pipe.
|
||||
|
||||
* Example: see GEOM_TestAll.py
|
||||
"""
|
||||
anObj = PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection)
|
||||
if PrimOp.IsDone() == 0:
|
||||
print "MakePipeWithDifferentSections : ", PrimOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Create base shapes
|
||||
# -----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user