mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-14 21:30:33 +05:00
0021023: EDF 1597 GEOM: Translate object along an arc with distance
This commit is contained in:
parent
47b96b4565
commit
7408a75fe6
@ -12,7 +12,9 @@ two directions.
|
||||
\n To produce a <b>Simple Multi Translation</b> (in one direction) you
|
||||
need to indicate an \b Object to be translated, a \b Vector of
|
||||
translation, a \b Step of translation and a <b>Number of Times</b> the
|
||||
Object should be duplicated.
|
||||
Object should be duplicated. If a curve was selected instead of Vector,
|
||||
only its first and last vertices will be used to get the vector direction
|
||||
and the dialog preview will display the vector along which the object will be translated.
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeMultiTranslation1D(Shape, Dir,
|
||||
Step, NbTimes)</em>
|
||||
\n <b>Arguments:</b> Name + 1 shape + 1 vector (for direction) + 1
|
||||
@ -27,6 +29,8 @@ step value + 1 value (repetition).
|
||||
\n To produce a <b>Double Multi Translation</b> (in two directions) you need to
|
||||
indicate an \b Object to be translated, and, for both axes, a \b
|
||||
Vector of translation, a \b Step of translation and a <b>Number of Times</b> the shape must be duplicated.
|
||||
If a curve was selected instead of Vectors, only its first and last vertices will be used to get the vector direction
|
||||
and the dialog preview will display the vector along which the object will be translated.
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeMultiTranslation2D(Shape, Dir1,
|
||||
Step1, NbTimes1, Dir2, Step2, NbTimes2),</em> where \em Shape is a shape
|
||||
|
@ -32,6 +32,8 @@ of the vector.
|
||||
\image html transformation2.png
|
||||
|
||||
\n Finally you can define an \b Object and the vector. The object will be translated by the length of the vector.
|
||||
If a curve was selected instead of vector, only its first and last vertices will be used to get the vector direction
|
||||
and the dialog preview will display the vector along which the object will be translated.
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeTranslationVector(Object, Vector)</em>
|
||||
\n <b>Activate Distance</b> checkbox and <b>Distance</b> field allow defining the custom distance of translation.
|
||||
\n <b>TUI Command </b> for translation by vector and custom distance: <em>geompy.MakeTranslationVectorDistance(Object, Vector, Distance)</em>
|
||||
|
@ -32,8 +32,14 @@
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_ViewWindow.h>
|
||||
#include <SUIT_ViewManager.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <GEOM_AISVector.hxx>
|
||||
#include <SOCC_Prs.h>
|
||||
#include <SOCC_ViewModel.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@ -42,6 +48,10 @@
|
||||
#include <TopExp.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
@ -680,6 +690,7 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
|
||||
createPathPreview ( myVectorU );
|
||||
anObj = anOper->MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
|
||||
if(!IsPreview()) {
|
||||
aParameters<<GroupPoints->SpinBox_DX->text();
|
||||
@ -691,6 +702,8 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
case 1:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
|
||||
!CORBA::is_nil(myVectorV)) {
|
||||
createPathPreview ( myVectorU );
|
||||
createPathPreview ( myVectorV );
|
||||
anObj = anOper->MultiTranslate2D(myBase,
|
||||
myVectorU, myStepU, myNbTimesU,
|
||||
myVectorV, myStepV, myNbTimesV);
|
||||
@ -754,3 +767,29 @@ void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_pt
|
||||
mainFrame()->CheckBoxAddPrefix->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : createPathPreview
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Object_var thePath )
|
||||
{
|
||||
if ( IsPreview() ) {
|
||||
TopoDS_Shape aShape;
|
||||
GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE );
|
||||
TopoDS_Edge anEdge = TopoDS::Edge( aShape );
|
||||
ShapeAnalysis_Edge aShapeAnal;
|
||||
TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge );
|
||||
TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge );
|
||||
TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape();
|
||||
const char* aName = "tmpVector";
|
||||
Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName );
|
||||
|
||||
// add Prs to preview
|
||||
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
|
||||
if (aPrs)
|
||||
aPrs->AddObject(anIO);
|
||||
GEOMBase_Helper::displayPreview( aPrs, false, true );
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ protected:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void createPathPreview( GEOM::GEOM_Object_var );
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myBase, myVectorU, myVectorV;
|
||||
|
@ -32,16 +32,27 @@
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_ViewWindow.h>
|
||||
#include <SUIT_ViewManager.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <GEOM_AISVector.hxx>
|
||||
#include <SOCC_Prs.h>
|
||||
#include <SOCC_ViewModel.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
@ -628,6 +639,8 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
QStringList aParameters;
|
||||
aParameters<<GroupPoints->SpinBox3->text();
|
||||
bool byDistance = GroupPoints->CheckBox1->isChecked();
|
||||
createPathPreview( myVector );
|
||||
|
||||
if (byDistance) {
|
||||
double aDistance = GroupPoints->SpinBox3->value();
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
@ -732,3 +745,29 @@ void TransformationGUI_TranslationDlg::addSubshapesToStudy()
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : createPathPreview
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::createPathPreview ( GEOM::GEOM_Object_var thePath )
|
||||
{
|
||||
if ( IsPreview() ) {
|
||||
TopoDS_Shape aShape;
|
||||
GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE );
|
||||
TopoDS_Edge anEdge = TopoDS::Edge( aShape );
|
||||
ShapeAnalysis_Edge aShapeAnal;
|
||||
TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge );
|
||||
TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge );
|
||||
TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape();
|
||||
const char* aName = "tmpVector";
|
||||
Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName );
|
||||
|
||||
// add Prs to preview
|
||||
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
|
||||
if (aPrs)
|
||||
aPrs->AddObject(anIO);
|
||||
GEOMBase_Helper::displayPreview( aPrs, false, true );
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ protected:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void createPathPreview( GEOM::GEOM_Object_var );
|
||||
|
||||
private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
|
Loading…
Reference in New Issue
Block a user