SHAPER  9.12.0
PartSet_Tools Class Reference

The operation for the sketch feature creation. More...

Public Types

enum  ConstraintVisibleState { Geometrical = 0 , Dimensional , Expressions , Any }
 types of constraints which visible state can be changed in the sketch widget More...
 

Static Public Member Functions

static int getAISDefaultWidth ()
 Returns default value of AIS presentation. More...
 
static gp_Pnt convertClickToPoint (QPoint thePoint, HandlettheView)
 Converts the 2D screen point to the 3D point on the view according to the point of view. More...
 
static void convertTo2D (const gp_Pnt &thePoint, FeaturePtr theSketch, HandlettheView, double &theX, double &theY)
 Converts the 3D point to the projected coodinates on the sketch plane. More...
 
static std::shared_ptr< GeomAPI_Pnt2dconvertTo2D (FeaturePtr theSketch, const std::shared_ptr< GeomAPI_Pnt > &thePnt)
 Converts the 3D point to the projected coodinates on the sketch plane. More...
 
static std::shared_ptr< GeomAPI_PntconvertTo3D (const double theX, const double theY, FeaturePtr theSketch)
 Converts the 2D projected coodinates on the sketch plane to the 3D point. More...
 
static std::shared_ptr< ModelAPI_Documentdocument ()
 Returns pointer to the root document. More...
 
static void setFeatureValue (FeaturePtr theFeature, double theX, const std::string &theAttribute)
 Save the double to the feature. More...
 
static double featureValue (FeaturePtr theFeature, const std::string &theAttribute, bool &isValid)
 Returns the feature double value if it is. More...
 
static FeaturePtr feature (FeaturePtr theFeature, const std::string &theAttribute, const std::string &theKind)
 Find a feature in the attribute of the given feature. More...
 
static void createConstraint (CompositeFeaturePtr theSketch, std::shared_ptr< GeomDataAPI_Point2D > thePoint1, std::shared_ptr< GeomDataAPI_Point2D > thePoint2)
 Creates a constraint on two points. More...
 
static std::shared_ptr< GeomAPI_PlnsketchPlane (CompositeFeaturePtr theSketch)
 Create a sketch plane instance. More...
 
static void nullifySketchPlane (CompositeFeaturePtr theSketch)
 Create a sketch plane instance. More...
 
static std::shared_ptr< GeomAPI_Pntpoint3D (std::shared_ptr< GeomAPI_Pnt2d > thePoint2D, CompositeFeaturePtr theSketch)
 Create a point 3D on a basis of point 2D and sketch feature. More...
 
static std::shared_ptr< ModelAPI_ResultfindFixedObjectByExternal (const TopoDS_Shape &theShape, const ObjectPtr &theObject, CompositeFeaturePtr theSketch)
 Finds a line (arc or circle) by given edge. More...
 
static std::shared_ptr< ModelAPI_ResultcreateFixedObjectByExternal (const std::shared_ptr< GeomAPI_Shape > &theShape, const ObjectPtr &theObject, CompositeFeaturePtr theSketch, const bool theTemporary, FeaturePtr &theCreatedFeature)
 Creates a line (arc or circle) by given edge Created line will have fixed constraint. More...
 
static bool isContainPresentation (const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &theSelected, const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)
 Checks whether the list of selected presentations contains the given one. More...
 
static std::pair< AttributePtr, int > findAttributeBy2dPoint (ObjectPtr theObj, const TopoDS_Shape theShape, FeaturePtr theSketch)
 Find attribute of object which corresponds to the given shape. More...
 
static std::shared_ptr< GeomAPI_ShapefindShapeBy2DPoint (const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop)
 Finds an attribute value in attribute reference attribute value. More...
 
static std::shared_ptr< GeomAPI_Pnt2dgetPoint (std::shared_ptr< ModelAPI_Feature > &theFeature, const std::string &theAttribute)
 Returns point of coincidence feature. More...
 
static std::shared_ptr< GeomAPI_Pnt2dgetPnt2d (QMouseEvent *theEvent, ModuleBase_IViewWindow *theWindow, const FeaturePtr &theSketch)
 Convertes parameters into a geom point. More...
 
static std::shared_ptr< GeomAPI_Pnt2dgetPnt2d (const Handle &&theView, const TopoDS_Shape &theShape, const FeaturePtr &theSketch)
 Returns point 2d from selected shape. More...
 
