]> OCCT Git - occt-copy.git/commitdiff
0031388: Data Exchange - support kinematics data in STEP format
authordpasukhi <dpasukhi@opencascade.com>
Tue, 11 Aug 2020 14:43:40 +0000 (17:43 +0300)
committerdpasukhi <dpasukhi@opencascade.com>
Wed, 12 Aug 2020 09:48:02 +0000 (12:48 +0300)
- Fix warning

14 files changed:
dox/user_guides/draw_test_harness/draw_test_harness.md
dox/user_guides/xde/xde.md
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/STEPCAFControl/STEPCAFControl_Writer.cxx
src/StepRepr/StepRepr_Transformation.cxx
src/StepToGeom/StepToGeom.cxx
src/XCAFDoc/XCAFDoc_KinematicPair.cxx
src/XCAFDoc/XCAFDoc_KinematicPairValue.hxx
src/XCAFDoc/XCAFDoc_KinematicTool.cxx
src/XCAFKinematics/XCAFKinematics_HighOrderPairObject.cxx
src/XCAFKinematics/XCAFKinematics_HighOrderPairObject.hxx
src/XCAFKinematics/XCAFKinematics_LowOrderPairObject.hxx
src/XCAFKinematics/XCAFKinematics_LowOrderPairObjectWithCoupling.hxx
src/XDEDRAW/XDEDRAW_Kinematics.cxx

index 33e3b2e9cf7a817d61f898a669ea959b8c2c3efc..2b0225a34ddda7faf6af645cd097cfa4d0d64979 100644 (file)
@@ -11169,7 +11169,7 @@ XGetPairValues D 0:11:1:3:1:1 -rotation
 == 1
 ~~~~~
 
-@subsubsection occt_draw_8_10_37  XRemovePairValues
+@subsubsection occt_draw_8_10_38  XRemovePairValues
 
 Syntax:
 ~~~~~
index 19e90587a58960f4fc6ba86f3566199515bba02c..3482095b05cdc52e76259cb3595ade090a1be851 100644 (file)
@@ -148,7 +148,7 @@ Notes API provides the following functionality:
 @subsection occt_xde_1_11 Kinematics
 
 Kinematic data storage is realized according to ISO 10303-105:2019(E) and STEP Schema AP242 2019 year.
-All kinematic data is divided onto mechanisms each mechanism has its graph of links (references to shapes), joints (kinematic pair information) and (optional) states(sets of kinematic values).
+All kinematic data is divided onto mechanisms each mechanism has its graph of links (references to shapes), joints (kinematic pair information) and (optional) states (sets of kinematic values).
 Each joint corresponds to one kinematic pair from the list:
 * Low order pairs
   - fully constrained pair (no DOF);
@@ -182,7 +182,7 @@ The kinematic pair information consists of
 
 The kinematic value consist of
 * reference to joint; 
-* paramters;
+* parameters.
 
 All mentioned data depends on the kinematic pair type.
 
@@ -1102,16 +1102,15 @@ All these methods except for the last one break all links with Document items as
 
 @subsection occt_xde_2_11 Kinematics
 
-In XDE Document Kinematics is managed via *XCAFDoc_KinematicTool*. The Kinematic pair entities are described by two attributes
-*XCAFDoc_KinematicPair* and *XCAFDoc_KinematicPairValue (optional)*. The second attribute is a dependant attribute, 
-it cannot be assigned to label without the main attribute or to a label with the main attribute of another kinematic pair type.
+In XDE Document Kinematics is managed via *XCAFDoc_KinematicTool*.
   
 @subsubsection occt_xde_2_11_1 Creation
 
 All kinematic data refers to the mechanism, so, first of all, it needs to *AddMechanism*, 
 this method creates a new mechanism and two empty subfolders for links and joints. 
 The next step is specifying of links (mechanism details)  via *AddLink* and *SetLink* commands.
-The last step of kinematic graph creation is adding of joints with using *AddJoint* and *SetJoint* commands.
+The next step is adding of joints with using *AddJoint* and *SetJoint* commands.
+The last step of kinematic graph creationp is specifying of states (optional) via *AddState*, *AddValue* and *SetValue* commands.
 
 Here is an example of creating a new mechanism and adding a new joint with two links:
 ~~~~~
@@ -1147,6 +1146,7 @@ Commands to check that created labels are valid:
 - *IsLink* : checking for references to shape of the given link;
 - *IsJoint* : checking for references to end and start link of the given joint;
 - *IsValue* : checking for conteined  assigning data.
+- *IsState* : checking for main label of value;
 
 To retrieve current graph state use the next methods:
 - *GetMechanisms* : retrieves all mechanisms labels;
index fa7192968a1c97e3834c42141ca3529eff6d7311..2053eee083ce62c6a4c9cd4089cc7f31279d7a3d 100644 (file)
@@ -4350,8 +4350,7 @@ Standard_Boolean addLinkWithShapes(const Handle(XSControl_WorkSession)& theWS,
     }
     if (aCDKLR.IsNull())
       continue;
