mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6231958ddc | ||
|
359edc7d8a | ||
|
f9998f03ad | ||
|
c479c4f6d8 |
@@ -3228,6 +3228,30 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isDetected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::isDetected (const Handle(AIS_InteractiveObject)& theObject)
|
||||
{
|
||||
for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); aDetIter++)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) aPicked = MainSelector()->Picked(myDetectedSeq(aDetIter));
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aPicked.IsNull())
|
||||
{
|
||||
anObj = Handle(AIS_InteractiveObject)::DownCast(aPicked->Selectable());
|
||||
}
|
||||
|
||||
if (!anObj.IsNull()
|
||||
&& anObj == theObject)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSelected
|
||||
//purpose : Sets the whole object as selected and highlights it with selection color
|
||||
@@ -3288,7 +3312,8 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
|
||||
// added to avoid untimely viewer update...
|
||||
mySelection->ClearAndSelect (anOwner);
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
mySelection->ClearAndSelect (anOwner, myFilters, isDetected (anObj));
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
@@ -3350,7 +3375,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
unhighlightSelected();
|
||||
}
|
||||
|
||||
mySelection->ClearAndSelect (theOwner);
|
||||
mySelection->ClearAndSelect (theOwner, myFilters, isDetected (anObject));
|
||||
if (myAutoHilight)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aCustomStyle;
|
||||
@@ -3401,16 +3426,17 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||
if (!myFilters->IsOk (theOwner) && !theOwner->IsSelected())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mySelection->Select (theOwner);
|
||||
AIS_SelectionScheme aSelScheme = theOwner->IsSelected() ? AIS_SelectionScheme_Remove : AIS_SelectionScheme_Add;
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
mySelection->Select (theOwner, myFilters, aSelScheme, isDetected (anObj));
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
|
||||
if (!aStatusPtr)
|
||||
{
|
||||
@@ -3469,7 +3495,8 @@ Standard_Boolean AIS_InteractiveContext::SetSelectedState (const Handle(SelectMg
|
||||
}
|
||||
else
|
||||
{
|
||||
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity);
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(theEntity->Selectable());
|
||||
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity, myFilters, AIS_SelectionScheme_Remove, isDetected (anObj));
|
||||
theEntity->SetSelected (false);
|
||||
return aSelStatus == AIS_SS_Removed;
|
||||
}
|
||||
|
@@ -1302,6 +1302,9 @@ protected: //! @name internal methods
|
||||
Standard_EXPORT AIS_StatusOfDetection moveTo (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawOnUpdate);
|
||||
|
||||
//! Returns True if the object is detected.
|
||||
Standard_EXPORT Standard_Boolean isDetected (const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
||||
Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
|
@@ -55,24 +55,38 @@ void AIS_Selection::Clear()
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Filter)& theFilter,
|
||||
const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theIsDetected)
|
||||
{
|
||||
if (theObject.IsNull()
|
||||
|| !theObject->HasSelectable())
|
||||
if (theOwner.IsNull()
|
||||
|| !theOwner->HasSelectable())
|
||||
{
|
||||
return AIS_SS_NotDone;
|
||||
}
|
||||
|
||||
if (!myResultMap.IsBound (theObject))
|
||||
const Standard_Boolean isDetected = theIsDetected
|
||||
&& (theFilter.IsNull() || theFilter->IsOk (theOwner));
|
||||
|
||||
const Standard_Boolean wasSelected = theOwner->IsSelected();
|
||||
const Standard_Boolean toSelect = theOwner->Select (theSelScheme, isDetected);
|
||||
|
||||
if (toSelect && !wasSelected)
|
||||
{
|
||||
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||
myresult.Append (theObject, aListIter);
|
||||
myResultMap.Bind (theObject, aListIter);
|
||||
theObject->SetSelected (Standard_True);
|
||||
myresult.Append (theOwner, aListIter);
|
||||
myResultMap.Bind (theOwner, aListIter);
|
||||
theOwner->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theObject);
|
||||
if (!toSelect && !wasSelected)
|
||||
{
|
||||
return AIS_SS_NotDone;
|
||||
}
|
||||
|
||||
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theOwner);
|
||||
if (myIterator == aListIter)
|
||||
{
|
||||
if (myIterator.More())
|
||||
@@ -88,14 +102,14 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
|
||||
// In the mode of advanced mesh selection only one owner is created for all selection modes.
|
||||
// It is necessary to check the current detected entity
|
||||
// and remove the owner from map only if the detected entity is the same as previous selected (IsForcedHilight call)
|
||||
if (theObject->IsForcedHilight())
|
||||
if (theOwner->IsForcedHilight())
|
||||
{
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
myresult.Remove (aListIter);
|
||||
myResultMap.UnBind (theObject);
|
||||
theObject->SetSelected (Standard_False);
|
||||
myResultMap.UnBind (theOwner);
|
||||
theOwner->SetSelected (Standard_False);
|
||||
|
||||
// update list iterator for next object in <myresult> list if any
|
||||
if (aListIter.More())
|
||||
@@ -142,86 +156,39 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
|
||||
const Standard_Boolean theToAllowSelOverlap,
|
||||
const Handle(SelectMgr_Filter)& theFilter)
|
||||
{
|
||||
(void )theToAllowSelOverlap;
|
||||
switch (theSelScheme)
|
||||
(void)theToAllowSelOverlap;
|
||||
|
||||
if (theSelScheme == AIS_SelectionScheme_ReplaceExtra
|
||||
&& thePickedOwners.Size() == myresult.Size())
|
||||
{
|
||||
case AIS_SelectionScheme_UNKNOWN:
|
||||
// If picked owners is equivalent to the selected then just clear selected.
|
||||
Standard_Boolean isTheSame = Standard_True;
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
|
||||
{
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_ReplaceExtra:
|
||||
{
|
||||
// If picked owners is equivalent to the selected then just clear selected
|
||||
// Else go to AIS_SelectionScheme_Replace
|
||||
if (thePickedOwners.Size() == myresult.Size())
|
||||
if (!myResultMap.IsBound (aPickedIter.Value()))
|
||||
{
|
||||
Standard_Boolean isTheSame = Standard_True;
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
if (!myResultMap.IsBound (aSelIter.Value()))
|
||||
{
|
||||
isTheSame = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isTheSame)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
isTheSame = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Standard_FALLTHROUGH
|
||||
case AIS_SelectionScheme_Replace:
|
||||
if (isTheSame)
|
||||
{
|
||||
Clear();
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
appendOwner (aSelIter.Value(), theFilter);
|
||||
}
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_Add:
|
||||
{
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
appendOwner (aSelIter.Value(), theFilter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_Remove:
|
||||
{
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
if (myResultMap.IsBound (aSelIter.Value()))
|
||||
{
|
||||
Select (aSelIter.Value());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_XOR:
|
||||
{
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||
if (anOwner.IsNull()
|
||||
|| !anOwner->HasSelectable()
|
||||
|| !theFilter->IsOk (anOwner))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (theSelScheme == AIS_SelectionScheme_Replace
|
||||
|| theSelScheme == AIS_SelectionScheme_ReplaceExtra
|
||||
|| theSelScheme == AIS_SelectionScheme_Clear)
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
Select (anOwner);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_Clear:
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aPickedIter.Value();
|
||||
Select (anOwner, theFilter, theSelScheme, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,23 +34,36 @@ public:
|
||||
|
||||
//! creates a new selection.
|
||||
Standard_EXPORT AIS_Selection();
|
||||
|
||||
|
||||
//! removes all the object of the selection.
|
||||
Standard_EXPORT virtual void Clear();
|
||||
|
||||
|
||||
//! if the object is not yet in the selection, it will be added.
|
||||
//! if the object is already in the selection, it will be removed.
|
||||
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject);
|
||||
|
||||
//! @param[in] theOwner element to change selection state
|
||||
//! @param[in] theFilter context filter
|
||||
//! @param[in] theSelScheme selection scheme
|
||||
//! @param[in] theIsDetected flag of object detection
|
||||
//! @return result of selection
|
||||
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Filter)& theFilter,
|
||||
const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theIsDetected);
|
||||
|
||||
//! the object is always add int the selection.
|
||||
//! faster when the number of objects selected is great.
|
||||
Standard_EXPORT virtual AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
|
||||
|
||||
//! clears the selection and adds the object in the selection.
|
||||
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||
//! @param[in] theObject element to change selection state
|
||||
//! @param[in] theFilter context filter
|
||||
//! @param[in] theIsDetected flag of object detection
|
||||
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject,
|
||||
const Handle(SelectMgr_Filter)& theFilter,
|
||||
const Standard_Boolean theIsDetected)
|
||||
{
|
||||
Clear();
|
||||
Select (theObject);
|
||||
Select (theObject, theFilter, AIS_SelectionScheme_Add, theIsDetected);
|
||||
}
|
||||
|
||||
//! checks if the object is in the selection.
|
||||
|
@@ -34,6 +34,8 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Returns a shape built by the shape construction algorithm.
|
||||
//! Does not check if the shape is built.
|
||||
Standard_EXPORT virtual const TopoDS_Shape& Shape() Standard_OVERRIDE;
|
||||
|
||||
// Provide access to methods of protected base class BOPAlgo_Options
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <ShapeBuild_ReShape.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
@@ -47,6 +48,7 @@ void IGESData_VerifyDate
|
||||
IGESData_IGESModel::IGESData_IGESModel ()
|
||||
{
|
||||
thestart = new TColStd_HSequenceOfHAsciiString();
|
||||
myReShape = new ShapeBuild_ReShape();
|
||||
// thecheckstx = new Interface_Check;
|
||||
// thechecksem = new Interface_Check;
|
||||
}
|
||||
@@ -62,6 +64,7 @@ void IGESData_IGESModel::ClearHeader ()
|
||||
IGESData_GlobalSection newheader; // Un peu brutal, certes
|
||||
theheader = newheader;
|
||||
thestart = new TColStd_HSequenceOfHAsciiString();
|
||||
myReShape = new ShapeBuild_ReShape();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -22,10 +22,10 @@
|
||||
|
||||
class IGESData_IGESEntity;
|
||||
class Interface_Check;
|
||||
class ShapeBuild_ReShape;
|
||||
class Standard_Transient;
|
||||
class TCollection_HAsciiString;
|
||||
|
||||
|
||||
class IGESData_IGESModel;
|
||||
DEFINE_STANDARD_HANDLE(IGESData_IGESModel, Interface_InterfaceModel)
|
||||
|
||||
@@ -151,8 +151,11 @@ public:
|
||||
//! i.e. a string "Dnn" with nn = directory entry number (2*N-1)
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
|
||||
|
||||
//! Gets ReShape used to store a model's shapes changes
|
||||
const Handle(ShapeBuild_ReShape)& ReShape() const { return myReShape; }
|
||||
|
||||
|
||||
//! Sets ReShape used to store a history of changes of the model's shapes
|
||||
void SetReShape(const Handle(ShapeBuild_ReShape)& theReShape) { myReShape = theReShape; }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IGESData_IGESModel,Interface_InterfaceModel)
|
||||
|
||||
@@ -166,7 +169,7 @@ private:
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) thestart;
|
||||
IGESData_GlobalSection theheader;
|
||||
|
||||
Handle(ShapeBuild_ReShape) myReShape;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -131,8 +131,6 @@ static void TrimTolerances (const TopoDS_Shape& shape,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer
|
||||
//purpose :
|
||||
@@ -196,10 +194,11 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
|
||||
// fixing shape
|
||||
Handle(Standard_Transient) info;
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, theeps, CAS.GetMaxTol(),
|
||||
"read.iges.resource.name",
|
||||
"read.iges.sequence", info,
|
||||
aPS.Next());
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape(shape, theeps, CAS.GetMaxTol(),
|
||||
"read.iges.resource.name",
|
||||
"read.iges.sequence",
|
||||
info, mymodel->ReShape(),
|
||||
aPS.Next());
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
}
|
||||
|
||||
|
@@ -83,6 +83,51 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Select
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean SelectMgr_EntityOwner::Select (const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theIsDetected) const
|
||||
{
|
||||
switch (theSelScheme)
|
||||
{
|
||||
case AIS_SelectionScheme_UNKNOWN:
|
||||
{
|
||||
return myIsSelected;
|
||||
}
|
||||
case AIS_SelectionScheme_Replace:
|
||||
{
|
||||
return theIsDetected;
|
||||
}
|
||||
case AIS_SelectionScheme_Add:
|
||||
{
|
||||
return !myIsSelected || theIsDetected || IsForcedHilight();
|
||||
}
|
||||
case AIS_SelectionScheme_Remove:
|
||||
{
|
||||
return myIsSelected && !theIsDetected;
|
||||
}
|
||||
case AIS_SelectionScheme_XOR:
|
||||
{
|
||||
if (theIsDetected)
|
||||
{
|
||||
return !myIsSelected && !IsForcedHilight();
|
||||
}
|
||||
return myIsSelected;
|
||||
}
|
||||
case AIS_SelectionScheme_Clear:
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
case AIS_SelectionScheme_ReplaceExtra:
|
||||
{
|
||||
return theIsDetected;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#ifndef _SelectMgr_EntityOwner_HeaderFile
|
||||
#define _SelectMgr_EntityOwner_HeaderFile
|
||||
|
||||
#include <AIS_SelectionScheme.hxx>
|
||||
#include <Aspect_VKey.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
@@ -139,6 +140,12 @@ public:
|
||||
//! @param theIsSelected [in] shows if owner is selected.
|
||||
void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
|
||||
|
||||
//! If the object needs to be selected, it returns true.
|
||||
//! @param[in] theSelScheme selection scheme
|
||||
//! @param[in] theIsDetected flag of object detection
|
||||
Standard_EXPORT Standard_Boolean Select (const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theIsDetected) const;
|
||||
|
||||
//! Returns selection state.
|
||||
Standard_DEPRECATED ("Deprecated method - IsSelected() should be used instead")
|
||||
Standard_Integer State() const { return myIsSelected ? 1 : 0; }
|
||||
|
@@ -112,18 +112,20 @@ Standard_Boolean ShapeFix_Shape::Perform(const Message_ProgressRange& theProgres
|
||||
TopLoc_Location nullLoc,L;
|
||||
L = myShape.Location();
|
||||
TopoDS_Shape aShapeNullLoc = myShape;
|
||||
const Standard_Boolean aIsRecorded = Context()->IsNewShape(myShape);
|
||||
aShapeNullLoc.Location(nullLoc);
|
||||
if(myMapFixingShape.Contains(aShapeNullLoc)) {
|
||||
if(aIsRecorded || myMapFixingShape.Contains(aShapeNullLoc))
|
||||
{
|
||||
myShape.Location(L, Standard_False);
|
||||
myResult = Context()->Apply(myShape);
|
||||
status = Standard_True;
|
||||
return status;
|
||||
}
|
||||
else myMapFixingShape.Add(aShapeNullLoc);
|
||||
myMapFixingShape.Add(aShapeNullLoc);
|
||||
//---------------------------------------
|
||||
myShape.Location(L, Standard_False);
|
||||
TopoDS_Shape S = Context()->Apply(myShape);
|
||||
if ( NeedFix ( myFixVertexPositionMode ) )
|
||||
if (NeedFix(myFixVertexPositionMode))
|
||||
ShapeFix::FixVertexPosition(S,Precision(),Context());
|
||||
|
||||
st = S.ShapeType();
|
||||
|
@@ -267,7 +267,7 @@ public:
|
||||
|
||||
//! Performs an analysis and reorders edges in the wire using class WireOrder.
|
||||
//! Flag <theModeBoth> determines the use of miscible mode if necessary.
|
||||
Standard_EXPORT Standard_Boolean FixReorder(Standard_Boolean theModeBoth = Standard_False);
|
||||
Standard_EXPORT Standard_Boolean FixReorder(Standard_Boolean theModeBoth = Standard_True);
|
||||
|
||||
//! Applies FixSmall(num) to all edges in the wire
|
||||
Standard_EXPORT Standard_Integer FixSmall (const Standard_Boolean lockvtx, const Standard_Real precsmall = 0.0);
|
||||
|
@@ -155,16 +155,8 @@ static TopoDS_Edge MakeEdge
|
||||
TopoDS_Edge E;
|
||||
B.MakeEdge (E,C3D,Precision::Confusion());
|
||||
B.Add (E,V1); B.Add (E,V2);
|
||||
if (!Precision::IsPositiveInfinite(U1) &&
|
||||
!Precision::IsNegativeInfinite(U1))
|
||||
{
|
||||
B.UpdateVertex(V1, U1, E, 0.);
|
||||
}
|
||||
if (!Precision::IsPositiveInfinite(U2) &&
|
||||
!Precision::IsNegativeInfinite(U2))
|
||||
{
|
||||
B.UpdateVertex(V2, U2, E, 0.);
|
||||
}
|
||||
B.UpdateVertex(V1, U1, E, 0.);
|
||||
B.UpdateVertex(V2, U2, E, 0.);
|
||||
return E;
|
||||
}
|
||||
|
||||
@@ -310,17 +302,11 @@ void StepToTopoDS_TranslateEdge::Init(const Handle(StepShape_Edge)& aEdge,
|
||||
// --- * a 3D Curve
|
||||
// ----------------------------------------------------------
|
||||
|
||||
if (C->IsKind(STANDARD_TYPE(StepGeom_Pcurve)))
|
||||
{
|
||||
if ( C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) {
|
||||
B.MakeEdge(E);
|
||||
if (!V1.IsNull())
|
||||
{
|
||||
B.Add(E, V1);
|
||||
}
|
||||
if (!V2.IsNull())
|
||||
{
|
||||
B.Add(E, V2);
|
||||
}
|
||||
//:S4136 B.UpdateEdge (E,preci);
|
||||
B.Add(E, V1);
|
||||
B.Add(E, V2);
|
||||
}
|
||||
else if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve)) ) {
|
||||
// For SeamCurve and IntersectionCurve types
|
||||
@@ -394,21 +380,6 @@ void StepToTopoDS_TranslateEdge::MakeFromCurve3D
|
||||
done = Standard_False;
|
||||
return;
|
||||
}
|
||||
//BRep_Builder aBuilder;
|
||||
//if (V1.IsNull())
|
||||
//{
|
||||
// TopoDS_Vertex aTmpVert;
|
||||
// const Standard_Real aFirst = C1->FirstParameter();
|
||||
// aBuilder.MakeVertex(aTmpVert, C1->Value(aFirst), preci);
|
||||
// V1 = aTmpVert;
|
||||
//}
|
||||
//if (V2.IsNull())
|
||||
//{
|
||||
// TopoDS_Vertex aTmpVert;
|
||||
// const Standard_Real aFirst = C1->LastParameter();
|
||||
// aBuilder.MakeVertex(aTmpVert, C1->Value(aFirst), preci);
|
||||
// V2 = aTmpVert;
|
||||
//}
|
||||
// -- Statistics -- -> No Warning message
|
||||
aTool.AddContinuity (C1);
|
||||
BRep_Builder B;
|
||||
|
@@ -22,27 +22,21 @@
|
||||
// rln 02.06.99 removing #include <StepToTopoDS_DegeneratedTool.hxx>
|
||||
// smh 31.01.01 BUC60810 : IsNull protection
|
||||
|
||||
#include <StepToTopoDS_TranslateEdgeLoop.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_TEdge.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <GeomToStep_MakeCartesianPoint.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeAlgo.hxx>
|
||||
#include <ShapeAlgo_AlgoContainer.hxx>
|
||||
#include <ShapeAlgo_ToolContainer.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <ShapeBuild_Edge.hxx>
|
||||
@@ -58,13 +52,13 @@
|
||||
#include <StepShape_FaceBound.hxx>
|
||||
#include <StepShape_OrientedEdge.hxx>
|
||||
#include <StepShape_Vertex.hxx>
|
||||
#include <StepShape_VertexPoint.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS.hxx>
|
||||
#include <StepToTopoDS_GeometricTool.hxx>
|
||||
#include <StepToTopoDS_NMTool.hxx>
|
||||
#include <StepToTopoDS_Tool.hxx>
|
||||
#include <StepToTopoDS_TranslateEdge.hxx>
|
||||
#include <StepToTopoDS_TranslateEdgeLoop.hxx>
|
||||
#include <StepToTopoDS_TranslateVertex.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopExp.hxx>
|
||||
@@ -80,26 +74,6 @@
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
|
||||
// ============================================================================
|
||||
// Method : MakeCurveFromStep
|
||||
// Purpose :
|
||||
// ============================================================================
|
||||
static Handle(Geom_Curve) MakeCurveFromStep (const Handle(StepGeom_Curve)& theStepCurve,
|
||||
const Handle(Transfer_TransientProcess) theTP)
|
||||
{
|
||||
Handle(Geom_Curve) aResCurve = Handle(Geom_Curve)::DownCast(theTP->FindTransient(theStepCurve));
|
||||
if (!aResCurve.IsNull())
|
||||
{
|
||||
return aResCurve;
|
||||
}
|
||||
aResCurve = StepToGeom::MakeCurve(theStepCurve);
|
||||
if (!aResCurve.IsNull())
|
||||
{
|
||||
theTP->BindTransient(theStepCurve, aResCurve);
|
||||
}
|
||||
return aResCurve;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Method : RemoveSinglePCurve
|
||||
// Purpose :
|
||||
@@ -246,13 +220,21 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
BRep_Builder B;
|
||||
Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
|
||||
|
||||
const Standard_Real preci = Precision();
|
||||
Standard_Real preci = Precision();
|
||||
TopoDS_Wire W;
|
||||
TopoDS_Edge E;
|
||||
TopoDS_Vertex V;
|
||||
|
||||
Handle(Geom2d_Curve) C2d, C2d1, C2d2;
|
||||
Standard_Boolean isSeam, isLikeSeam;
|
||||
|
||||
const Standard_Integer NbEdge = EL->NbEdgeList();
|
||||
Handle(StepShape_OrientedEdge) OrEdge1, OrEdge2;
|
||||
Handle(StepGeom_Curve) StepCurve, StepCurve1, StepCurve2;
|
||||
Handle(StepRepr_DefinitionalRepresentation) DRI, Dri1, Dri2;
|
||||
|
||||
Handle(Geom2d_Curve) C2d, C2d1, C2d2, WhichC2d1, WhichC2d2;
|
||||
TopoDS_Edge suspectE; //:f1, degEdge;
|
||||
|
||||
Standard_Integer j, NbEdge = EL->NbEdgeList();
|
||||
if (NbEdge == 0) {
|
||||
TP->AddWarning(EL, "Wire not done. EdgeLoop does not contain edges.");
|
||||
done = Standard_False;
|
||||
@@ -287,9 +269,9 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
// This case may not be processed, PCurves has to be recomputed from scratch
|
||||
// -----------------------------------------------
|
||||
// Standard_Integer theSame = 1; //gka 15.12.98
|
||||
NCollection_Map<Handle(StepShape_OrientedEdge)> aIncorrectEdges;
|
||||
for (Standard_Integer j=1; j<=NbEdge; j++) {
|
||||
Handle(StepShape_OrientedEdge) OrEdge1 = EL->EdgeListValue(j);
|
||||
|
||||
for (j=1; j<=NbEdge; j++) {
|
||||
OrEdge1 = EL->EdgeListValue(j);
|
||||
|
||||
if (OrEdge1.IsNull() || OrEdge1->EdgeElement().IsNull())
|
||||
{
|
||||
@@ -355,38 +337,21 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
StepToTopoDS_TranslateVertex myTranVertex1(Vstart, aTool, NMTool);
|
||||
StepToTopoDS_TranslateVertex myTranVertex2(Vend, aTool, NMTool);
|
||||
|
||||
if (myTranVertex1.IsDone())
|
||||
{
|
||||
if (myTranVertex1.IsDone()) {
|
||||
V1 = TopoDS::Vertex(myTranVertex1.Value());
|
||||
}
|
||||
if (myTranVertex2.IsDone())
|
||||
{
|
||||
if (myTranVertex2.IsDone()) {
|
||||
V2 = TopoDS::Vertex(myTranVertex2.Value());
|
||||
}
|
||||
if (!V1.IsNull() && !V2.IsNull())
|
||||
{
|
||||
gp_Pnt aPnt1 = BRep_Tool::Pnt(V1);
|
||||
gp_Pnt aPnt2 = BRep_Tool::Pnt(V2);
|
||||
if (aPnt1.Distance(aPnt2) <= Precision::Confusion())
|
||||
{
|
||||
Standard_Boolean aIsFixed = Standard_True;
|
||||
if (!iseV)
|
||||
{
|
||||
aTool.Bind(Vend, V1);
|
||||
}
|
||||
else if (!istV)
|
||||
{
|
||||
aTool.Bind(Vstart, V2);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTool.Bind(Vend, V1);
|
||||
}
|
||||
if (!C1.IsNull() && !C1->IsClosed() && aIsFixed)
|
||||
{
|
||||
gp_Pnt p1 = BRep_Tool::Pnt(V1);
|
||||
gp_Pnt p2 = BRep_Tool::Pnt(V2);
|
||||
if (p1.Distance(p2) <= Precision::Confusion()) { //:S4136: preci) {
|
||||
Standard_Boolean Fixed = Standard_True;
|
||||
if (!iseV) aTool.Bind(Vend, V1); //gka 21.08.1998 bug PRO7656
|
||||
else if (!istV) aTool.Bind (Vstart, V2);
|
||||
else aTool.Bind (Vend, V1);
|
||||
if (!C1.IsNull() && !C1->IsClosed() && Fixed)
|
||||
TP->AddWarning(EL->EdgeListValue(j),
|
||||
"Vertex of same coordinates, set confused");
|
||||
}
|
||||
"Vertex of same coordinates, set confused");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -396,141 +361,32 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
// and make it be one vertex
|
||||
// NOTE: this is done only for the case if at least one of edges
|
||||
// was not yet translated; else nothing will help
|
||||
for (Standard_Integer anEdgeInd = 1; anEdgeInd <= NbEdge; anEdgeInd++)
|
||||
{
|
||||
Handle(StepShape_OrientedEdge) anOrEdge1 =
|
||||
EL->EdgeListValue(anEdgeInd);
|
||||
Handle(StepShape_OrientedEdge) anOrEdge2 =
|
||||
EL->EdgeListValue(anEdgeInd < NbEdge ? anEdgeInd + 1 : 1);
|
||||
if (anOrEdge1.IsNull() || anOrEdge2.IsNull())
|
||||
for (j=1; j<=NbEdge; j++) {
|
||||
OrEdge1 = EL->EdgeListValue (j);
|
||||
OrEdge2 = EL->EdgeListValue (j < NbEdge ? j + 1 : 1);
|
||||
if (OrEdge1.IsNull() || OrEdge2.IsNull())
|
||||
continue;
|
||||
|
||||
if (!anOrEdge1->EdgeElement().IsNull() &&
|
||||
anOrEdge1->EdgeElement()->IsKind(STANDARD_TYPE(StepShape_OrientedEdge)))
|
||||
{
|
||||
anOrEdge1 = Handle(StepShape_OrientedEdge)::DownCast(anOrEdge1->EdgeElement());
|
||||
}
|
||||
if (!anOrEdge2->EdgeElement().IsNull() &&
|
||||
anOrEdge2->EdgeElement()->IsKind(STANDARD_TYPE(StepShape_OrientedEdge)))
|
||||
{
|
||||
anOrEdge2 = Handle(StepShape_OrientedEdge)::DownCast(anOrEdge2->EdgeElement());
|
||||
}
|
||||
Handle(StepShape_EdgeCurve) aEC1 =
|
||||
Handle(StepShape_EdgeCurve)::DownCast(anOrEdge1->EdgeElement());
|
||||
const Handle(StepShape_EdgeCurve) aEC2 =
|
||||
Handle(StepShape_EdgeCurve)::DownCast(anOrEdge2->EdgeElement());
|
||||
if (aEC1.IsNull() || aEC2.IsNull()) // see #29979
|
||||
Handle(StepShape_EdgeCurve) EC1 =
|
||||
Handle(StepShape_EdgeCurve)::DownCast (OrEdge1->EdgeElement());
|
||||
Handle(StepShape_EdgeCurve) EC2 =
|
||||
Handle(StepShape_EdgeCurve)::DownCast (OrEdge2->EdgeElement());
|
||||
if (EC1.IsNull() || EC2.IsNull()) // see #29979
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepShape_Vertex) aVs1 = anOrEdge1->Orientation() ? aEC1->EdgeEnd() : aEC1->EdgeStart();
|
||||
Handle(StepShape_Vertex) aVs2 = anOrEdge2->Orientation() ? aEC2->EdgeStart() : aEC2->EdgeEnd();
|
||||
Handle(StepShape_Vertex) Vs1, Vs2, Vs11, Vs22;
|
||||
Vs1 = (OrEdge1->Orientation() ? EC1->EdgeEnd() : EC1->EdgeStart());
|
||||
Vs2 = (OrEdge2->Orientation() ? EC2->EdgeStart() : EC2->EdgeEnd());
|
||||
|
||||
Handle(StepShape_Vertex) aVs11 = anOrEdge1->Orientation() ? aEC1->EdgeStart() : aEC1->EdgeEnd();
|
||||
const Handle(StepShape_Vertex) aVs22 = anOrEdge2->Orientation() ? aEC2->EdgeEnd() : aEC2->EdgeStart();
|
||||
Vs11 = (OrEdge1->Orientation() ? EC1->EdgeStart() : EC1->EdgeEnd());
|
||||
Vs22 = (OrEdge2->Orientation() ? EC2->EdgeEnd() : EC2->EdgeStart());
|
||||
|
||||
if (!aVs1.IsNull() && !aVs11.IsNull() &&
|
||||
((aVs1 == aVs2) || (aVs1 == aVs22) || (aVs2 == aVs11) || (aVs22 == aVs11)))
|
||||
{
|
||||
//continue;
|
||||
}
|
||||
if (aVs1.IsNull())
|
||||
{
|
||||
aIncorrectEdges.Add(anOrEdge1);
|
||||
if (aVs2.IsNull())
|
||||
{
|
||||
Handle(Geom_Curve) aCurve;
|
||||
const Handle(Geom_Curve) aCurveFirst = MakeCurveFromStep(aEC1->EdgeGeometry(), TP);
|
||||
const Handle(Geom_Curve) aCurveSecond = MakeCurveFromStep(aEC2->EdgeGeometry(), TP);
|
||||
Standard_Real aLast = Precision::Infinite();
|
||||
aCurve = aCurveFirst;
|
||||
aLast = anOrEdge1->Orientation() ? aCurve->LastParameter() : aCurve->FirstParameter();
|
||||
if (Precision::IsPositiveInfinite(aLast) ||
|
||||
Precision::IsNegativeInfinite(aLast))
|
||||
{
|
||||
aCurve = aCurveSecond;
|
||||
aLast = anOrEdge2->Orientation() ? aCurve->FirstParameter() : aCurve->LastParameter();
|
||||
}
|
||||
gp_Pnt aStartP;
|
||||
Standard_Boolean aIsFinded = Standard_False;
|
||||
if (Precision::IsPositiveInfinite(aLast) ||
|
||||
Precision::IsNegativeInfinite(aLast))
|
||||
{
|
||||
//if (anOrEdge2->Orientation())
|
||||
//{
|
||||
// aLast = 0.0;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
aCurve = aCurveFirst;
|
||||
Handle(StepShape_VertexPoint) VP = Handle(StepShape_VertexPoint)::DownCast(aVs22);
|
||||
Handle(StepGeom_Point) P = VP->VertexGeometry();
|
||||
Handle(StepGeom_CartesianPoint) P1 = Handle(StepGeom_CartesianPoint)::DownCast(P);
|
||||
Handle(Geom_CartesianPoint) P2 = StepToGeom::MakeCartesianPoint(P1);
|
||||
gp_Pnt aLastPnt = P2->Pnt();
|
||||
VP = Handle(StepShape_VertexPoint)::DownCast(aVs11);
|
||||
P = VP->VertexGeometry();
|
||||
P1 = Handle(StepGeom_CartesianPoint)::DownCast(P);
|
||||
P2 = StepToGeom::MakeCartesianPoint(P1);
|
||||
gp_Pnt aFirstPnt = P2->Pnt();
|
||||
aLast = anOrEdge1->Orientation() ? aLastPnt.Distance(aFirstPnt) : 0.0;
|
||||
if (aCurveFirst->IsKind(STANDARD_TYPE(Geom_Line)))
|
||||
{
|
||||
Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(aCurveFirst);
|
||||
aStartP = aFirstPnt.XYZ() + ((aLine->Position().Direction().XYZ() * aLastPnt.Distance(aFirstPnt)) * (anOrEdge1->Orientation() ? 1 : -1));
|
||||
aIsFinded = Standard_True;
|
||||
}
|
||||
//}
|
||||
}
|
||||
if (!aIsFinded)
|
||||
{
|
||||
aStartP = aCurve->Value(aLast);
|
||||
}
|
||||
GeomToStep_MakeCartesianPoint aMkPoint(aStartP);
|
||||
const Handle(StepGeom_CartesianPoint) aGpms = aMkPoint.Value();
|
||||
const Handle(StepShape_VertexPoint) aVSP0 =
|
||||
new StepShape_VertexPoint();
|
||||
const Handle(TCollection_HAsciiString) aName =
|
||||
new TCollection_HAsciiString("");
|
||||
aVSP0->Init(aName, aGpms);
|
||||
aVs2 = aVSP0;
|
||||
}
|
||||
if (!aVs2.IsNull())
|
||||
{
|
||||
aVs1 = aVs2;
|
||||
if (anOrEdge1->Orientation())
|
||||
{
|
||||
aEC1->SetEdgeEnd(aVs1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aEC1->SetEdgeStart(aVs1);
|
||||
}
|
||||
if (anOrEdge2->Orientation())
|
||||
{
|
||||
aEC2->SetEdgeStart(aVs1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aEC2->SetEdgeEnd(aVs1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aVs2.IsNull())
|
||||
{
|
||||
aVs2 = aVs1;
|
||||
if (anOrEdge2->Orientation())
|
||||
{
|
||||
aEC2->SetEdgeStart(aVs1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aEC2->SetEdgeEnd(aVs1);
|
||||
}
|
||||
}
|
||||
StepToTopoDS_TranslateVertex myTranVertex1 (aVs1, aTool, NMTool);
|
||||
StepToTopoDS_TranslateVertex myTranVertex2 (aVs2, aTool, NMTool);
|
||||
if ((Vs1 == Vs2) || (Vs1 == Vs22) || (Vs2 == Vs11) || (Vs22 == Vs11)) continue;
|
||||
|
||||
StepToTopoDS_TranslateVertex myTranVertex1 (Vs1, aTool, NMTool);
|
||||
StepToTopoDS_TranslateVertex myTranVertex2 (Vs2, aTool, NMTool);
|
||||
|
||||
TopoDS_Vertex V1, V2;
|
||||
if (myTranVertex1.IsDone())
|
||||
@@ -544,8 +400,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
gp_Pnt p2 = BRep_Tool::Pnt(V2);
|
||||
Standard_Boolean locFixed = Standard_True;
|
||||
if (p1.Distance(p2) <= preci) {
|
||||
if (! aTool.IsBound (aEC1)) aTool.Bind (aVs1, V2);
|
||||
else if (! aTool.IsBound (aEC2)) aTool.Bind (aVs2, V1);
|
||||
if (! aTool.IsBound (EC1)) aTool.Bind (Vs1, V2);
|
||||
else if (! aTool.IsBound (EC2)) aTool.Bind (Vs2, V1);
|
||||
else locFixed = Standard_False;
|
||||
}
|
||||
else locFixed = Standard_False;
|
||||
@@ -557,7 +413,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
// Iteration on each Oriented Edge of the EdgeLoop
|
||||
// -----------------------------------------------
|
||||
|
||||
for (Standard_Integer j=1; j<=NbEdge; j++) {
|
||||
for (j=1; j<=NbEdge; j++) {
|
||||
|
||||
Standard_Boolean ThereIsLikeSeam = Standard_False;
|
||||
|
||||
@@ -565,7 +421,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
std::cout << " Processing Edge :" << j << std::endl;
|
||||
#endif
|
||||
|
||||
Handle(StepShape_OrientedEdge) OrEdge1 = EL->EdgeListValue(j);
|
||||
OrEdge1 = EL->EdgeListValue(j);
|
||||
if (OrEdge1.IsNull() || OrEdge1->EdgeElement().IsNull())
|
||||
continue;
|
||||
|
||||
@@ -574,7 +430,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
OrEdge1 = Handle(StepShape_OrientedEdge)::DownCast (OrEdge1->EdgeElement());
|
||||
|
||||
Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(OrEdge1->EdgeElement());
|
||||
if (EC.IsNull()/* || aIncorrectEdges.Contains(OrEdge1)*/)
|
||||
if (EC.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -602,8 +458,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
E.Orientation(TopAbs_FORWARD);
|
||||
else E.Orientation(TopAbs_REVERSED);
|
||||
|
||||
Standard_Boolean isSeam = Standard_False;
|
||||
Standard_Boolean isLikeSeam = Standard_False;
|
||||
isSeam = isLikeSeam = Standard_False;
|
||||
|
||||
// ------------------------------------------
|
||||
// Map the StepEdge parametric representation
|
||||
@@ -671,6 +526,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
}
|
||||
|
||||
if (isLikeSeam) {
|
||||
suspectE = E;
|
||||
ThereIsLikeSeam = Standard_True;
|
||||
hasPcurve = Standard_True;
|
||||
}
|
||||
|
@@ -174,7 +174,7 @@ void TopoDSToStep_MakeStepWire::Init (const TopoDS_Wire& aWire,
|
||||
const TopoDS_Wire ForwardWire = TopoDS::Wire (aWire.Oriented (TopAbs_FORWARD));
|
||||
Handle(ShapeFix_Wire) STW = new ShapeFix_Wire (ForwardWire, aTool.CurrentFace(), Precision::Confusion());
|
||||
// for toroidal like surfaces we need to use both (3d and 2d) mode to correctly reorder the edges
|
||||
STW->FixReorder (Standard_True);
|
||||
STW->FixReorder ();
|
||||
Handle(ShapeExtend_WireData) anExtWire = STW->WireData();
|
||||
|
||||
//:abv 04.05.00: CAX-IF TRJ4: writing complete sphere with single vertex_loop
|
||||
|
@@ -82,103 +82,131 @@ void XSAlgo_AlgoContainer::PrepareForTransfer() const
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessShape
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
|
||||
const Standard_Real Prec,
|
||||
const Standard_Real maxTol,
|
||||
const Standard_CString prscfile,
|
||||
const Standard_CString pseq,
|
||||
Handle(Standard_Transient)& info,
|
||||
const Message_ProgressRange& theProgress,
|
||||
const Standard_Boolean NonManifold) const
|
||||
TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
|
||||
const Standard_Real thePrec,
|
||||
const Standard_Real theMaxTol,
|
||||
const Standard_CString thePrscfile,
|
||||
const Standard_CString thePseq,
|
||||
Handle(Standard_Transient)& theInfo,
|
||||
const Handle(ShapeBuild_ReShape)& theReShape,
|
||||
const Message_ProgressRange& theProgress,
|
||||
const Standard_Boolean theNonManifold) const
|
||||
{
|
||||
if ( shape.IsNull() ) return shape;
|
||||
|
||||
Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast(info);
|
||||
if ( context.IsNull() )
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
Standard_CString rscfile = Interface_Static::CVal(prscfile);
|
||||
if (rscfile != nullptr && strlen (rscfile) == 0)
|
||||
return theShape;
|
||||
}
|
||||
|
||||
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast(theInfo);
|
||||
if (aContext.IsNull())
|
||||
{
|
||||
Standard_CString aRscfile = Interface_Static::CVal(thePrscfile);
|
||||
if (aRscfile != nullptr && strlen(aRscfile) == 0)
|
||||
{
|
||||
context = new ShapeProcess_ShapeContext(shape, nullptr);
|
||||
Interface_Static::FillMap(context->ResourceManager()->GetMap());
|
||||
aContext = new ShapeProcess_ShapeContext(theShape, nullptr);
|
||||
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!rscfile)
|
||||
rscfile = prscfile;
|
||||
context = new ShapeProcess_ShapeContext(shape, rscfile);
|
||||
if (!aRscfile)
|
||||
aRscfile = thePrscfile;
|
||||
aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
|
||||
}
|
||||
context->SetDetalisation(TopAbs_EDGE);
|
||||
aContext->SetDetalisation(TopAbs_EDGE);
|
||||
}
|
||||
context->SetNonManifold(NonManifold);
|
||||
info = context;
|
||||
|
||||
Standard_CString seq = Interface_Static::CVal ( pseq );
|
||||
if ( ! seq ) seq = pseq;
|
||||
|
||||
aContext->SetNonManifold(theNonManifold);
|
||||
theInfo = aContext;
|
||||
|
||||
Standard_CString aSeq = Interface_Static::CVal(thePseq);
|
||||
if (!aSeq) aSeq = thePseq;
|
||||
|
||||
// if resource file is not loaded or does not define <seq>.exec.op,
|
||||
// do default fixes
|
||||
Handle(Resource_Manager) rsc = context->ResourceManager();
|
||||
TCollection_AsciiString str ( seq );
|
||||
str += ".exec.op";
|
||||
if ( ! rsc->Find ( str.ToCString() ) ) {
|
||||
Handle(Resource_Manager) aRsc = aContext->ResourceManager();
|
||||
TCollection_AsciiString aStr(aSeq);
|
||||
aStr += ".exec.op";
|
||||
if (!aRsc->Find(aStr.ToCString()))
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
{
|
||||
static Standard_Integer time = 0;
|
||||
if ( ! time )
|
||||
std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << str.ToCString() <<
|
||||
" is not defined in " << prscfile << " resource; do default processing" << std::endl;
|
||||
time++;
|
||||
static Standard_Integer aTime = 0;
|
||||
if (!aTime)
|
||||
std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << aStr.ToCString() <<
|
||||
" is not defined in " << thePrscfile << " resource; do default processing" << std::endl;
|
||||
aTime++;
|
||||
}
|
||||
#endif
|
||||
// if reading, do default ShapeFix
|
||||
if ( ! strncmp ( pseq, "read.", 5 ) ) {
|
||||
if (!strncmp(thePseq, "read.", 5))
|
||||
{
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator;
|
||||
Handle(ShapeFix_Shape) sfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
|
||||
sfs->Init ( shape );
|
||||
sfs->SetMsgRegistrator ( msg );
|
||||
sfs->SetPrecision ( Prec );
|
||||
sfs->SetMaxTolerance ( maxTol );
|
||||
sfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
|
||||
sfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
|
||||
sfs->Perform(theProgress);
|
||||
Handle(ShapeExtend_MsgRegistrator) aMsg = new ShapeExtend_MsgRegistrator;
|
||||
Handle(ShapeFix_Shape) aSfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
|
||||
aSfs->Init(theShape);
|
||||
aSfs->SetMsgRegistrator(aMsg);
|
||||
aSfs->SetPrecision(thePrec);
|
||||
aSfs->SetMaxTolerance(theMaxTol);
|
||||
aSfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
|
||||
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
|
||||
aSfs->SetContext(theReShape);
|
||||
aSfs->Perform(theProgress);
|
||||
|
||||
TopoDS_Shape S = sfs->Shape();
|
||||
if ( ! S.IsNull() && S != shape ) {
|
||||
context->RecordModification ( sfs->Context(), msg );
|
||||
context->SetResult ( S );
|
||||
}
|
||||
TopoDS_Shape aShape = aSfs->Shape();
|
||||
if (!aShape.IsNull() && aShape != theShape)
|
||||
{
|
||||
aContext->RecordModification(aSfs->Context(), aMsg);
|
||||
aContext->SetResult(aShape);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure const& anException) {
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
|
||||
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
|
||||
anException.Print(std::cout); std::cout << std::endl;
|
||||
#endif
|
||||
(void)anException;
|
||||
(void)anException;
|
||||
}
|
||||
return context->Result();
|
||||
return aContext->Result();
|
||||
}
|
||||
// for writing, define default sequence of DirectFaces
|
||||
else if ( ! strncmp ( pseq, "write.", 6 ) ) {
|
||||
rsc->SetResource ( str.ToCString(), "DirectFaces" );
|
||||
else if (!strncmp(thePseq, "write.", 6))
|
||||
{
|
||||
aRsc->SetResource(aStr.ToCString(), "DirectFaces");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Define runtime tolerances and do Shape Processing
|
||||
rsc->SetResource ( "Runtime.Tolerance", Prec );
|
||||
rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
|
||||
aRsc->SetResource("Runtime.Tolerance", thePrec);
|
||||
aRsc->SetResource("Runtime.MaxTolerance", theMaxTol);
|
||||
|
||||
if ( !ShapeProcess::Perform(context, seq, theProgress) )
|
||||
return shape; // return original shape
|
||||
if (!ShapeProcess::Perform(aContext, aSeq, theProgress))
|
||||
return theShape; // return original shape
|
||||
|
||||
return context->Result();
|
||||
return aContext->Result();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
|
||||
const Standard_Real thePrec,
|
||||
const Standard_Real theMaxTol,
|
||||
const Standard_CString thePrscfile,
|
||||
const Standard_CString thePseq,
|
||||
Handle(Standard_Transient)& theInfo,
|
||||
const Message_ProgressRange& theProgress,
|
||||
const Standard_Boolean theNonManifold) const
|
||||
{
|
||||
Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape();
|
||||
return ProcessShape(theShape, thePrec, theMaxTol, thePrscfile,
|
||||
thePseq, theInfo, aReShape, theProgress,
|
||||
theNonManifold);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformFixShape
|
||||
//purpose :
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class ShapeBuild_ReShape;
|
||||
class XSAlgo_ToolContainer;
|
||||
class TopoDS_Shape;
|
||||
class TopoDS_Edge;
|
||||
@@ -30,7 +31,6 @@ class TopoDS_Face;
|
||||
class Transfer_TransientProcess;
|
||||
class Transfer_FinderProcess;
|
||||
|
||||
|
||||
class XSAlgo_AlgoContainer;
|
||||
DEFINE_STANDARD_HANDLE(XSAlgo_AlgoContainer, Standard_Transient)
|
||||
|
||||
@@ -55,16 +55,44 @@ public:
|
||||
Standard_EXPORT virtual void PrepareForTransfer() const;
|
||||
|
||||
//! Does shape processing with specified tolerances
|
||||
//! and returns resulting shape and associated information
|
||||
//! in the form of Transient.
|
||||
//! This information should be later transmitted to
|
||||
//! MergeTransferInfo in order to be recorded in the
|
||||
//! translation map
|
||||
Standard_EXPORT virtual TopoDS_Shape ProcessShape (
|
||||
const TopoDS_Shape& shape, const Standard_Real Prec, const Standard_Real MaxTol,
|
||||
const Standard_CString rscfile, const Standard_CString seq, Handle(Standard_Transient)& info,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange(),
|
||||
const Standard_Boolean NonManifold = Standard_False) const;
|
||||
//! @param[in] theShape shape to process
|
||||
//! @param[in] thePrec basic precision and tolerance
|
||||
//! @param[in] theMaxTol maximum allowed tolerance
|
||||
//! @param[in] thePrscfile name of the resource file
|
||||
//! @param[in] thePseq name of the sequence of operators defined in the resource file for Shape Processing
|
||||
//! @param[out] theInfo information to be recorded in the translation map
|
||||
//! @param[in] theProgress progress indicator
|
||||
//! @param[in] theNonManifold flag to proceed with non-manifold topology
|
||||
//! @return the processed shape
|
||||
Standard_EXPORT virtual TopoDS_Shape ProcessShape (const TopoDS_Shape& theShape,
|
||||
const Standard_Real thePrec,
|
||||
const Standard_Real theMaxTol,
|
||||
const Standard_CString thePrscfile,
|
||||
const Standard_CString thePseq,
|
||||
Handle(Standard_Transient)& theInfo,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange(),
|
||||
const Standard_Boolean theNonManifold = Standard_False) const;
|
||||
|
||||
//! Does shape processing with specified tolerances
|
||||
//! @param[in] theShape shape to process
|
||||
//! @param[in] thePrec basic precision and tolerance
|
||||
//! @param[in] theMaxTol maximum allowed tolerance
|
||||
//! @param[in] thePrscfile name of the resource file
|
||||
//! @param[in] thePseq name of the sequence of operators defined in the resource file for Shape Processing
|
||||
//! @param[out] theInfo information to be recorded in the translation map
|
||||
//! @param[in] theReShape tool to record the modifications of input shape
|
||||
//! @param[in] theProgress progress indicator
|
||||
//! @param[in] theNonManifold flag to proceed with non-manifold topology
|
||||
//! @return the processed shape
|
||||
Standard_EXPORT virtual TopoDS_Shape ProcessShape(const TopoDS_Shape& theShape,
|
||||
const Standard_Real thePrec,
|
||||
const Standard_Real theMaxTol,
|
||||
const Standard_CString thePrscfile,
|
||||
const Standard_CString thePseq,
|
||||
Handle(Standard_Transient)& theInfo,
|
||||
const Handle(ShapeBuild_ReShape)& theReShape,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange(),
|
||||
const Standard_Boolean theNonManifold = Standard_False) const;
|
||||
|
||||
//! Checks quality of pcurve of the edge on the given face,
|
||||
//! and corrects it if necessary.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
puts "TODO OCC23638 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO OCC23638 ALL: Faulty shapes in variables faulty_1 to faulty_1"
|
||||
|
||||
puts "============"
|
||||
puts "CR23638"
|
||||
@@ -8,8 +8,6 @@ puts ""
|
||||
# Reading IGES file produced invalid shape
|
||||
#######################################################################
|
||||
|
||||
param read.surfacecurve.mode -3
|
||||
|
||||
igesread [locate_data_file bug23638_cadbad.igs] result *
|
||||
|
||||
checkshape result
|
||||
|
Reference in New Issue
Block a user