static FeaturePtr findFirstCoincidence (const FeaturePtr &theFeature, std::shared_ptr< GeomAPI_Pnt2d > thePoint)
 Gets all references to the feature, take coincidence constraint features, get point 2d attributes and compare the point value to be equal with the given. More...
 
static void findCoincidences (FeaturePtr theStartCoin, QList< FeaturePtr > &theList, QList< FeaturePtr > &theCoincidencies, std::string theAttr, QList< bool > &theIsAttributes)
 Returns list of features connected in a councedence feature point. More...
 
static FeaturePtr findRefsToMeFeature (FeaturePtr theFeature, const std::string &theFeatureId)
 
static std::shared_ptr< GeomAPI_Pnt2dgetCoincedencePoint (FeaturePtr theStartCoin)
 Returns point of a coincedence. More...
 
static void sendSubFeaturesEvent (const CompositeFeaturePtr &theComposite, const Events_ID theId)
 Sends redisplay event for all sub-features of the composite. Flush it. More...
 
static bool isAuxiliarySketchEntity (const ObjectPtr &theObject)
 Returns true if the object is a sketch entity, where auxiliary attribute has true value. More...
 
static bool isIncludeIntoSketchResult (const ObjectPtr &theObject)
 Returns true if the object is a sketch entity produced by projection or intersection feature and if it should not be included into the sketch result. More...
 
static ResultPtr createFixedByExternalCenter (const ObjectPtr &theObject, const std::shared_ptr< GeomAPI_Edge > &theEdge, ModelAPI_AttributeSelection::CenterType theType, const CompositeFeaturePtr &theSketch, bool theTemporary, FeaturePtr &theCreatedFeature)
 
static void getFirstAndLastIndexInFolder (const ObjectPtr &theFolder, int &theFirst, int &theLast)
 
static void getDefaultColor (ObjectPtr theObject, const bool isEmptyColorValid, std::vector< int > &theColor)
 Returns default color value for the given object. More...
 
static double getDefaultDeflection (const ObjectPtr &theObject)
 Returns default deflection value for the given object. More...
 
static double getDefaultTransparency ()
 Returns default transparency value. More...
 
static QCursor getOperationCursor ()
 Returns cursor according to (SKETCH_TAB_NAME, "operation_cursor") property value. More...
 

Detailed Description

The operation for the sketch feature creation.

Member Enumeration Documentation

◆ ConstraintVisibleState

types of constraints which visible state can be changed in the sketch widget

Member Function Documentation

◆ getAISDefaultWidth()

int PartSet_Tools::getAISDefaultWidth ( )
static

Returns default value of AIS presentation.

Returns
integer value

◆ convertClickToPoint()

gp_Pnt PartSet_Tools::convertClickToPoint ( QPoint  thePoint,
HandlettheView   
)
static

Converts the 2D screen point to the 3D point on the view according to the point of view.

Parameters
thePointa screen point
theViewa 3D view

◆ convertTo2D() [1/2]

void PartSet_Tools::convertTo2D ( const gp_Pnt &  thePoint,
FeaturePtr  theSketch,
HandlettheView  ,
double &  theX,
double &  theY 
)
static

Converts the 3D point to the projected coodinates on the sketch plane.

Parameters
thePointthe 3D point in the viewer
theSketchthe sketch feature
theViewa view 3d object
theXthe X coordinate
theYthe Y coordinate

◆ convertTo2D() [2/2]

std::shared_ptr< GeomAPI_Pnt2d > PartSet_Tools::convertTo2D ( FeaturePtr  theSketch,
const std::shared_ptr< GeomAPI_Pnt > &  thePnt 
)
static

Converts the 3D point to the projected coodinates on the sketch plane.

Parameters
theSketchthe sketch feature
thePntthe 3D point in the viewer
Returns
the converted point object

◆ convertTo3D()

std::shared_ptr< GeomAPI_Pnt > PartSet_Tools::convertTo3D ( const double  theX,
const double  theY,
FeaturePtr  theSketch 
)
static

Converts the 2D projected coodinates on the sketch plane to the 3D point.

Parameters
theXthe X coordinate
theYthe Y coordinate
theSketchthe sketch feature

◆ document()

std::shared_ptr< ModelAPI_Document > PartSet_Tools::document ( )
static