-    Handle(StepRepr_PropertyDefinition) aPD =
-      Handle(StepRepr_PropertyDefinition)::DownCast(aCDKLR->RepresentedProductRelation());
+    Handle(StepRepr_PropertyDefinition) aPD = aCDKLR->RepresentedProductRelation();
     if (aPD.IsNull())
       continue;
     TDF_Label aShapeLabel;
@@ -4561,7 +4560,7 @@ Standard_Boolean setKinematicPairLimit(const Handle(StepKinematics_KinematicPair
       anObj->SetUpperLimitPitch(aPointOnSurfacePairWithRange->UpperLimitPitch());
       anObj->SetLowLimitRoll(aPointOnSurfacePairWithRange->LowerLimitRoll());
       anObj->SetUpperLimitRoll(aPointOnSurfacePairWithRange->UpperLimitRoll());
-      anObj->SetTrimmedSurface(StepToGeom::MakeRectangularTrimmedSurface(aPointOnSurfacePairWithRange->RangeOnPairSurface()));
+      anObj->SetSurface(StepToGeom::MakeSurface(aPointOnSurfacePairWithRange->RangeOnPairSurface()));
     }
     else if (theKP->IsKind(STANDARD_TYPE(StepKinematics_PointOnPlanarCurvePairWithRange)))
     {
@@ -4572,7 +4571,7 @@ Standard_Boolean setKinematicPairLimit(const Handle(StepKinematics_KinematicPair
       anObj->SetUpperLimitPitch(aPointOnPlanarCurvePairWithRange->UpperLimitPitch());
       anObj->SetLowLimitRoll(aPointOnPlanarCurvePairWithRange->LowerLimitRoll());
       anObj->SetUpperLimitRoll(aPointOnPlanarCurvePairWithRange->UpperLimitRoll());
-      anObj->SetTrimmedCurve(StepToGeom::MakeTrimmedCurve(aPointOnPlanarCurvePairWithRange->RangeOnPairCurve()));
+      anObj->SetCurve(StepToGeom::MakeCurve(aPointOnPlanarCurvePairWithRange->RangeOnPairCurve()));
     }
     else if (theKP->IsKind(STANDARD_TYPE(StepKinematics_PlanarCurvePairRange)))
     {
@@ -4692,7 +4691,7 @@ Handle(XCAFKinematics_PairObject) createXCAFKinematicPairObject(const Handle(Ste
     else if (theKP->IsKind(STANDARD_TYPE(StepKinematics_LinearFlexibleAndPlanarCurvePair)))
     {
       Handle(StepKinematics_LinearFlexibleAndPlanarCurvePair) aLinearFlexibleAndPlanarCurvePair = Handle(StepKinematics_LinearFlexibleAndPlanarCurvePair)::DownCast(theKP);
-      aHighOrderPairObject->SetFirstCurve(StepToGeom::MakeCurve(aLinearFlexibleAndPlanarCurvePair->PairCurve()));
+      aHighOrderPairObject->SetCurve(StepToGeom::MakeCurve(aLinearFlexibleAndPlanarCurvePair->PairCurve()));
       aHighOrderPairObject->SetOrientation(aLinearFlexibleAndPlanarCurvePair->Orientation());
     }
   }
index 87b6f372be51e590519a92e7b10ae03cd6fe5fb2..72b9026993cda156f22a98adb57f65bdd9279f78 100644 (file)
@@ -22,9 +22,7 @@
 
 #include <BRep_Builder.hxx>
 #include <GeomToStep_MakeAxis2Placement3d.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
 #include <GeomToStep_MakeCartesianPoint.hxx>
-#include <Geom_TrimmedCurve.hxx>
 #include <HeaderSection_FileSchema.hxx>
 #include <Interface_EntityIterator.hxx>
 #include <Interface_Static.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <GeomToStep_MakeSurface.hxx>
 #include <GeomToStep_MakeCurve.hxx>
-#include <GeomToStep_MakeRectangularTrimmedSurface.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <Transfer_ActorOfFinderProcess.hxx>
 #include <Transfer_Binder.hxx>
@@ -2304,9 +2301,7 @@ static Standard_Boolean createKinematicLink(const Handle(XSControl_WorkSession)&
 //function : createKinematicJoint
 //purpose  : auxilary
 //=======================================================================
-static Standard_Boolean createKinematicJoint(const Handle(Transfer_FinderProcess)& theFP,
-                                             const Handle(XCAFDoc_KinematicTool)& theKTool,
-                                             const Interface_Graph& theGraph,
+static Standard_Boolean createKinematicJoint(const Handle(XCAFDoc_KinematicTool)& theKTool,
                                              const TDF_Label& theLabelJoint,
                                              const Handle(XCAFKinematics_PairObject)& theKinPairObj,
                                              const NCollection_IndexedDataMap<TDF_Label, Handle(StepKinematics_KinematicLinkRepresentation), TDF_LabelMapHasher>& theMapOfLinks,
@@ -2732,32 +2727,31 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     {
     case(XCAFKinematics_PairType_PointOnSurface):
     {
-      if (isRanged)
+      GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
+      Handle(StepGeom_Surface) aPairSurface = aMaker.Value();
+      if (isRanged && !aPairSurface.IsNull() &&
+        aPairSurface->IsKind(STANDARD_TYPE(StepGeom_RectangularTrimmedSurface)))
       {
-        GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
-        Handle(StepGeom_Surface) aPairSurface = aMaker.Value();
         Standard_Real aLowerLimitYaw = aHighOrderPairObject->LowLimitYaw();
         Standard_Real aUpperLimitYaw = aHighOrderPairObject->UpperLimitYaw();
         Standard_Real aLowerLimitPitch = aHighOrderPairObject->LowLimitPitch();
         Standard_Real aUpperLimitPitch = aHighOrderPairObject->UpperLimitPitch();
         Standard_Real aLowerLimitRoll = aHighOrderPairObject->LowLimitRoll();
         Standard_Real aUpperLimitRoll = aHighOrderPairObject->UpperLimitRoll();
-        GeomToStep_MakeRectangularTrimmedSurface aMakerTrimmered(aHighOrderPairObject->TrimmedSurface());
-        Handle(StepGeom_RectangularTrimmedSurface) aRangeOnPairSurface = aMakerTrimmered.Value();
+        GeomToStep_MakeSurface aMakerSurface(aHighOrderPairObject->Surface());
+        Handle(StepGeom_RectangularTrimmedSurface) aRangeOnPairSurface = Handle(StepGeom_RectangularTrimmedSurface)::DownCast(aMakerSurface.Value());
         theKinematicPair = new StepKinematics_PointOnSurfacePairWithRange;
         Handle(StepKinematics_PointOnSurfacePairWithRange) aPointOnSurfacePairWithRange = Handle(StepKinematics_PointOnSurfacePairWithRange)::DownCast(theKinematicPair);
         aPointOnSurfacePairWithRange->Init(aPairName, aPairName, hasDescription,
           aDescription, theTransformItem1, theTransformItem2, theJoint, aPairSurface,aRangeOnPairSurface, Standard_True, aLowerLimitYaw, Standard_True, aUpperLimitYaw, Standard_True,
           aLowerLimitPitch, Standard_True, aUpperLimitPitch, Standard_True, aLowerLimitRoll, Standard_True, aUpperLimitRoll);
       }
-      else
+      else 
       {
         theKinematicPair = new StepKinematics_PointOnSurfacePair;
-        GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
-        Handle(StepGeom_Surface) aPairSurface = aMaker.Value();
         Handle(StepKinematics_PointOnSurfacePair) aPointOnSurface = Handle(StepKinematics_PointOnSurfacePair)::DownCast(theKinematicPair);
         aPointOnSurface->Init(aPairName, aPairName, hasDescription,
-          aDescription, theTransformItem1, theTransformItem2, theJoint,aPairSurface);
+          aDescription, theTransformItem1, theTransformItem2, theJoint, aPairSurface);
       }
       break;
     }
@@ -2792,41 +2786,21 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
       GeomToStep_MakeCurve aMaker(aHighOrderPairObject->Curve());
       Handle(StepGeom_Curve) aPairCurve = aMaker.Value();
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
-      if (isRanged)
+      if (isRanged && !aPairCurve.IsNull() &&
+        aPairCurve->IsKind(STANDARD_TYPE(StepGeom_TrimmedCurve)))
       {
         Standard_Real aLowerLimitYaw = aHighOrderPairObject->LowLimitYaw();
         Standard_Real aUpperLimitYaw = aHighOrderPairObject->UpperLimitYaw();
         Standard_Real aLowerLimitPitch = aHighOrderPairObject->LowLimitPitch();
         Standard_Real aUpperLimitPitch = aHighOrderPairObject->UpperLimitPitch();
         Standard_Real aLowerLimitRoll = aHighOrderPairObject->LowLimitRoll();
-        Standard_Real aUpperLimitRoll = aHighOrderPairObject->UpperLimitRoll(); 
-        Handle(Geom_TrimmedCurve) aRangeOnCurve = aHighOrderPairObject->TrimmedCurve();
-        Handle(StepGeom_HArray1OfTrimmingSelect) aSTS1 =
-          new StepGeom_HArray1OfTrimmingSelect(1, 2);
-        StepGeom_TrimmingSelect tSel;
-        GeomToStep_MakeCartesianPoint aMP1(aRangeOnCurve->StartPoint());
-        tSel.SetValue(aMP1.Value());
-        aSTS1->SetValue(1, tSel);
-        tSel.SetParameterValue(aRangeOnCurve->FirstParameter());
-        aSTS1->SetValue(2, tSel);
-
-        Handle(StepGeom_HArray1OfTrimmingSelect) aSTS2 =
-          new StepGeom_HArray1OfTrimmingSelect(1, 2);
-        GeomToStep_MakeCartesianPoint aMP2(aRangeOnCurve->EndPoint());
-        tSel.SetValue(aMP2.Value());
-        aSTS2->SetValue(1, tSel);
-        tSel.SetParameterValue(aRangeOnCurve->LastParameter());
-        aSTS2->SetValue(2, tSel);
-
-        Handle(TCollection_HAsciiString) empty =
-          new TCollection_HAsciiString("");
-        Handle(StepGeom_TrimmedCurve) aRangeOnPairCurve = new StepGeom_TrimmedCurve;
-        aRangeOnPairCurve->Init(empty, aPairCurve, aSTS1, aSTS2, Standard_True, StepGeom_tpParameter);
+        Standard_Real aUpperLimitRoll = aHighOrderPairObject->UpperLimitRoll();
+        Handle(StepGeom_TrimmedCurve) aRangeOnPairCurve = Handle(StepGeom_TrimmedCurve)::DownCast(aPairCurve);
         theKinematicPair = new StepKinematics_PointOnPlanarCurvePairWithRange;
         Handle(StepKinematics_PointOnPlanarCurvePairWithRange) aPointOnPlanarCurvePairWithRange = Handle(StepKinematics_PointOnPlanarCurvePairWithRange)::DownCast(theKinematicPair);
         aPointOnPlanarCurvePairWithRange->Init(aPairName, aPairName, hasDescription,
-          aDescription, theTransformItem1, theTransformItem2, theJoint, aPairCurve, anOrientation, aRangeOnPairCurve,Standard_True,aLowerLimitYaw, Standard_True,aUpperLimitYaw, Standard_True,
-          aLowerLimitPitch, Standard_True, aUpperLimitPitch, Standard_True,aLowerLimitRoll, Standard_True, aUpperLimitRoll);
+          aDescription, theTransformItem1, theTransformItem2, theJoint, aPairCurve, anOrientation, aRangeOnPairCurve, Standard_True, aLowerLimitYaw, Standard_True, aUpperLimitYaw, Standard_True,
+          aLowerLimitPitch, Standard_True, aUpperLimitPitch, Standard_True, aLowerLimitRoll, Standard_True, aUpperLimitRoll);
       }
       else
       {
@@ -2866,7 +2840,7 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     case(XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve):
     {
       theKinematicPair = new StepKinematics_LinearFlexibleAndPlanarCurvePair;
-      GeomToStep_MakeCurve aMaker(aHighOrderPairObject->FirstCurve());
+      GeomToStep_MakeCurve aMaker(aHighOrderPairObject->Curve());
       Handle(StepGeom_Curve) aPairCurve = aMaker.Value();
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
       Handle(StepKinematics_LinearFlexibleAndPlanarCurvePair) aLinearFlexibleAndPlanarCurvePair = Handle(StepKinematics_LinearFlexibleAndPlanarCurvePair)::DownCast(theKinematicPair);
@@ -3109,7 +3083,7 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
     break;
   }
   Handle(StepKinematics_KinematicPair) aAppliesToPair =
-    Handle(StepKinematics_KinematicPair)::DownCast(thePairReprRelationship->RepresentationRelationshipWithTransformation()->TransformationOperator().KinematicPair());
+    thePairReprRelationship->RepresentationRelationshipWithTransformation()->TransformationOperator().KinematicPair();
   thePairValue->SetAppliesToPair(aAppliesToPair);
   thePairValue->SetName(aAppliesToPair->Name());
   return Standard_True;
@@ -3126,8 +3100,6 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
 
   // get working data
   const Handle(Interface_InterfaceModel)& Model = theWS->Model();
-  const Handle(XSControl_TransferWriter)& TW = theWS->TransferWriter();
-  const Handle(Transfer_FinderProcess)& FP = TW->FinderProcess();
 
   const Handle(Interface_HGraph) aHGraph = theWS->HGraph();
   if (aHGraph.IsNull())
@@ -3196,7 +3168,7 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
       Handle(XCAFKinematics_PairObject) aPairObject = aKPairAttr->GetObject();
       Handle(StepKinematics_KinematicLinkRepresentation) aLinkRepr1;
       Handle(StepKinematics_KinematicLinkRepresentation) aLinkRepr2;
-      if (!createKinematicJoint(FP, aKTool, aGraph, aJointL, aPairObject, aMapOfLinks, aLinkRepr1, aLinkRepr2, aJoint))
+      if (!createKinematicJoint(aKTool, aJointL, aPairObject, aMapOfLinks, aLinkRepr1, aLinkRepr2, aJoint))
         continue;
       if (!createKinematicPair(aPairObject,aJoint,aKinematicPair, aLinkRepr1, aLinkRepr2))
         continue;
index 576bd0e808cc1546587ab05eb20675fd311456b7..cef0c9c643630fd66fa2901e06491148aaa90020 100644 (file)
@@ -47,6 +47,6 @@ Handle(StepKinematics_KinematicPair) StepRepr_Transformation::KinematicPair() co
        Handle(StepKinematics_ActuatedKinPairAndOrderKinPair) aComplexPair = GetCasted(StepKinematics_ActuatedKinPairAndOrderKinPair, Value());
        if (aComplexPair.IsNull())
                return  GetCasted(StepKinematics_KinematicPair, Value());
-       return GetCasted(StepKinematics_KinematicPair, aComplexPair->GetOrderKinematicPair());
+       return aComplexPair->GetOrderKinematicPair();
 }
 
index b0eba23c0c960969bcdc8bfcbe3bd425e1bd6b2b..c4e08892008830d850d9ce700c475884852712aa 100644 (file)
@@ -211,7 +211,7 @@ Handle(Geom_Axis2Placement) StepToGeom::MakeAxis2Placement (const Handle(StepGeo
 }
 
 //=============================================================================
-// Creation d' un AxisPlacement de Geom2d a partir d' un SuParameters de Step
+// Creation of an AxisPlacement from a Kinematic SuParameters for Step
 //=============================================================================
 
 Handle(Geom_Axis2Placement) StepToGeom::MakeAxis2Placement(const Handle(StepKinematics_SuParameters)& SP)
@@ -2071,7 +2071,7 @@ Handle(Geom2d_VectorWithMagnitude) StepToGeom::MakeVectorWithMagnitude2d (const
 }
 
 //=============================================================================
-// Creation d' un YptRotation de Kinematic a partir d' un SpatialRotation de Step
+// Creation of a YptRotation from a Kinematic SpatialRotation for Step
 //=============================================================================
 
 Handle(TColStd_HArray1OfReal) StepToGeom::MakeYprRotation(const StepKinematics_SpatialRotation& SR, const Handle(StepRepr_GlobalUnitAssignedContext)& theCntxt)
@@ -2080,10 +2080,7 @@ Handle(TColStd_HArray1OfReal) StepToGeom::MakeYprRotation(const StepKinematics_S
   Handle(TColStd_HArray1OfReal) anYPRRotation;
   if (!SR.YprRotation().IsNull() &&
       SR.YprRotation()->Length() == 3)
-  {
-    anYPRRotation = SR.YprRotation();
-    return anYPRRotation;
-  }
+    return  SR.YprRotation();
 
   if (SR.RotationAboutDirection().IsNull() ||
       SR.RotationAboutDirection()->DirectionOfAxis()->DirectionRatios()->Length() != 3 ||
@@ -2152,7 +2149,7 @@ Handle(TColStd_HArray1OfReal) StepToGeom::MakeYprRotation(const StepKinematics_S
     anYPRRotation->SetValue(1, 0.);
     anYPRRotation->SetValue(2, 0.);
     anYPRRotation->SetValue(3, 0.);
-    if (dx != 0.)
+    if (Abs(dx) >= Precision::Confusion())
       if (dx > 0.)
         anYPRRotation->SetValue(3, aYaw);
       else
index 8e0cc9997200aafca95ba22a24d967777578cb85..ad72c5b52889d1a307061dc2ab1c582cb4c664f3 100644 (file)
@@ -153,10 +153,7 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
     if (theObject->Type() == XCAFKinematics_PairType_PointOnSurface && !anObject->Surface().IsNull())
     {
       TopoDS_Face aFace;
-      if (anObject->HasLimits())
-        aBuilder.MakeFace(aFace, anObject->TrimmedSurface(), Precision::Confusion());
-      else
-        aBuilder.MakeFace(aFace, anObject->Surface(), Precision::Confusion());
+      aBuilder.MakeFace(aFace, anObject->Surface(), Precision::Confusion());
       TNaming_Builder aTNBuild(Label().FindChild(ChildLab_FirstGeomParam));
       aTNBuild.Generated(aFace);
     }
@@ -175,18 +172,16 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
         aTNBuild2.Generated(aFace2);
       }
     }
-    if (theObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve && !anObject->Curve().IsNull())
+    if ((theObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve || 
+         theObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve) && !anObject->Curve().IsNull())
     {
       TopoDS_Edge anEdge;
-      if (anObject->HasLimits())
-        aBuilder.MakeEdge(anEdge, anObject->TrimmedCurve(), Precision::Confusion());
-      else 
-        aBuilder.MakeEdge(anEdge, anObject->Curve(), Precision::Confusion());
+      aBuilder.MakeEdge(anEdge, anObject->Curve(), Precision::Confusion());
       TNaming_Builder aTNBuild(Label().FindChild(ChildLab_FirstGeomParam));
       aTNBuild.Generated(anEdge);
     }
-    if (anObject->Type() >= XCAFKinematics_PairType_SlidingCurve &&
-        anObject->Type() <= XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
+    if (anObject->Type() == XCAFKinematics_PairType_SlidingCurve ||
+        anObject->Type() == XCAFKinematics_PairType_RollingCurve)
     {
       TopoDS_Edge anEdge1, anEdge2;
       if (!anObject->FirstCurve().IsNull()) {
@@ -308,7 +303,8 @@ Handle(XCAFKinematics_PairObject) XCAFDoc_KinematicPair::GetObject()  const
         aDefObject->SetSecondSurface(BRep_Tool::Surface(aFace));
       }
     }
-    if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve)
+    if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve || 
+        anObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
     {
       if (Label().FindChild(ChildLab_FirstGeomParam).FindAttribute(TNaming_NamedShape::GetID(), aNS))
       {
@@ -333,15 +329,6 @@ Handle(XCAFKinematics_PairObject) XCAFDoc_KinematicPair::GetObject()  const
         aDefObject->SetSecondCurve(BRep_Tool::Curve(anEdge, aFirst, aLast));
       }
     }
-    if (anObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
-    {
-      if (Label().FindChild(ChildLab_FirstGeomParam).FindAttribute(TNaming_NamedShape::GetID(), aNS))
-      {
-        TopoDS_Edge anEdge = TopoDS::Edge(TNaming_Tool::GetShape(aNS));
-        Standard_Real aFirst, aLast;
-        aDefObject->SetFirstCurve(BRep_Tool::Curve(anEdge, aFirst, aLast));
-      }
-    }
   }
 
   return anObject;
index 78fef40bb81e43bc72e4a30b0e82cb86322cfd9f..8bb1324d8aba862d1e65c89241dfbd92f4f7c2b7 100644 (file)
@@ -38,8 +38,7 @@ DEFINE_STANDARD_HANDLE(XCAFDoc_KinematicPairValue, TDF_Attribute)
 //! This parameter is an additional attribute for kinematic pair attribute,
 //! which characterizes the pair for one of the mechanism states. 
 //! It is prohibited to store inconsistent data:
-//! - to store this attribute without kinematic value attribute
-//! - to store this attribute not of the same type as the type of the pair
+//! - to store this attribute not of the same type as the type of linked the pair
 class XCAFDoc_KinematicPairValue : public TDF_Attribute
 {
 
index 86b9364f918f483ea39a279b5e978a48ce9bddbc..982f34456ad2d3c16129eb932968490bbb9acd4f 100644 (file)
@@ -251,6 +251,8 @@ Standard_EXPORT Standard_Boolean XCAFDoc_KinematicTool::SetBaseLink(const TDF_La
      (!aLinkName.IsNull() && !aLinkName->Get().IsDifferent("Link " + theLink.Tag())))
     TDataStd_Name::Set(theLink, "Base");
   TDataStd_Integer::Set(theLink, 1);
+  
+  return Standard_True;
 }
 
 //=======================================================================
index 12f1830fbd08951897d66a8873a4a174b7e5a77f..ab02eb8019050dbb433b4f1936460a32be8e0aa6 100644 (file)
@@ -328,7 +328,7 @@ Standard_Real XCAFKinematics_HighOrderPairObject::UpperLimitPitch()
 //=======================================================================
 void XCAFKinematics_HighOrderPairObject::SetCurve(const Handle(Geom_Curve)& theCurve)
 {
-  if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve)
+  if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
     myGeom.ChangeFirst() = theCurve;
 }
 
@@ -338,16 +338,8 @@ void XCAFKinematics_HighOrderPairObject::SetCurve(const Handle(Geom_Curve)& theC
 //=======================================================================
 Handle(Geom_Curve) XCAFKinematics_HighOrderPairObject::Curve() const
 {
-  if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve && !myGeom.First().IsNull())
-  {
-    if (myGeom.First()->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
-    {
-      Handle(Geom_TrimmedCurve) aTrimCurve = Handle(Geom_TrimmedCurve)::DownCast(myGeom.First());
-      return aTrimCurve->BasisCurve();
-    }
-    else 
-      return Handle(Geom_Curve)::DownCast(myGeom.First());
-  }
+  if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
+    return Handle(Geom_Curve)::DownCast(myGeom.First());
   return NULL;
 }
 
@@ -357,7 +349,7 @@ Handle(Geom_Curve) XCAFKinematics_HighOrderPairObject::Curve() const
 //=======================================================================
 void XCAFKinematics_HighOrderPairObject::SetFirstCurve(const Handle(Geom_Curve)& theCurve)
 {
-  if (Type() >= XCAFKinematics_PairType_SlidingCurve && Type() <= XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
+  if (Type() == XCAFKinematics_PairType_SlidingCurve || Type() == XCAFKinematics_PairType_RollingCurve)
     myGeom.ChangeFirst() = theCurve;
 }
 
@@ -367,7 +359,7 @@ void XCAFKinematics_HighOrderPairObject::SetFirstCurve(const Handle(Geom_Curve)&
 //=======================================================================
 Handle(Geom_Curve) XCAFKinematics_HighOrderPairObject::FirstCurve() const
 {
-  if (Type() >= XCAFKinematics_PairType_SlidingCurve && Type() <= XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
+  if (Type() == XCAFKinematics_PairType_SlidingCurve || Type() == XCAFKinematics_PairType_RollingCurve)
     return Handle(Geom_Curve)::DownCast(myGeom.First());
   return NULL;
 }
@@ -393,28 +385,6 @@ Handle(Geom_Curve) XCAFKinematics_HighOrderPairObject::SecondCurve() const
   return NULL;
 }
 
-//=======================================================================
-//function : SetTrimmedCurve
-//purpose  : 
-//=======================================================================
-void XCAFKinematics_HighOrderPairObject::SetTrimmedCurve(const Handle(Geom_TrimmedCurve)& aTrimCurve)
-{
-  if (Type() != XCAFKinematics_PairType_PointOnPlanarCurve && !HasLimits())
-    return;
-  myGeom.ChangeFirst() = aTrimCurve;
-}
-
-//=======================================================================
-//function : TrimmedCurve
-//purpose  : 
-//=======================================================================
-Handle(Geom_TrimmedCurve) XCAFKinematics_HighOrderPairObject::TrimmedCurve() const
-{
-  if (Type() != XCAFKinematics_PairType_PointOnPlanarCurve)
-    return NULL;
-  return  Handle(Geom_TrimmedCurve)::DownCast(myGeom.First());
-}
-
 //=======================================================================
 //function : SetSurface
 //purpose  : 
@@ -432,13 +402,7 @@ void XCAFKinematics_HighOrderPairObject::SetSurface(const Handle(Geom_Surface)&
 Handle(Geom_Surface) XCAFKinematics_HighOrderPairObject::Surface() const
 {
   if (Type() == XCAFKinematics_PairType_PointOnSurface)
-    if (!myGeom.First().IsNull() && myGeom.First()->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
-    {
-      Handle(Geom_RectangularTrimmedSurface) aTrimSurface = Handle(Geom_RectangularTrimmedSurface)::DownCast(myGeom.First());
-      return aTrimSurface->BasisSurface();
-    }
-    else
-      return Handle(Geom_Surface)::DownCast(myGeom.First());
+    return Handle(Geom_Surface)::DownCast(myGeom.First());
   return NULL;
 }
 
@@ -483,25 +447,3 @@ Handle(Geom_Surface) XCAFKinematics_HighOrderPairObject::SecondSurface() const
     return Handle(Geom_Surface)::DownCast(myGeom.Last());
   return NULL;
 }
-
-//=======================================================================
-//function : SetTrimmedSurface
-//purpose  : 
-//=======================================================================
-void XCAFKinematics_HighOrderPairObject::SetTrimmedSurface(const Handle(Geom_RectangularTrimmedSurface)& aTrimSurface)
-{
-  if (Type() != XCAFKinematics_PairType_PointOnSurface && !HasLimits())
-    return;
-  myGeom.ChangeFirst() = aTrimSurface;
-}
-
-//=======================================================================
-//function : TrimmedSurface
-//purpose  : 
-//=======================================================================
-Handle(Geom_RectangularTrimmedSurface) XCAFKinematics_HighOrderPairObject::TrimmedSurface() const
-{
-  if (Type() != XCAFKinematics_PairType_PointOnSurface)
-    return NULL;
-  return Handle(Geom_RectangularTrimmedSurface)::DownCast(myGeom.First());
-}
index a8f56a2ec33b5a54a914e7410a52a35501b7aacb..6a636c6f93ad053fe742418598cdab97e69da750 100644 (file)
@@ -135,19 +135,19 @@ public:
   //! \return limit
   Standard_EXPORT Standard_Real UpperLimitPitch();
 
-  //! Sets curve attribute (only for PointOnPlanarCurve)
+  //! Sets curve attribute (only for PointOnPlanarCurve and LinearAndFlexibleCurve)
   //! \param[in] theCurve curve
   Standard_EXPORT void SetCurve(const Handle(Geom_Curve)& theCurve);
 
-  //! Gets curve attribute (only for PointOnPlanarCurve)
+  //! Gets curve attribute (only for PointOnPlanarCurve and LinearAndFlexibleCurve)
   //! \return curve
   Standard_EXPORT Handle(Geom_Curve) Curve() const;
 
-  //! Sets curve attribute (only for SlidingCurve, RollingCurve LinearAndFlexibleCurve)
+  //! Sets curve attribute (only for SlidingCurve and RollingCurve)
   //! \param[in] theCurve curve
   Standard_EXPORT void SetFirstCurve(const Handle(Geom_Curve)& theCurve);
 
-  //! Gets curve attribute (only for SlidingCurve, RollingCurve LinearAndFlexibleCurve)
+  //! Gets curve attribute (only for SlidingCurve and RollingCurve)
   //! \return curve
   Standard_EXPORT Handle(Geom_Curve) FirstCurve() const;
 
@@ -159,14 +159,6 @@ public:
   //! \return curve
   Standard_EXPORT Handle(Geom_Curve) SecondCurve() const;
 
-  //! Sets trimmed curve attribute (only for PointOnCurve)
-  //! \param[in] aTrimCurve trimmed curve
-  Standard_EXPORT void SetTrimmedCurve(const Handle(Geom_TrimmedCurve)& aTrimCurve);
-
-  //! Gets trimmed curve attribute (only for PointOnCurve)
-  //! \return trimmed curve
-  Standard_EXPORT Handle(Geom_TrimmedCurve) TrimmedCurve() const;
-
   //! Sets surface attribute (only for PointOnSurface)
   //! \param[in] theSurface surface
   Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& theSurface);
@@ -191,14 +183,6 @@ public:
   //! \return surface
   Standard_EXPORT Handle(Geom_Surface) SecondSurface() const;
 
-  //! Sets trimmed surface attribute (only for PointOnSurface)
-  //! \param[in] aTrimSurface trimmered surface
-  Standard_EXPORT void SetTrimmedSurface(const Handle(Geom_RectangularTrimmedSurface)& aTrimSurface);
-
-  //! Gets trimmed surface attribute (only for PointOnSurface)
-  //! \return trimmed surface
-  Standard_EXPORT Handle(Geom_RectangularTrimmedSurface) TrimmedSurface() const;
-
   DEFINE_STANDARD_RTTIEXT(XCAFKinematics_HighOrderPairObject, XCAFKinematics_PairObject)
 
 private:
index ca8a488ae79c8ec0ecf3261aa79f082c96891643..9d0c72e77fee01a544ecb2542e99f1e0318b4fea 100644 (file)
@@ -194,13 +194,13 @@ public:
 
   void SetSkewAngle(const Standard_Real theAngle)
   {
-    if (Type() == XCAFKinematics_PairType_Universal || XCAFKinematics_PairType_Homokinetic)
+    if (Type() == XCAFKinematics_PairType_Universal || Type() == XCAFKinematics_PairType_Homokinetic)
       mySkewAngle = theAngle;
   }
 
   Standard_Real SkewAngle() const
   {
-    if (Type() == XCAFKinematics_PairType_Universal || XCAFKinematics_PairType_Homokinetic)
+    if (Type() == XCAFKinematics_PairType_Universal || Type() == XCAFKinematics_PairType_Homokinetic)
       return mySkewAngle;
     else return 0;
   }
index 62d4c73a075db449adf6bf5e7ac705f1dac79c98..86bbaf30808c6057ac9fcf9108eee2e79b7a0ee9 100644 (file)
@@ -27,6 +27,7 @@ DEFINE_STANDARD_HANDLE(XCAFKinematics_LowOrderPairObjectWithCoupling, XCAFKinema
 //! - XCAFKinematics_PairType_Screw
 //! - XCAFKinematics_PairType_RackAndPinion
 //! - XCAFKinematics_PairType_Gear
+//! - XCAFKinematics_PairType_LinearFlexibleAndPinion
 class XCAFKinematics_LowOrderPairObjectWithCoupling : public XCAFKinematics_PairObject
 {
 
index 6660099750f43ca9e2f1d8bc2b93eef8e1c44381..0b8bd059ee0fea0fd675ec546605ab40c04c75dc 100644 (file)
@@ -1155,10 +1155,9 @@ static Standard_Integer setGeomParam(Draw_Interpretor& di, Standard_Integer argc
       di << "Invalid geometric argument\n";
       return 1;
     }
-    if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve)
+    if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve ||
+        anObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
       anObject->SetCurve(aCurve);
-    else if (anObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
-      anObject->SetFirstCurve(aCurve);
     else {
       switch (aParamNb) {
       case 1: anObject->SetFirstCurve(aCurve);
@@ -1215,10 +1214,7 @@ static Standard_Integer getGeomParam(Draw_Interpretor& di, Standard_Integer argc
     // Surface
     Handle(Geom_Surface) aSurface;
     if (anObject->Type() == XCAFKinematics_PairType_PointOnSurface)
-      if (!anObject->HasLimits())
-        aSurface = anObject->Surface();
-      else
-        aSurface = anObject->TrimmedSurface();
+      aSurface = anObject->Surface();
     else {
       switch (aTrsfNb) {
       case 1: aSurface = anObject->FirstSurface();
@@ -1235,13 +1231,9 @@ static Standard_Integer getGeomParam(Draw_Interpretor& di, Standard_Integer argc
   else {
     // Curve
     Handle(Geom_Curve) aCurve;
-    if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve)
-      if (!anObject->HasLimits())
-        aCurve = anObject->Curve();
-      else
-        aCurve = anObject->TrimmedCurve();
-    else if(anObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
-      aCurve = anObject->FirstCurve();
+    if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve ||
+        anObject->Type() == XCAFKinematics_PairType_LinearFlexibleAndPlanarCurve)
+      aCurve = anObject->Curve();
     else {
       switch (aTrsfNb) {
       case 1: aCurve = anObject->FirstCurve();
@@ -1841,8 +1833,8 @@ void XDEDRAW_Kinematics::InitCommands(Draw_Interpretor& di)
   di.Add("XSetPairParams", "XSetPairParams Doc Joint Value1 Value2..."
     "\tScrew - Pitch\n"
     "\tRackAndPinion - PinionRadius\n"
-    "\tGear -FirstLinkRadius SecondLinkRadius Bevel HelicalAngle GearRatio \n"
-    "\tLinear - SkewAngle \n"
+    "\tGear - FirstLinkRadius SecondLinkRadius Bevel HelicalAngle GearRatio\n"
+    "\tLinear - PinionRadius\n"
     __FILE__, setParameters, g);
 
   di.Add("XGetPairParams", "XGetPairParams Doc Joint",