Returns pointer to the root document.

◆ setFeatureValue()

void PartSet_Tools::setFeatureValue ( FeaturePtr  theFeature,
double  theX,
const std::string &  theAttribute 
)
static

Save the double to the feature.

If the attribute is double, it is filled.

Parameters
theFeaturethe feature
theXthe horizontal coordinate
theAttributethe feature attribute

◆ featureValue()

double PartSet_Tools::featureValue ( FeaturePtr  theFeature,
const std::string &  theAttribute,
bool &  isValid 
)
static

Returns the feature double value if it is.

Parameters
theFeaturethe feature
theAttributethe feature attribute
isValidan output parameter whether the value is valid
Returns
the feature value

◆ feature()

FeaturePtr PartSet_Tools::feature ( FeaturePtr  theFeature,
const std::string &  theAttribute,
const std::string &  theKind 
)
static

Find a feature in the attribute of the given feature.

If the kind is not empty, the return feature should be this type. Otherwise it is null

Parameters
theFeaturea source feature
theAttributea name of the requried attribute attribute
theKindan output feature kind
Returns
the feature

◆ createConstraint()

void PartSet_Tools::createConstraint ( CompositeFeaturePtr  theSketch,
std::shared_ptr< GeomDataAPI_Point2D thePoint1,
std::shared_ptr< GeomDataAPI_Point2D thePoint2 
)
static

Creates a constraint on two points.

Parameters
theSketcha sketch feature
thePoint1the first point
thePoint2the second point

◆ sketchPlane()

std::shared_ptr< GeomAPI_Pln > PartSet_Tools::sketchPlane ( CompositeFeaturePtr  theSketch)
static

Create a sketch plane instance.

Parameters
theSketcha sketch feature
Returns
API object of geom plane

◆ nullifySketchPlane()

void PartSet_Tools::nullifySketchPlane ( CompositeFeaturePtr  theSketch)
static

Create a sketch plane instance.

Parameters
theSketcha sketch feature
Returns
API object of geom plane

◆ point3D()

std::shared_ptr< GeomAPI_Pnt > PartSet_Tools::point3D ( std::shared_ptr< GeomAPI_Pnt2d thePoint2D,
CompositeFeaturePtr  theSketch 
)
static

Create a point 3D on a basis of point 2D and sketch feature.

Parameters
thePoint2Da point on a sketch
theSketcha sketch feature
Returns
API object of point 3D

◆ findFixedObjectByExternal()

ResultPtr PartSet_Tools::findFixedObjectByExternal ( const TopoDS_Shape &  theShape,
const ObjectPtr &  theObject,
CompositeFeaturePtr  theSketch 
)
static

Finds a line (arc or circle) by given edge.

Parameters
theShapean edge
theObjecta selected result object
theSketcha sketch feature
Returns
result of found feature or NULL

◆ createFixedObjectByExternal()

ResultPtr PartSet_Tools::createFixedObjectByExternal ( const std::shared_ptr< GeomAPI_Shape > &  theShape,
const ObjectPtr &  theObject,
CompositeFeaturePtr  theSketch,
const bool  theTemporary,
FeaturePtr &  theCreatedFeature 
)
static

Creates a line (arc or circle) by given edge Created line will have fixed constraint.

Parameters
theShapean edge
theObjecta selected result object
theSketcha sketch feature
theTemporarythe created external object is temporary, execute is not performed for it
theCreatedFeaturea new projection feature
Returns
result of created feature

◆ isContainPresentation()

bool PartSet_Tools::isContainPresentation ( const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &  theSelected,
const std::shared_ptr< ModuleBase_ViewerPrs > &  thePrs 
)
static

Checks whether the list of selected presentations contains the given one.

Parameters
theSelecteda list of presentations
thePrsa presentation to be found
Returns
- result of check, true if the list contains the prs

◆ findAttributeBy2dPoint()

std::pair< AttributePtr, int > PartSet_Tools::findAttributeBy2dPoint ( ObjectPtr  theObj,
const TopoDS_Shape  theShape,
FeaturePtr  theSketch 
)
static

Find attribute of object which corresponds to the given shape.

Parameters
theObj- an object
theShape- a Shape
theSketch- a Sketch to get a plane of converting to 2d
Returns
Found attribute and index of point if the attribute is an array

◆ findShapeBy2DPoint()

GeomShapePtr PartSet_Tools::findShapeBy2DPoint ( const AttributePtr &  theAttribute,
ModuleBase_IWorkshop theWorkshop 
)
static

Finds an attribute value in attribute reference attribute value.

Parameters
theAttribute- an attribure reference filled with an attribute
theWorkshopa reference to workshop
Returns
a geometry shape

◆ getPoint()

std::shared_ptr< GeomAPI_Pnt2d > PartSet_Tools::getPoint ( std::shared_ptr< ModelAPI_Feature > &  theFeature,
const std::string &  theAttribute 
)
static

Returns point of coincidence feature.

Parameters
theFeaturethe coincidence feature
theAttributethe attribute name

◆ getPnt2d() [1/2]

std::shared_ptr< GeomAPI_Pnt2d > PartSet_Tools::getPnt2d ( QMouseEvent *  theEvent,
ModuleBase_IViewWindow theWindow,
const FeaturePtr &  theSketch 
)
static

Convertes parameters into a geom point.

Parameters
theEventa Qt event to find mouse position
theWindowview window to define eye of view
theSketchto convert 3D point coordinates into coorditates of the sketch plane

◆ getPnt2d() [2/2]

std::shared_ptr< GeomAPI_Pnt2d > PartSet_Tools::getPnt2d ( const Handle &&  theView,
const TopoDS_Shape &  theShape,
const FeaturePtr &  theSketch 
)
static

Returns point 2d from selected shape.

Parameters
theViewa view window
theShapea vertex shape
theXan output value of X coordinate
theYan output value of Y coordinate

◆ findFirstCoincidence()

FeaturePtr PartSet_Tools::findFirstCoincidence ( const FeaturePtr &  theFeature,
std::shared_ptr< GeomAPI_Pnt2d thePoint 
)
static

Gets all references to the feature, take coincidence constraint features, get point 2d attributes and compare the point value to be equal with the given.

Returns the first feature, which has equal points.

Parameters
theFeaturethe coincidence feature
thePointa 2d point
Returns
the coincidence feature or null

Find by result

◆ findCoincidences()

void PartSet_Tools::findCoincidences ( FeaturePtr  theStartCoin,
QList< FeaturePtr > &  theList,
QList< FeaturePtr > &  theCoincidencies,
std::string  theAttr,
QList< bool > &  theIsAttributes 
)
static

Returns list of features connected in a councedence feature point.

Parameters
theStartCointhe coincidence feature
theLista list which collects lines features
theCoincidenciesa list of coincidence features
theAttrthe attribute name

◆ getCoincedencePoint()

std::shared_ptr< GeomAPI_Pnt2d > PartSet_Tools::getCoincedencePoint ( FeaturePtr  theStartCoin)
static

Returns point of a coincedence.

Parameters
theStartCointhe coincedence feature

◆ sendSubFeaturesEvent()

void PartSet_Tools::sendSubFeaturesEvent ( const CompositeFeaturePtr &  theComposite,
const Events_ID  theId 
)
static

Sends redisplay event for all sub-features of the composite. Flush it.

◆ isAuxiliarySketchEntity()

bool PartSet_Tools::isAuxiliarySketchEntity ( const ObjectPtr &  theObject)
static

Returns true if the object is a sketch entity, where auxiliary attribute has true value.

Parameters
theObjecta result or feature
Returns
boolean result

◆ isIncludeIntoSketchResult()

bool PartSet_Tools::isIncludeIntoSketchResult ( const ObjectPtr &  theObject)
static

Returns true if the object is a sketch entity produced by projection or intersection feature and if it should not be included into the sketch result.

◆ getDefaultColor()

void PartSet_Tools::getDefaultColor ( ObjectPtr  theObject,
const bool  isEmptyColorValid,
std::vector< int > &  theColor 
)
static

Returns default color value for the given object.

◆ getDefaultDeflection()

double PartSet_Tools::getDefaultDeflection ( const ObjectPtr &  theObject)
static

Returns default deflection value for the given object.

◆ getDefaultTransparency()

double PartSet_Tools::getDefaultTransparency ( )
static

Returns default transparency value.

◆ getOperationCursor()

QCursor PartSet_Tools::getOperationCursor ( )
static

Returns cursor according to (SKETCH_TAB_NAME, "operation_cursor") property value.