]> OCCT Git - occt-copy.git/commitdiff
0031388: To support kinematics data in STEP format
authordpasukhi <dpasukhi@opencascade.com>
Wed, 24 Jun 2020 10:22:56 +0000 (13:22 +0300)
committerdpasukhi <dpasukhi@opencascade.com>
Tue, 30 Jun 2020 08:05:12 +0000 (11:05 +0300)
 - Upgrade tests for current kinematic entities
 - Fix Write/Read Referenced shapes of link
 - Fix Write/Read pairs without limits(not ranged)
 - Fix choosing base kinematic  link of mechanism
 - Fix set/get XCAFKinematics_HighOrderPairObject
   - SlidingSurface, RollingSurface, SlidingCurve, RollingCurve hasn't limits
   - PointOnPlanarCurve, PointOnSurface has only trimmed geometry, if limited

45 files changed:
src/RWStepKinematics/RWStepKinematics_RWActuatedKinPairAndOrderKinPair.cxx
src/RWStepKinematics/RWStepKinematics_RWActuatedKinPairAndOrderKinPair.hxx
src/RWStepKinematics/RWStepKinematics_RWMechanismStateRepresentation.cxx
src/RWStepKinematics/RWStepKinematics_RWMechanismStateRepresentation.hxx
src/RWStepKinematics/RWStepKinematics_RWPointOnPlanarCurvePairValue.cxx
src/RWStepKinematics/RWStepKinematics_RWPointOnSurfacePairValue.cxx
src/RWStepKinematics/RWStepKinematics_RWSphericalPairValue.cxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/STEPCAFControl/STEPCAFControl_Writer.cxx
src/STEPCAFControl/STEPCAFControl_Writer.hxx
src/StepKinematics/StepKinematics_ActuatedKinPairAndOrderKinPair.cxx
src/StepKinematics/StepKinematics_ActuatedKinPairAndOrderKinPair.hxx
src/StepKinematics/StepKinematics_MechanismStateRepresentation.cxx
src/StepKinematics/StepKinematics_MechanismStateRepresentation.hxx
src/XCAFDoc/XCAFDoc.cxx
src/XCAFDoc/XCAFDoc_KinematicPair.cxx
src/XCAFDoc/XCAFDoc_KinematicPairValue.cxx
src/XCAFDoc/XCAFDoc_KinematicTool.cxx
src/XCAFDoc/XCAFDoc_KinematicTool.hxx
src/XCAFKinematics/XCAFKinematics_HighOrderPairObject.cxx
src/XCAFKinematics/XCAFKinematics_HighOrderPairObject.hxx
src/XCAFKinematics/XCAFKinematics_LowOrderPairObject.cxx
src/XCAFKinematics/XCAFKinematics_LowOrderPairObject.hxx
src/XCAFKinematics/XCAFKinematics_LowOrderPairObjectWithCoupling.cxx
src/XCAFKinematics/XCAFKinematics_LowOrderPairObjectWithCoupling.hxx
src/XDEDRAW/XDEDRAW_Kinematics.cxx
tests/gdt/kinematics/A1
tests/gdt/kinematics/A2
tests/gdt/kinematics/A3
tests/gdt/kinematics/A4
tests/gdt/kinematics/A5
tests/gdt/kinematics/A6
tests/gdt/kinematics/A7
tests/gdt/kinematics/A8
tests/gdt/kinematics/A9
tests/gdt/kinematics/B1
tests/gdt/kinematics/B2
tests/gdt/kinematics/B3
tests/gdt/kinematics/B4
tests/gdt/kinematics/B5
tests/gdt/kinematics/B6
tests/gdt/kinematics/B7
tests/gdt/kinematics/B8
tests/gdt/kinematics/B9
tests/gdt/kinematics/C1

index 47c0fcf70f5dc189e0201195b1f18977af932f97..12ad93a1cd41b440e92b66d12681eb1211d3bfe6 100644 (file)
@@ -1,6 +1,6 @@
-// Created on: 2015-08-10
-// Created by: Irina KRYLOVA
-// Copyright (c) 2015 OPEN CASCADE SAS
+// Created on: 2020-05-26
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
index 562479e21eb9fde2fc3ef684ab784e52cb0bced7..aedd840d30a2143e8f92a4929e62cf099c32a0d3 100644 (file)
@@ -1,5 +1,5 @@
-// Created on: 2015-08-10
-// Created by: Irina KRYLOVA
+// Created on: 2020-05-26
+// Created by: PASUKHIN DMITRY
 // Copyright (c) 2015 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
index fed5c93f04247b8130f1a6ce2f8b38fc50013750..f6fd2a90a689a5b30f819da479d5ea9631e1bcb1 100644 (file)
@@ -1,6 +1,6 @@
-// Created on: 2016-04-26
-// Created by: Irina KRYLOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
+// Created on: 2020-06-18
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
index 73660d32239565a25fa9c8e3ba20093a9883e235..c227966a048e53c25c1d36128b15dc3f1cb6b799 100644 (file)
@@ -1,7 +1,6 @@
-// Created on: 2016-04-26
-// Created on: 2016-04-26
-// Created by: Irina KRYLOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
+// Created on: 2020-06-18
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
index a9a8b2fd15bda264bcefcfb6cb934d51ad8ca74e..1a3a03ad0f6d1580daa625b4c71ae3fe2e7aec4f 100644 (file)
@@ -61,7 +61,24 @@ void RWStepKinematics_RWPointOnPlanarCurvePairValue::ReadStep (const Handle(Step
   data->ReadEntity (num, 3, "actual_point_on_curve", ach, STANDARD_TYPE(StepGeom_PointOnCurve), aActualPointOnCurve);
 
   StepKinematics_SpatialRotation aInputOrientation;
-  data->ReadEntity (num, 4, "input_orientation", ach, aInputOrientation);
+  if (data->SubListNumber(num, 4, Standard_True))
+  {
+    Handle(TColStd_HArray1OfReal) aItems;
+    Standard_Integer nsub = 0;
+    if (data->ReadSubList(num, 4, "items", ach, nsub)) {
+      Standard_Integer nb = data->NbParams(nsub);
+      aItems = new TColStd_HArray1OfReal(1, nb);
+      Standard_Integer num2 = nsub;
+      for (Standard_Integer i0 = 1; i0 <= nb; i0++) {
+        Standard_Real anIt0;
+        data->ReadReal(num2, i0, "real", ach, anIt0);
+        aItems->SetValue(i0, anIt0);
+      }
+    }
+    aInputOrientation.SetValue(aItems);
+  }
+  else
+    data->ReadEntity(num, 4, "input_orientation", ach, aInputOrientation);
 
   // Initialize entity
   ent->Init(aRepresentationItem_Name,
@@ -91,7 +108,17 @@ void RWStepKinematics_RWPointOnPlanarCurvePairValue::WriteStep (StepData_StepWri
 
   SW.Send (ent->ActualPointOnCurve());
 
-  SW.Send (ent->InputOrientation().Value());
+  if (!ent->InputOrientation().YprRotation().IsNull())
+  {
+    // Inherited field : YPR
+    SW.OpenSub();
+    for (Standard_Integer i = 1; i <= ent->InputOrientation().YprRotation()->Length(); i++) {
+      SW.Send(ent->InputOrientation().YprRotation()->Value(i));
+    }
+    SW.CloseSub();
+  }
+  else
+    SW.Send(ent->InputOrientation().Value());
 }
 
 //=======================================================================
@@ -113,5 +140,6 @@ void RWStepKinematics_RWPointOnPlanarCurvePairValue::Share (const Handle(StepKin
 
   iter.AddItem (ent->ActualPointOnCurve());
 
-  iter.AddItem (ent->InputOrientation().Value());
+  if (!ent->InputOrientation().RotationAboutDirection().IsNull())
+    iter.AddItem(ent->InputOrientation().Value());
 }
index b1ccd248e2bda3d8ac73c4cf7652c893ff483fe4..62aac2133a0b654b2d050968d9aa9055750840c0 100644 (file)
@@ -61,7 +61,24 @@ void RWStepKinematics_RWPointOnSurfacePairValue::ReadStep (const Handle(StepData
   data->ReadEntity (num, 3, "actual_point_on_surface", ach, STANDARD_TYPE(StepGeom_PointOnSurface), aActualPointOnSurface);
 
   StepKinematics_SpatialRotation aInputOrientation;
-  data->ReadEntity (num, 4, "input_orientation", ach, aInputOrientation);
+  if (data->SubListNumber(num, 4, Standard_True))
+  {
+    Handle(TColStd_HArray1OfReal) aItems;
+    Standard_Integer nsub = 0;
+    if (data->ReadSubList(num, 4, "items", ach, nsub)) {
+      Standard_Integer nb = data->NbParams(nsub);
+      aItems = new TColStd_HArray1OfReal(1, nb);
+      Standard_Integer num2 = nsub;
+      for (Standard_Integer i0 = 1; i0 <= nb; i0++) {
+        Standard_Real anIt0;
+        data->ReadReal(num2, i0, "real", ach, anIt0);
+        aItems->SetValue(i0, anIt0);
+      }
+    }
+    aInputOrientation.SetValue(aItems);
+  }
+  else
+    data->ReadEntity(num, 4, "input_orientation", ach, aInputOrientation);
 
   // Initialize entity
   ent->Init(aRepresentationItem_Name,
@@ -91,7 +108,17 @@ void RWStepKinematics_RWPointOnSurfacePairValue::WriteStep (StepData_StepWriter&
 
   SW.Send (ent->ActualPointOnSurface());
 
-  SW.Send (ent->InputOrientation().Value());
+  if (!ent->InputOrientation().YprRotation().IsNull())
+  {
+    // Inherited field : YPR
+    SW.OpenSub();
+    for (Standard_Integer i = 1; i <= ent->InputOrientation().YprRotation()->Length(); i++) {
+      SW.Send(ent->InputOrientation().YprRotation()->Value(i));
+    }
+    SW.CloseSub();
+  }
+  else
+    SW.Send(ent->InputOrientation().Value());
 }
 
 //=======================================================================
@@ -113,5 +140,6 @@ void RWStepKinematics_RWPointOnSurfacePairValue::Share (const Handle(StepKinemat
 
   iter.AddItem (ent->ActualPointOnSurface());
 
-  iter.AddItem (ent->InputOrientation().Value());
+  if (!ent->InputOrientation().RotationAboutDirection().IsNull())
+    iter.AddItem(ent->InputOrientation().Value());
 }
index b4399770fce63980f719fac154764fb5a3d1261d..dd3de9f750bf06968e3926ea07a8e335bc1c0956 100644 (file)
@@ -54,10 +54,27 @@ void RWStepKinematics_RWSphericalPairValue::ReadStep (const Handle(StepData_Step
   Handle(StepKinematics_KinematicPair) aPairValue_AppliesToPair;
   data->ReadEntity (num, 2, "pair_value.applies_to_pair", ach, STANDARD_TYPE(StepKinematics_KinematicPair), aPairValue_AppliesToPair);
 
-  // Own fields of SphericalPairValue
 
+  // Own fields of SphericalPairValue
   StepKinematics_SpatialRotation aInputOrientation;
-  data->ReadEntity (num, 3, "input_orientation", ach, aInputOrientation);
+  if (data->SubListNumber(num, 3, Standard_True))
+  {
+    Handle(TColStd_HArray1OfReal) aItems;
+    Standard_Integer nsub = 0;
+    if (data->ReadSubList(num, 3, "items", ach, nsub)) {
+      Standard_Integer nb = data->NbParams(nsub);
+      aItems = new TColStd_HArray1OfReal(1, nb);
+      Standard_Integer num2 = nsub;
+      for (Standard_Integer i0 = 1; i0 <= nb; i0++) {
+        Standard_Real anIt0;
+        data->ReadReal(num2, i0, "real", ach, anIt0);
+        aItems->SetValue(i0, anIt0);
+      }
+    }
+    aInputOrientation.SetValue(aItems);
+  }
+  else 
+    data->ReadEntity (num, 3, "input_orientation", ach, aInputOrientation);
 
   // Initialize entity
   ent->Init(aRepresentationItem_Name,
@@ -70,21 +87,31 @@ void RWStepKinematics_RWSphericalPairValue::ReadStep (const Handle(StepData_Step
 //purpose  : 
 //=======================================================================
 
-void RWStepKinematics_RWSphericalPairValue::WriteStep (StepData_StepWriter& SW,
-                                                       const Handle(StepKinematics_SphericalPairValue)& ent) const
+void RWStepKinematics_RWSphericalPairValue::WriteStep(StepData_StepWriter& SW,
+  const Handle(StepKinematics_SphericalPairValue)& ent) const
 {
 
   // Own fields of RepresentationItem
 
-  SW.Send (ent->Name());
+  SW.Send(ent->Name());
 
   // Own fields of PairValue
 
-  SW.Send (ent->AppliesToPair());
+  SW.Send(ent->AppliesToPair());
 
   // Own fields of SphericalPairValue
 
-  SW.Send (ent->InputOrientation().Value());
+  if (!ent->InputOrientation().YprRotation().IsNull())
+  {
+    // Inherited field : YPR
+    SW.OpenSub();
+    for (Standard_Integer i = 1; i <= ent->InputOrientation().YprRotation()->Length(); i++) {
+      SW.Send(ent->InputOrientation().YprRotation()->Value(i));
+    }
+    SW.CloseSub();
+  }
+  else
+    SW.Send(ent->InputOrientation().Value());
 }
 
 //=======================================================================
@@ -104,5 +131,6 @@ void RWStepKinematics_RWSphericalPairValue::Share (const Handle(StepKinematics_S
 
   // Own fields of SphericalPairValue
 
-  iter.AddItem (ent->InputOrientation().Value());
+  if (!ent->InputOrientation().RotationAboutDirection().IsNull())
+    iter.AddItem(ent->InputOrientation().Value());
 }
index 144c1d8e6d5b1387049d34b91ac9ea4ebda4b7ce..fe7a6c29232b14efbeca262c9f27644cec3c7f93 100644 (file)
@@ -4327,7 +4327,8 @@ Standard_Boolean addLinksWithShapes(const Handle(XSControl_WorkSession)& theWS,
   const TDF_Label& aMechanism,
   TColStd_SequenceOfTransient& aCollOfLinks,
   TDF_LabelSequence& aSeqOfLinksL,
-  const XCAFDoc_DataMapOfShapeLabel& aMap)
+  const XCAFDoc_DataMapOfShapeLabel& aMap,
+  const Standard_Boolean& IsBase = Standard_False)
 {
   Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
   Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
@@ -4362,10 +4363,10 @@ Standard_Boolean addLinksWithShapes(const Handle(XSControl_WorkSession)& theWS,
   {
     aCDKLR = Handle(StepKinematics_ContextDependentKinematicLinkRepresentation)::DownCast(entIt.Value());
   }
-  Handle(StepRepr_NextAssemblyUsageOccurrence) aNAUO =
-    Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(aCDKLR->RepresentedProductRelation()->Definition().Value());
+  Handle(StepRepr_PropertyDefinition) aPD =
+    Handle(StepRepr_PropertyDefinition)::DownCast(aCDKLR->RepresentedProductRelation());
   TDF_Label aShapeLabel;
-  Handle(Transfer_Binder) binder = aTP->Find(aNAUO);
+  Handle(Transfer_Binder) binder = aTP->Find(aPD->Definition().Value());
   TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, binder);
   if (aShape.IsNull())
     return Standard_False;
@@ -4377,7 +4378,7 @@ Standard_Boolean addLinksWithShapes(const Handle(XSControl_WorkSession)& theWS,
   if (aShapes.Length() == 0)
     return Standard_False;
 
-  theLink = aKTool->AddLink(aMechanism, aShapes);
+  theLink = aKTool->AddLink(aMechanism, aShapes, IsBase);
   if (!aLink->Name()->IsEmpty())
     TDataStd_Name::Set(theLink, aLink->Name()->String());
 
@@ -4415,7 +4416,8 @@ XCAFKinematics_PairType getKinematicType(const Handle(StepKinematics_KinematicPa
     return XCAFKinematics_PairType_Spherical; 
   if (aKP->IsKind(STANDARD_TYPE(StepKinematics_PlanarPair)))
     return XCAFKinematics_PairType_Planar; 
-  if (aKP->IsKind(STANDARD_TYPE(StepKinematics_UnconstrainedPair)))
+  if (aKP->IsKind(STANDARD_TYPE(StepKinematics_UnconstrainedPair)) ||
+    aKP->IsKind(STANDARD_TYPE(StepKinematics_LowOrderKinematicPairWithRange)))
     return XCAFKinematics_PairType_Unconstrained;
 
     // Low order pairs with motion coupling
@@ -4518,7 +4520,7 @@ Standard_Boolean setKinematicPairLimits(Handle(XCAFKinematics_PairObject)& aKine
       anObj->SetMaxTranslationY(aPlanarPairWithRange->UpperLimitActualTranslationY());
       anObj->SetMinTranslationY(aPlanarPairWithRange->LowerLimitActualTranslationY());
     }
-    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_UnconstrainedPair)))// three rotation and three translation DOF
+    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_LowOrderKinematicPairWithRange))) // three rotation and three translation DOF
     {
       Handle(StepKinematics_LowOrderKinematicPairWithRange) anUnconstrainedPair = Handle(StepKinematics_LowOrderKinematicPairWithRange)::DownCast(aKP);
       anObj->SetMaxRotationX(anUnconstrainedPair->UpperLimitActualRotationX());
@@ -4539,8 +4541,7 @@ Standard_Boolean setKinematicPairLimits(Handle(XCAFKinematics_PairObject)& aKine
   // Low order pairs with motion coupling
   else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_LowOrderKinematicPairWithMotionCoupling))) 
   {
-    Handle(XCAFKinematics_LowOrderPairObjectWithCoupling) anObj = Handle(XCAFKinematics_LowOrderPairObjectWithCoupling)::DownCast(aKinematicPairObj);//new XCAFKinematics_LowOrderPairObjectWithCoupling;
-    anObj->SetType(getKinematicType(aKP));
+    Handle(XCAFKinematics_LowOrderPairObjectWithCoupling) anObj = Handle(XCAFKinematics_LowOrderPairObjectWithCoupling)::DownCast(aKinematicPairObj);
     if (aKP->IsKind(STANDARD_TYPE(StepKinematics_ScrewPairWithRange)))
     {
       Handle(StepKinematics_ScrewPairWithRange) aScrewPairWithRange = Handle(StepKinematics_ScrewPairWithRange)::DownCast(aKP);
@@ -4559,18 +4560,12 @@ Standard_Boolean setKinematicPairLimits(Handle(XCAFKinematics_PairObject)& aKine
       anObj->SetLowLimit(aGearPairWithRange->LowerLimitActualRotation1());
       anObj->SetUpperLimit(aGearPairWithRange->UpperLimitActualRotation1());
     }
-    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_LinearFlexibleAndPinionPair)))
-    {
-      Handle(StepKinematics_LinearFlexibleAndPinionPair) aLinearFlexibleAndPinionPair = Handle(StepKinematics_LinearFlexibleAndPinionPair)::DownCast(aKP);
-      anObj->SetPinionRadius(aLinearFlexibleAndPinionPair->PinionRadius());
-    }
     return Standard_True;
   }
   // High order pairs
   else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_HighOrderKinematicPair))) 
   {
   Handle(XCAFKinematics_HighOrderPairObject) anObj = Handle(XCAFKinematics_HighOrderPairObject)::DownCast(aKinematicPairObj);//new XCAFKinematics_HighOrderPairObject;
-    anObj->SetType(getKinematicType(aKP));
     if (aKP->IsKind(STANDARD_TYPE(StepKinematics_PointOnSurfacePairWithRange)))
     {
       Handle(StepKinematics_PointOnSurfacePairWithRange) aPointOnSurfacePairWithRange = Handle(StepKinematics_PointOnSurfacePairWithRange)::DownCast(aKP);
@@ -4580,15 +4575,7 @@ Standard_Boolean setKinematicPairLimits(Handle(XCAFKinematics_PairObject)& aKine
       anObj->SetUpperLimitPitch(aPointOnSurfacePairWithRange->UpperLimitPitch());
       anObj->SetLowLimitRoll(aPointOnSurfacePairWithRange->LowerLimitRoll());
       anObj->SetUpperLimitRoll(aPointOnSurfacePairWithRange->UpperLimitRoll());
-      anObj->SetSurface(StepToGeom::MakeSurface(aPointOnSurfacePairWithRange->RangeOnPairSurface()));
-    }
-    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_SurfacePairWithRange)))
-    {
-      Handle(StepKinematics_SurfacePairWithRange) aSurfacePairWithRange = Handle(StepKinematics_SurfacePairWithRange)::DownCast(aKP);
-      anObj->SetRotationLowLimit(aSurfacePairWithRange->LowerLimitActualRotation());
-      anObj->SetRotationUpperLimit(aSurfacePairWithRange->UpperLimitActualRotation());
-      anObj->SetFirstSurface(StepToGeom::MakeSurface(aSurfacePairWithRange->RangeOnSurface1()));
-      anObj->SetSecondSurface(StepToGeom::MakeSurface(aSurfacePairWithRange->RangeOnSurface2()));
+      anObj->SetTrimmedSurface(StepToGeom::MakeRectangularTrimmedSurface(aPointOnSurfacePairWithRange->RangeOnPairSurface()));
     }
     else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_PointOnPlanarCurvePairWithRange)))
     {
@@ -4599,8 +4586,7 @@ Standard_Boolean setKinematicPairLimits(Handle(XCAFKinematics_PairObject)& aKine
       anObj->SetUpperLimitPitch(aPointOnPlanarCurvePairWithRange->UpperLimitPitch());
       anObj->SetLowLimitRoll(aPointOnPlanarCurvePairWithRange->LowerLimitRoll());
       anObj->SetUpperLimitRoll(aPointOnPlanarCurvePairWithRange->UpperLimitRoll());
-      anObj->SetCurve(StepToGeom::MakeCurve(aPointOnPlanarCurvePairWithRange->RangeOnPairCurve()));
-
+      anObj->SetTrimmedCurve(StepToGeom::MakeTrimmedCurve(aPointOnPlanarCurvePairWithRange->RangeOnPairCurve()));
     }
     else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_PlanarCurvePairRange)))
     {
@@ -4608,12 +4594,6 @@ Standard_Boolean setKinematicPairLimits(Handle(XCAFKinematics_PairObject)& aKine
       anObj->SetFirstCurve(StepToGeom::MakeCurve(aPlanarCurvePairRange->RangeOnCurve1()));
       anObj->SetSecondCurve(StepToGeom::MakeCurve(aPlanarCurvePairRange->RangeOnCurve2()));
     }
-    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_LinearFlexibleAndPlanarCurvePair)))
-    {
-      Handle(StepKinematics_LinearFlexibleAndPlanarCurvePair) aLinearFlexibleAndPlanarCurvePair = Handle(StepKinematics_LinearFlexibleAndPlanarCurvePair)::DownCast(aKP);
-      anObj->SetOrientation(aLinearFlexibleAndPlanarCurvePair->Orientation());
-      anObj->SetCurve(StepToGeom::MakeCurve(aLinearFlexibleAndPlanarCurvePair->PairCurve()));
-    }
     return Standard_True;
   }
   return Standard_False;
@@ -4681,12 +4661,33 @@ Handle(XCAFKinematics_PairObject) createXCAFKinematicPairObject(const Handle(Ste
       Handle(StepKinematics_PointOnSurfacePair) aPointOnSurfacePair = Handle(StepKinematics_PointOnSurfacePair)::DownCast(aKP);
       aHighOrderPairObject->SetSurface(StepToGeom::MakeSurface(aPointOnSurfacePair->PairSurface()));
     }
-    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_SurfacePair)))
+    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_RollingSurfacePair)))
+    {
+      Handle(StepKinematics_RollingSurfacePair) aRollingSurfacePair = Handle(StepKinematics_RollingSurfacePair)::DownCast(aKP);
+      aHighOrderPairObject->SetFirstSurface(StepToGeom::MakeSurface(aRollingSurfacePair->Surface1()));
+      aHighOrderPairObject->SetSecondSurface(StepToGeom::MakeSurface(aRollingSurfacePair->Surface2()));
+      aHighOrderPairObject->SetOrientation(aRollingSurfacePair->Orientation());
+    }
+    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_SlidingSurfacePair)))
+    {
+      Handle(StepKinematics_SlidingSurfacePair) aSlidingSurfacePair = Handle(StepKinematics_SlidingSurfacePair)::DownCast(aKP);
+      aHighOrderPairObject->SetFirstSurface(StepToGeom::MakeSurface(aSlidingSurfacePair->Surface1()));
+      aHighOrderPairObject->SetSecondSurface(StepToGeom::MakeSurface(aSlidingSurfacePair->Surface2()));
+      aHighOrderPairObject->SetOrientation(aSlidingSurfacePair->Orientation());
+    }
+    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_SlidingCurvePair)))
+    {
+      Handle(StepKinematics_SlidingCurvePair) aSlidingCurvePair = Handle(StepKinematics_SlidingCurvePair)::DownCast(aKP);
+      aHighOrderPairObject->SetFirstCurve(StepToGeom::MakeCurve(aSlidingCurvePair->Curve1()));
+      aHighOrderPairObject->SetSecondCurve(StepToGeom::MakeCurve(aSlidingCurvePair->Curve2()));
+      aHighOrderPairObject->SetOrientation(aSlidingCurvePair->Orientation());
+    }
+    else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_RollingCurvePair)))
     {
-      Handle(StepKinematics_SurfacePair) aSurfacePair = Handle(StepKinematics_SurfacePair)::DownCast(aKP);
-      aHighOrderPairObject->SetFirstSurface(StepToGeom::MakeSurface(aSurfacePair->Surface1()));
-      aHighOrderPairObject->SetSecondSurface(StepToGeom::MakeSurface(aSurfacePair->Surface2()));
-      aHighOrderPairObject->SetOrientation(aSurfacePair->Orientation());
+      Handle(StepKinematics_RollingCurvePair) aRollingCurvePair = Handle(StepKinematics_RollingCurvePair)::DownCast(aKP);
+      aHighOrderPairObject->SetFirstCurve(StepToGeom::MakeCurve(aRollingCurvePair->Curve1()));
+      aHighOrderPairObject->SetSecondCurve(StepToGeom::MakeCurve(aRollingCurvePair->Curve2()));
+      aHighOrderPairObject->SetOrientation(aRollingCurvePair->Orientation());
     }
     else if (aKP->IsKind(STANDARD_TYPE(StepKinematics_PointOnPlanarCurvePair)))
     {
@@ -4751,6 +4752,8 @@ Standard_Boolean setKinematicPairValue(const Handle(XSControl_WorkSession)& theW
   aValueObject = new XCAFKinematics_PairValueObject();
   aValueObject->SetType(aType);
 
+  if (aType == 0)
+    return Standard_False;
   TDF_TagSource aTag;
   TDF_Label aValueL = aTag.NewChild(aState);
 
@@ -4854,6 +4857,8 @@ Standard_Boolean setKinematicPairValue(const Handle(XSControl_WorkSession)& theW
   }
   else
     return Standard_False;
+  if (aValueObject->GetAllValues().IsNull())
+    return Standard_False;
   Handle(XCAFDoc_KinematicPairValue) aCAFKinematicPairValue = XCAFDoc_KinematicPairValue::Set(aValueL, aJoint);
   aCAFKinematicPairValue->SetObject(aValueObject);
   if (!aValue->Name()->IsEmpty())
@@ -5125,7 +5130,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadKinematics(const Handle(XSControl_Wo
     if (!aKPMR->Base().IsNull())
     {
       TDF_Label aLableOfBaseLink;
-      addLinksWithShapes(theWS, theDoc, aKPMR->Base(), aLableOfBaseLink,aMechanism, aCollOfLinks, aSeqOfLinksL, aShapeLabelMap);
+      addLinksWithShapes(theWS, theDoc, aKPMR->Base(), aLableOfBaseLink, aMechanism, aCollOfLinks, aSeqOfLinksL, aShapeLabelMap, Standard_True);
     }
 
     for (Standard_Integer aPairIndex = 1; aPairIndex <= aKMR->NbItems(); ++aPairIndex)
index 5de3d3146e420ea4ecd14d9db68ecd99ca23cbc3..3a577547c8b46e6994034aa70142539999fd0686 100644 (file)
@@ -22,7 +22,9 @@
 
 #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 <StepVisual_SurfaceStyleUsage.hxx>
 #include <StepVisual_TessellatedAnnotationOccurrence.hxx>
 #include <StepVisual_TessellatedGeometricSet.hxx>
-//
-//
-//
+
 #include <StepKinematics_KinematicJoint.hxx>
 #include <StepKinematics_KinematicLink.hxx>
 #include <StepKinematics_PairValue.hxx>
 #include <TDF_Label.hxx>
 #include <TDF_LabelSequence.hxx>
 #include <TDF_Tool.hxx>
+#include <TDataStd_Integer.hxx>
 #include <TDocStd_Document.hxx>
 #include <TopoDS_Compound.hxx>
 #include <TopoDS_Iterator.hxx>
@@ -387,7 +388,7 @@ STEPCAFControl_Writer::STEPCAFControl_Writer () :
        mySHUOMode ( Standard_True ),
        myGDTMode  ( Standard_True ),
        myMatMode  ( Standard_True ),
-       myKPairMode( Standard_True )
+       myKinematicMode( Standard_True )
 {
   STEPCAFControl_Controller::Init();
   Handle(XSControl_WorkSession) WS = new XSControl_WorkSession;
@@ -409,7 +410,7 @@ STEPCAFControl_Writer::STEPCAFControl_Writer (const Handle(XSControl_WorkSession
   mySHUOMode(Standard_True),
   myGDTMode(Standard_True),
   myMatMode(Standard_True),
-  myKPairMode(Standard_True)
+  myKinematicMode(Standard_True)
 {
   STEPCAFControl_Controller::Init();
   Init ( WS, scratch );
@@ -1868,33 +1869,6 @@ static Standard_Boolean getProDefinitionOfNAUO(const Handle(XSControl_WorkSessio
   return Standard_True;
 }
 
-//=======================================================================
-//function : getProDefinitionOfNAUO
-//purpose  : auxilary
-//=======================================================================
-static Standard_Boolean getProDefi(const Handle(XSControl_WorkSession)& WS,
-  const TopoDS_Shape& theShape,
-  Handle(StepRepr_ProductDefinitionShape)& PD)
-{
-  if (theShape.IsNull())
-    return Standard_False;
-  // get CDSR
-  const Handle(XSControl_TransferWriter)& TW = WS->TransferWriter();
-  const Handle(Transfer_FinderProcess)& FP = TW->FinderProcess();
-  Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
-  Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper(FP, theShape);
-  if (!FP->FindTypedTransient(mapper,
-    STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation),
-    CDSR))
-    return Standard_False;
-  // get PDS of NAUO
-  Handle(StepRepr_ProductDefinitionShape) PDS = CDSR->RepresentedProductRelation();
-  if (PDS.IsNull())
-    return Standard_False;
-  PD = PDS;
-  return Standard_True;
-}
-
 
 //=======================================================================
 //function : writeSHUO
@@ -2223,6 +2197,38 @@ Standard_Boolean STEPCAFControl_Writer::WriteSHUOs (const Handle(XSControl_WorkS
   return Standard_True;
 }
 
+//=======================================================================
+//function : MakeTrimmedCurve
+//purpose  : auxilary
+//=======================================================================
+static Handle(StepGeom_TrimmedCurve) MakeTrimmedCurve(const Handle(StepGeom_Curve)& C,
+  const Handle(Geom_TrimmedCurve) TC,
+  Standard_Boolean sense)
+{
+  Handle(StepGeom_HArray1OfTrimmingSelect) aSTS1 =
+    new StepGeom_HArray1OfTrimmingSelect(1, 2);
+  StepGeom_TrimmingSelect tSel;
+  GeomToStep_MakeCartesianPoint aMP1(TC->StartPoint());
+  tSel.SetValue(aMP1.Value());
+  aSTS1->SetValue(1, tSel);
+  tSel.SetParameterValue(TC->FirstParameter());
+  aSTS1->SetValue(2, tSel);
+
+  Handle(StepGeom_HArray1OfTrimmingSelect) aSTS2 =
+    new StepGeom_HArray1OfTrimmingSelect(1, 2);
+  GeomToStep_MakeCartesianPoint aMP2(TC->EndPoint());
+  tSel.SetValue(aMP2.Value());
+  aSTS2->SetValue(1, tSel);
+  tSel.SetParameterValue(TC->LastParameter());
+  aSTS2->SetValue(2, tSel);
+
+  Handle(TCollection_HAsciiString) empty =
+    new TCollection_HAsciiString("");
+  Handle(StepGeom_TrimmedCurve) pmsTC = new StepGeom_TrimmedCurve;
+  pmsTC->Init(empty, C, aSTS1, aSTS2, sense, StepGeom_tpParameter);
+  return pmsTC;
+}
+
 //=======================================================================
 //function : createKinematicLink
 //purpose  : auxilary
@@ -2233,7 +2239,7 @@ static Standard_Boolean createKinematicLink(const Handle(Transfer_FinderProcess)
   const Interface_Graph& aGraph,
   const TDF_Label& theLabelLink,
   Handle(StepShape_ShapeRepresentation)& aShapeRepr,
-  Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO)
+  Handle(StepRepr_PropertyDefinition)& aPDS)
 {
   theLink = new StepKinematics_KinematicLink;
 
@@ -2253,32 +2259,25 @@ static Standard_Boolean createKinematicLink(const Handle(Transfer_FinderProcess)
     FP->Messenger()->SendInfo() << "Warning: Cannot find RI for " << aTopoShapeStart.TShape()->DynamicType()->Name() << std::endl;
     return Standard_False;
   }
+
+  // get PDS of Shape
   Interface_EntityIterator anIter = aGraph.Sharings(seqRI.Value(1));
-  for (anIter.Start(); anIter.More() && aShapeRepr.IsNull(); anIter.Next())
-  {
+  for (anIter.Start(); anIter.More() && aPDS.IsNull(); anIter.Next()) {
     aShapeRepr = Handle(StepShape_ShapeRepresentation)::DownCast(anIter.Value());
-  }
-  Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
-  Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper(FP, aTopoShapeStart);
-  if (!FP->FindTypedTransient(mapper,
-    STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation),
-    CDSR))
-    return Standard_False;
-  // get PDS of NAUO
-  Handle(StepRepr_ProductDefinitionShape) PDS = CDSR->RepresentedProductRelation();
-  if (PDS.IsNull())
-    return Standard_False;
-  // get the NAUO entity
-  Interface_EntityIterator subs = aGraph.Shareds(PDS);
-  for (subs.Start(); subs.More(); subs.Next()) {
-    if (!subs.Value()->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence)))
+    if (aShapeRepr.IsNull())
       continue;
-    NAUO = Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(subs.Value());
-    break;
+    Interface_EntityIterator aSDRIt = aGraph.Sharings(aShapeRepr);
+    for (aSDRIt.Start(); aSDRIt.More() && aPDS.IsNull(); aSDRIt.Next()) {
+      Handle(StepShape_ShapeDefinitionRepresentation) aSDR =
+        Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSDRIt.Value());
+      if (aSDR.IsNull()) continue;
+       aPDS = aSDR->Definition().PropertyDefinition();
+      if (!aPDS.IsNull()) 
+        return Standard_True;
+    }
   }
-  if (NAUO.IsNull())
-    return Standard_False;
-  return Standard_True;
+
+  return Standard_False;
 }
 
 //=======================================================================
@@ -2317,11 +2316,15 @@ static Standard_Boolean createKinematicJoint(const Handle(Transfer_FinderProcess
     if (aSeqOfLinskL(aLinkInd) == aLinkStartL)
     {
       aRigLinkRepr1 = Handle(StepKinematics_RigidLinkRepresentation)::DownCast(aArrayOfRigidLinks->Value(aLinkInd));
+      if (aRigLinkRepr1.IsNull())
+        return Standard_False;
       aEdgeStart = aRigLinkRepr1->RepresentedLink();
     }
     else if (aSeqOfLinskL(aLinkInd) == aLinkEndL)
     {
       aRigLinkRepr2 = Handle(StepKinematics_RigidLinkRepresentation)::DownCast(aArrayOfRigidLinks->Value(aLinkInd));
+      if (aRigLinkRepr2.IsNull())
+        return Standard_False;
       aEdgeEnd = aRigLinkRepr2->RepresentedLink();
     }
   }
@@ -2466,14 +2469,14 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
       {
         aKinematicPair = new StepKinematics_UniversalPairWithRange;
         Handle(StepKinematics_UniversalPairWithRange) anUniversalPairWithRange = Handle(StepKinematics_UniversalPairWithRange)::DownCast(aKinematicPair);
-        Standard_Real aUpperLimitActualTranslationX = aLowOrderPairObj->MaxTranslationX();
-        Standard_Real aLowerLimitActualTranslationX = aLowOrderPairObj->MinTranslationX();
-        Standard_Real aUpperLimitActualTranslationZ = aLowOrderPairObj->MaxTranslationZ();
-        Standard_Real aLowerLimitActualTranslationZ = aLowOrderPairObj->MinTranslationZ();
+        Standard_Real aUpperLimitActualRotationX = aLowOrderPairObj->MaxRotationX();
+        Standard_Real aLowerLimitActualRotationX = aLowOrderPairObj->MinRotationX();
+        Standard_Real aUpperLimitActualRotationZ = aLowOrderPairObj->MaxRotationZ();
+        Standard_Real aLowerLimitActualRotationZ = aLowOrderPairObj->MinRotationZ();
         anUniversalPairWithRange->Init(aPairName, aPairName, hasDescription,
           aDescription, theTransformItem1, theTransformItem2, theJoint,
-          aTX, aTY, aTZ, aRX, aRY, aRZ, Standard_True, theUniversalPair_InputSkewAngle, Standard_True, aLowerLimitActualTranslationX, Standard_True,
-          aUpperLimitActualTranslationX, Standard_True, aLowerLimitActualTranslationZ, Standard_True, aUpperLimitActualTranslationZ);
+          aTX, aTY, aTZ, aRX, aRY, aRZ, Standard_True, theUniversalPair_InputSkewAngle, Standard_True, aLowerLimitActualRotationX, Standard_True,
+          aUpperLimitActualRotationX, Standard_True, aLowerLimitActualRotationZ, Standard_True, aUpperLimitActualRotationZ);
       }
       else
       {
@@ -2600,12 +2603,12 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
       Handle(StepKinematics_LowOrderKinematicPairWithRange) anUnconstrainedPairWithRange = Handle(StepKinematics_LowOrderKinematicPairWithRange)::DownCast(aKinematicPair);
       anUnconstrainedPairWithRange->Init(aPairName, aPairName, hasDescription,
         aDescription, theTransformItem1, theTransformItem2, theJoint,
-        aTX, aTY, aTZ, aRX, aRY, aRZ, Standard_True, aLowerLimitActualTranslationX, Standard_True, aUpperLimitActualTranslationX,
-        Standard_True, aLowerLimitActualTranslationY, Standard_True, aUpperLimitActualTranslationY,
-        Standard_True, aLowerLimitActualTranslationZ, Standard_True, aUpperLimitActualTranslationZ,
-        Standard_True, aLowerLimitActualRotationX, Standard_True, aUpperLimitActualRotationX,
+        aTX, aTY, aTZ, aRX, aRY, aRZ, Standard_True, aLowerLimitActualRotationX, Standard_True, aUpperLimitActualRotationX,
         Standard_True, aLowerLimitActualRotationY, Standard_True, aUpperLimitActualRotationY,
-        Standard_True, aLowerLimitActualRotationZ, Standard_True, aUpperLimitActualRotationZ);
+        Standard_True, aLowerLimitActualRotationZ, Standard_True, aUpperLimitActualRotationZ,
+        Standard_True, aLowerLimitActualTranslationX, Standard_True, aUpperLimitActualTranslationX,
+        Standard_True, aLowerLimitActualTranslationY, Standard_True, aUpperLimitActualTranslationY,
+        Standard_True, aLowerLimitActualTranslationZ, Standard_True, aUpperLimitActualTranslationZ);
       break;
     }
     case(XCAFKinematics_PairType_FullyConstrained):
@@ -2735,19 +2738,18 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     {
     case(XCAFKinematics_PairType_PointOnSurface):
     {
-      GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
-      Handle(StepGeom_Surface) aPairSurface = aMaker.Value();
       if (HasRange)
       {
-        return Standard_False;
+        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 aTrimSurface;
-        Handle(StepGeom_RectangularTrimmedSurface) aRangeOnPairSurface; /*= aHighOrderPairObject->Surface();*/
+        GeomToStep_MakeRectangularTrimmedSurface aMakerTrimmered(aHighOrderPairObject->TrimmedSurface());
+        Handle(StepGeom_RectangularTrimmedSurface) aRangeOnPairSurface = aMakerTrimmered.Value();
         aKinematicPair = new StepKinematics_PointOnSurfacePairWithRange;
         Handle(StepKinematics_PointOnSurfacePairWithRange) aPointOnSurfacePairWithRange = Handle(StepKinematics_PointOnSurfacePairWithRange)::DownCast(aKinematicPair);
         aPointOnSurfacePairWithRange->Init(aPairName, aPairName, hasDescription,
@@ -2757,6 +2759,8 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
       else
       {
         aKinematicPair = new StepKinematics_PointOnSurfacePair;
+        GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
+        Handle(StepGeom_Surface) aPairSurface = aMaker.Value();
         Handle(StepKinematics_PointOnSurfacePair) aPointOnSurface = Handle(StepKinematics_PointOnSurfacePair)::DownCast(aKinematicPair);
         aPointOnSurface->Init(aPairName, aPairName, hasDescription,
           aDescription, theTransformItem1, theTransformItem2, theJoint,aPairSurface);
@@ -2766,9 +2770,9 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     case(XCAFKinematics_PairType_SlidingSurface):
     {
       aKinematicPair = new StepKinematics_SlidingSurfacePair;
-      GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
+      GeomToStep_MakeSurface aMaker(aHighOrderPairObject->FirstSurface());
       Handle(StepGeom_Surface) aPairSurfac1 = aMaker.Value();
-      GeomToStep_MakeSurface aMaker2(aHighOrderPairObject->Surface());
+      GeomToStep_MakeSurface aMaker2(aHighOrderPairObject->SecondSurface());
       Handle(StepGeom_Surface) aPairSurface2 = aMaker2.Value();
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
       Handle(StepKinematics_SlidingSurfacePair) aSlidingSurfacePair = Handle(StepKinematics_SlidingSurfacePair)::DownCast(aKinematicPair);
@@ -2779,9 +2783,9 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     case(XCAFKinematics_PairType_RollingSurface):
     {
       aKinematicPair = new StepKinematics_RollingSurfacePair;
-      GeomToStep_MakeSurface aMaker(aHighOrderPairObject->Surface());
+      GeomToStep_MakeSurface aMaker(aHighOrderPairObject->FirstSurface());
       Handle(StepGeom_Surface) aPairSurfac1 = aMaker.Value();
-      GeomToStep_MakeSurface aMaker2(aHighOrderPairObject->Surface());
+      GeomToStep_MakeSurface aMaker2(aHighOrderPairObject->SecondSurface());
       Handle(StepGeom_Surface) aPairSurface2 = aMaker2.Value();
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
       Handle(StepKinematics_RollingSurfacePair) aRollingSurfacePair = Handle(StepKinematics_RollingSurfacePair)::DownCast(aKinematicPair);
@@ -2796,14 +2800,14 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
       if (HasRange)
       {
-        return Standard_False;
         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(StepGeom_TrimmedCurve) aRangeOnPairCurve; /*= aHighOrderPairObject->Curve();*/
+        Standard_Real aUpperLimitRoll = aHighOrderPairObject->UpperLimitRoll(); 
+        Handle(Geom_TrimmedCurve) aRangeOnCurve = aHighOrderPairObject->TrimmedCurve();
+        Handle(StepGeom_TrimmedCurve) aRangeOnPairCurve = MakeTrimmedCurve(aPairCurve, aHighOrderPairObject->TrimmedCurve(), Standard_True);
         aKinematicPair = new StepKinematics_PointOnPlanarCurvePairWithRange;
         Handle(StepKinematics_PointOnPlanarCurvePairWithRange) aPointOnPlanarCurvePairWithRange = Handle(StepKinematics_PointOnPlanarCurvePairWithRange)::DownCast(aKinematicPair);
         aPointOnPlanarCurvePairWithRange->Init(aPairName, aPairName, hasDescription,
@@ -2821,10 +2825,10 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     }
     case(XCAFKinematics_PairType_SlidingCurve): 
     {
-      GeomToStep_MakeCurve aMaker(aHighOrderPairObject->Curve());
+      GeomToStep_MakeCurve aMaker(aHighOrderPairObject->FirstCurve());
       Handle(StepGeom_Curve) aPairCurve = aMaker.Value();
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
-      GeomToStep_MakeCurve aMaker2(aHighOrderPairObject->Curve());
+      GeomToStep_MakeCurve aMaker2(aHighOrderPairObject->SecondCurve());
       Handle(StepGeom_Curve) aPairCurve2 = aMaker2.Value();
       aKinematicPair = new StepKinematics_SlidingCurvePair;
       Handle(StepKinematics_SlidingCurvePair) aSlidingCurvePair = Handle(StepKinematics_SlidingCurvePair)::DownCast(aKinematicPair);
@@ -2834,10 +2838,10 @@ static Standard_Boolean createKinematicPair(const Handle(XCAFKinematics_PairObje
     }
     case(XCAFKinematics_PairType_RollingCurve):
     {
-      GeomToStep_MakeCurve aMaker(aHighOrderPairObject->Curve());
+      GeomToStep_MakeCurve aMaker(aHighOrderPairObject->FirstCurve());
       Handle(StepGeom_Curve) aPairCurve = aMaker.Value();
       Standard_Boolean anOrientation = aHighOrderPairObject->Orientation();
-      GeomToStep_MakeCurve aMaker2(aHighOrderPairObject->Curve());
+      GeomToStep_MakeCurve aMaker2(aHighOrderPairObject->SecondCurve());
       Handle(StepGeom_Curve) aPairCurve2 = aMaker2.Value();
       aKinematicPair = new StepKinematics_RollingCurvePair;
       Handle(StepKinematics_RollingCurvePair) aRollingCurvePair = Handle(StepKinematics_RollingCurvePair)::DownCast(aKinematicPair);
@@ -2879,7 +2883,7 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
   case(XCAFKinematics_PairType_Revolute):
   {
     aPairValue = new StepKinematics_RevolutePairValue;
-    Handle(StepKinematics_RevolutePairValue) aRevolutePairValue = 
+    Handle(StepKinematics_RevolutePairValue) aRevolutePairValue =
       Handle(StepKinematics_RevolutePairValue)::DownCast(aPairValue);
     aRevolutePairValue->SetActualRotation(aKinPairValueObj->GetRotation());
     break;
@@ -2887,7 +2891,7 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
   case(XCAFKinematics_PairType_Prismatic):
   {
     aPairValue = new StepKinematics_PrismaticPairValue;
-    Handle(StepKinematics_PrismaticPairValue) aPrismaticPairValue = 
+    Handle(StepKinematics_PrismaticPairValue) aPrismaticPairValue =
       Handle(StepKinematics_PrismaticPairValue)::DownCast(aPairValue);
     aPrismaticPairValue->SetActualTranslation(aKinPairValueObj->GetTranslation());
     break;
@@ -2895,7 +2899,7 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
   case(XCAFKinematics_PairType_Cylindrical):
   {
     aPairValue = new StepKinematics_CylindricalPairValue;
-    Handle(StepKinematics_CylindricalPairValue) aCylindricalPairValue = 
+    Handle(StepKinematics_CylindricalPairValue) aCylindricalPairValue =
       Handle(StepKinematics_CylindricalPairValue)::DownCast(aPairValue);
     aCylindricalPairValue->SetActualTranslation(aKinPairValueObj->GetTranslation());
     aCylindricalPairValue->SetActualRotation(aKinPairValueObj->GetRotation());
@@ -2904,7 +2908,16 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
   case(XCAFKinematics_PairType_Universal):
   {
     aPairValue = new StepKinematics_UniversalPairValue;
-    Handle(StepKinematics_UniversalPairValue) aUniversalPairValue = 
+    Handle(StepKinematics_UniversalPairValue) aUniversalPairValue =
+      Handle(StepKinematics_UniversalPairValue)::DownCast(aPairValue);
+    aUniversalPairValue->SetFirstRotationAngle(aKinPairValueObj->GetFirstRotation());
+    aUniversalPairValue->SetSecondRotationAngle(aKinPairValueObj->GetSecondRotation());
+    break;
+  }
+  case(XCAFKinematics_PairType_Homokinetic):
+  {
+    aPairValue = new StepKinematics_UniversalPairValue;
+    Handle(StepKinematics_UniversalPairValue) aUniversalPairValue =
       Handle(StepKinematics_UniversalPairValue)::DownCast(aPairValue);
     aUniversalPairValue->SetFirstRotationAngle(aKinPairValueObj->GetFirstRotation());
     aUniversalPairValue->SetSecondRotationAngle(aKinPairValueObj->GetSecondRotation());
@@ -2913,7 +2926,17 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
   case(XCAFKinematics_PairType_Spherical):
   {
     aPairValue = new StepKinematics_SphericalPairValue;
-    Handle(StepKinematics_SphericalPairValue) aSphericalPairValue = 
+    Handle(StepKinematics_SphericalPairValue) aSphericalPairValue =
+      Handle(StepKinematics_SphericalPairValue)::DownCast(aPairValue);
+    StepKinematics_SpatialRotation InputRotation;
+    InputRotation.SetValue(aKinPairValueObj->GetAllValues());
+    aSphericalPairValue->SetInputOrientation(InputRotation);
+    break;
+  }
+  case(XCAFKinematics_PairType_SphericalWithPin):
+  {
+    aPairValue = new StepKinematics_SphericalPairValue;
+    Handle(StepKinematics_SphericalPairValue) aSphericalPairValue =
       Handle(StepKinematics_SphericalPairValue)::DownCast(aPairValue);
     StepKinematics_SpatialRotation InputRotation;
     InputRotation.SetValue(aKinPairValueObj->GetAllValues());
@@ -2923,9 +2946,11 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
   case(XCAFKinematics_PairType_Planar):
   {
     aPairValue = new StepKinematics_PlanarPairValue;
-    Handle(StepKinematics_PrismaticPairValue) aPrismaticPairValue = 
-      Handle(StepKinematics_PrismaticPairValue)::DownCast(aPairValue);
-    aPrismaticPairValue->SetActualTranslation(aKinPairValueObj->GetTranslation());
+    Handle(StepKinematics_PlanarPairValue) aPlanarPairValue =
+      Handle(StepKinematics_PlanarPairValue)::DownCast(aPairValue);
+    aPlanarPairValue->SetActualRotation(aKinPairValueObj->GetRotation());
+    aPlanarPairValue->SetActualTranslationX(aKinPairValueObj->GetFirstTranslation());
+    aPlanarPairValue->SetActualTranslationY(aKinPairValueObj->GetSecondTranslation());
     break;
   }
   case(XCAFKinematics_PairType_Unconstrained):
@@ -2972,7 +2997,7 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
     Standard_Real theU;
     Standard_Real theV;
     aKinPairValueObj->GetPointOnSurface(theU, theV);
-    aActualPointOnSurface->Init(aPairValue->Name(), aPointOnSurfacePair->PairSurface(), theU, theV);
+    aActualPointOnSurface->Init(new TCollection_HAsciiString, aPointOnSurfacePair->PairSurface(), theU, theV);
     aPointOnSurfacePairValue->SetActualPointOnSurface(aActualPointOnSurface);
     StepKinematics_SpatialRotation aYRP;
     Handle(TColStd_HArray1OfReal) anArrayYRP = new TColStd_HArray1OfReal(1,3);
@@ -2998,14 +3023,15 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
     Standard_Real theU1;
     Standard_Real theV1;
     aKinPairValueObj->GetFirstPointOnSurface(theU1, theV1);
-    aActualPointOnSurface1->Init(aPairValue->Name(), SlidingSurfacePair->Surface1(), theU1, theV1);
+    aActualPointOnSurface1->Init(new TCollection_HAsciiString, SlidingSurfacePair->Surface1(), theU1, theV1);
     aSlidingSurfacePairValue->SetActualPointOnSurface1(aActualPointOnSurface1);
     Handle(StepGeom_PointOnSurface) aActualPointOnSurface2 = new StepGeom_PointOnSurface;
     Standard_Real theU2;
     Standard_Real theV2;
     aKinPairValueObj->GetSecondPointOnSurface(theU2, theV2);
-    aActualPointOnSurface2->Init(aPairValue->Name(), SlidingSurfacePair->Surface2(), theU2, theV2);
+    aActualPointOnSurface2->Init(new TCollection_HAsciiString, SlidingSurfacePair->Surface2(), theU2, theV2);
     aSlidingSurfacePairValue->SetActualPointOnSurface2(aActualPointOnSurface2);
+    aSlidingSurfacePairValue->SetActualRotation(aKinPairValueObj->GetRotation());
     break;
   }
   case(XCAFKinematics_PairType_RollingSurface):
@@ -3016,11 +3042,11 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
     aRollingSurfacePairValue->SetActualRotation(aKinPairValueObj->GetRotation());
     Handle(StepGeom_PointOnSurface) aActualPointOnSurface = new StepGeom_PointOnSurface;
     Handle(StepKinematics_RollingSurfacePair) aRollingSurfacePair =
-      Handle(StepKinematics_RollingSurfacePair)::DownCast(aPairReprRelationship->RepresentationRelationshipWithTransformation());
+      Handle(StepKinematics_RollingSurfacePair)::DownCast(aPairReprRelationship->RepresentationRelationshipWithTransformation()->TransformationOperator().KinematicPair());
     Standard_Real theU;
     Standard_Real theV;
     aKinPairValueObj->GetPointOnSurface(theU, theV);
-    aActualPointOnSurface->Init(aPairValue->Name(), aRollingSurfacePair->Surface1(), theU, theV);
+    aActualPointOnSurface->Init(new TCollection_HAsciiString, aRollingSurfacePair->Surface1(), theU, theV);
     aRollingSurfacePairValue->SetActualPointOnSurface(aActualPointOnSurface);
     break;
   }
@@ -3059,6 +3085,10 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
     Standard_Real aParametr1 = aKinPairValueObj->GetFirstPointOnCurve();
     anActualPointOnCurve1->Init(aSlidingCurvePair->Name(), aSlidingCurvePair->Curve1(), aParametr1);
     aSlidingCurvePairValue->SetActualPointOnCurve1(anActualPointOnCurve1);
+    Handle(StepGeom_PointOnCurve) anActualPointOnCurve2 = new StepGeom_PointOnCurve;
+    Standard_Real aParametr2 = aKinPairValueObj->GetSecondPointOnCurve();
+    anActualPointOnCurve2->Init(aSlidingCurvePair->Name(), aSlidingCurvePair->Curve2(), aParametr2);
+    aSlidingCurvePairValue->SetActualPointOnCurve2(anActualPointOnCurve2);
     break;
   }
   case(XCAFKinematics_PairType_RollingCurve):
@@ -3068,7 +3098,7 @@ static Standard_Boolean createKinematicPairValue(const Handle(XCAFKinematics_Pai
       Handle(StepKinematics_RollingCurvePairValue)::DownCast(aPairValue);
     Handle(StepGeom_PointOnCurve) anActualPointOnCurve = new StepGeom_PointOnCurve;
     Handle(StepKinematics_RollingCurvePair) aRollingCurvePair =
-      Handle(StepKinematics_RollingCurvePair)::DownCast(aPairReprRelationship->RepresentationRelationshipWithTransformation());
+      Handle(StepKinematics_RollingCurvePair)::DownCast(aPairReprRelationship->RepresentationRelationshipWithTransformation()->TransformationOperator().KinematicPair());
     Standard_Real aParametr = aKinPairValueObj->GetPointOnCurve();
     anActualPointOnCurve->Init(aRollingCurvePair->Name(), aRollingCurvePair->Curve1(), aParametr);
     aRollingCurvePairValue->SetActualPointOnCurve1(anActualPointOnCurve);
@@ -3115,7 +3145,7 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
   {
     //write Links
     Handle(StepKinematics_KinematicLinkRepresentation) aBaseLinksOfMech;
-    Handle(StepRepr_NextAssemblyUsageOccurrence) aGeneralNAUO;
+    Handle(StepRepr_PropertyDefinition) aGeneralDefinition;
 
     //containers storing Links and their labels located at a single index
     TDF_LabelSequence aSeqOfLinskL = aKTool->GetLinks(aMechanismsL.Value(aMechInd));
@@ -3128,22 +3158,26 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
       TDF_Label aLinkL = aSeqOfLinskL.Value(aLinkInd);
       Handle(StepKinematics_KinematicLink) aLink;
       Handle(StepShape_ShapeRepresentation) aRefShapeOfLink;
-      Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO;
-      createKinematicLink(FP, aKTool, aLink, aGraph, aLinkL, aRefShapeOfLink, NAUO);
+      Handle(StepRepr_PropertyDefinition) aPD;
+      if (!createKinematicLink(FP, aKTool, aLink, aGraph, aLinkL, aRefShapeOfLink, aPD))
+        continue;
       Handle(StepRepr_RepresentationContext) aRepresentationContextOfLink = aRefShapeOfLink->ContextOfItems();
       Handle(StepKinematics_RigidLinkRepresentation) aLinkRepresentation = new StepKinematics_RigidLinkRepresentation;
       Handle(TCollection_HAsciiString) aNameOfLinkRepr = new TCollection_HAsciiString("");
       Handle(StepRepr_HArray1OfRepresentationItem) aPlacementsOfPairs = new StepRepr_HArray1OfRepresentationItem;
       aLinkRepresentation->Init(aNameOfLinkRepr, aPlacementsOfPairs, aRepresentationContextOfLink, aLink);
       aArrayOfRigidLinks->SetValue(aLinkInd, aLinkRepresentation);
+
+      Handle(TDataStd_Integer) aBase;
+      if (aBaseLinksOfMech.IsNull() && aLinkL.FindAttribute(TDataStd_Integer::GetID(), aBase))
+        aBaseLinksOfMech = aLinkRepresentation;
+
       Handle(StepKinematics_KinematicLinkRepresentationAssociation) aLinkRepresentationAssociation = new StepKinematics_KinematicLinkRepresentationAssociation;
       aLinkRepresentationAssociation->Init(aNameOfLinkRepr, aNameOfLinkRepr, aRefShapeOfLink, aLinkRepresentation);
       Handle(StepKinematics_ContextDependentKinematicLinkRepresentation) aCDKLRS = new StepKinematics_ContextDependentKinematicLinkRepresentation;
       Handle(StepKinematics_ProductDefinitionRelationshipKinematics) aPDRK = new StepKinematics_ProductDefinitionRelationshipKinematics;
-      StepRepr_CharacterizedDefinition aDefinition;
-      aDefinition.SetValue(NAUO);
-      aGeneralNAUO = NAUO; //Work, but think out
-      aPDRK->Init(aNameOfLinkRepr, Standard_False, aLinkRepresentationAssociation->Description(), aDefinition);
+      aGeneralDefinition = aPD; //Work, but think out
+      aPDRK->Init(aNameOfLinkRepr, Standard_False, aLinkRepresentationAssociation->Description(), aPD->Definition());
       aCDKLRS->Init(aLinkRepresentationAssociation, aPDRK);
       Model->AddEntity(aLink);
       Model->AddEntity(aLinkRepresentation);
@@ -3151,8 +3185,11 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
       Model->AddEntity(aPDRK);
       Model->AddEntity(aCDKLRS);
     }
-    aBaseLinksOfMech = Handle(StepKinematics_KinematicLinkRepresentation)::DownCast(aArrayOfRigidLinks->Value(1));
+    if (aBaseLinksOfMech.IsNull())
+      aBaseLinksOfMech = Handle(StepKinematics_KinematicLinkRepresentation)::DownCast(aArrayOfRigidLinks->Value(1));
 
+    if (aGeneralDefinition.IsNull())
+      continue;
     //write joints
 
     //containers storing Joints and their labels located at a single index
@@ -3199,9 +3236,7 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
 
     //write mechanism
     Handle(StepKinematics_ProductDefinitionKinematics) aProductDefKin = new StepKinematics_ProductDefinitionKinematics;
-    StepRepr_CharacterizedDefinition aKinDefinition;
-    aKinDefinition.SetValue(aGeneralNAUO->RelatingProductDefinition());
-    aProductDefKin->Init(new TCollection_HAsciiString, Standard_False, new TCollection_HAsciiString, aKinDefinition);
+    aProductDefKin->Init(new TCollection_HAsciiString, Standard_False, new TCollection_HAsciiString, aGeneralDefinition->Definition());
     aKTopoStruct->Init(new TCollection_HAsciiString, anArrayOfPairs, aBaseLinksOfMech->ContextOfItems());
     StepKinematics_KinematicTopologyRepresentationSelect aTopoSelect;
     aTopoSelect.SetValue(aKTopoStruct);
@@ -3219,6 +3254,8 @@ Standard_EXPORT Standard_Boolean STEPCAFControl_Writer::WriteKinematics(const Ha
     {
       Handle(StepKinematics_MechanismStateRepresentation) aStateRepr = new StepKinematics_MechanismStateRepresentation;
       TDF_LabelSequence aSeqOfValues = aKTool->GetValuesOfState(aSeqOfStates(aStateInd));
+      if (aSeqOfValues.IsEmpty())
+        continue;
       Handle(StepRepr_HArray1OfRepresentationItem) aItems = new StepRepr_HArray1OfRepresentationItem(1, aSeqOfValues.Length());
       for (Standard_Integer aValueInd = 1; aValueInd <= aItems->Length(); ++aValueInd)
       {
@@ -4578,334 +4615,334 @@ void STEPCAFControl_Writer::WriteGeomTolerance (const Handle(XSControl_WorkSessi
 //function : WriteDGTs
 //purpose  : 
 //=======================================================================
-  Standard_Boolean STEPCAFControl_Writer::WriteDGTs (const Handle(XSControl_WorkSession) &WS,
-                                                     const TDF_LabelSequence  &labels ) const
-  {
+Standard_Boolean STEPCAFControl_Writer::WriteDGTs (const Handle(XSControl_WorkSession) &WS,
+                                                   const TDF_LabelSequence  &labels ) const
+{
   
-    if ( labels.Length() <=0 ) return Standard_False;
+  if ( labels.Length() <=0 ) return Standard_False;
   
-    // get working data
-    const Handle(Interface_InterfaceModel) &Model = WS->Model();
-    const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
-    const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+  // get working data
+  const Handle(Interface_InterfaceModel) &Model = WS->Model();
+  const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
+  const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
 
-    const Handle(Interface_HGraph) aHGraph = WS->HGraph();
-    if(aHGraph.IsNull())
-      return Standard_False;
+  const Handle(Interface_HGraph) aHGraph = WS->HGraph();
+  if(aHGraph.IsNull())
+    return Standard_False;
 
-    Interface_Graph aGraph = aHGraph->Graph();
-    Handle(XCAFDoc_DimTolTool) DGTTool = XCAFDoc_DocumentTool::DimTolTool( labels(1) );
-    if(DGTTool.IsNull() ) return Standard_False;
-
-    TDF_LabelSequence DGTLabels;
-
-    STEPConstruct_DataMapOfAsciiStringTransient DatumMap;
-
-    // write Datums
-    DGTLabels.Clear();
-    DGTTool->GetDatumLabels(DGTLabels);
-    if(DGTLabels.Length()<=0) return Standard_False;
-    Standard_Integer i;
-    for(i=1; i<=DGTLabels.Length(); i++) {
-      TDF_Label DatumL = DGTLabels.Value(i);
-      TDF_LabelSequence ShapeL;
-      TDF_LabelSequence aNullSeq;
-      if(!DGTTool->GetRefShapeLabel(DatumL,ShapeL,aNullSeq)) continue;
-      // find target shape
-      TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL.Value(1));
-      TopLoc_Location Loc;
-      TColStd_SequenceOfTransient seqRI;
-      FindEntities( FP, aShape, Loc, seqRI );
-      if ( seqRI.Length() <= 0 ) {
-        FP->Messenger()->SendInfo() << "Warning: Cannot find RI for "<<aShape.TShape()->DynamicType()->Name()<<std::endl;
-        continue;
-      }
-      Handle(StepRepr_ProductDefinitionShape) PDS;
-      Handle(StepRepr_RepresentationContext) RC;
-      Handle(Standard_Transient) ent = seqRI.Value(1);
-      Handle(StepShape_AdvancedFace) AF;
-      Handle(StepShape_EdgeCurve) EC;
-      FindPDSforDGT(aGraph,ent,PDS,RC,AF,EC);
-      if(PDS.IsNull()) continue;
-      //std::cout<<"Model->Number(PDS)="<<Model->Number(PDS)<<std::endl;
-      Handle(XCAFDoc_Datum) DatumAttr;
-      if(!DatumL.FindAttribute(XCAFDoc_Datum::GetID(),DatumAttr)) continue;
-      Handle(TCollection_HAsciiString) aName = DatumAttr->GetName();
-      Handle(TCollection_HAsciiString) aDescription = DatumAttr->GetDescription();
-      Handle(TCollection_HAsciiString) anIdentification = DatumAttr->GetIdentification();
-      Handle(StepDimTol_DatumFeature) DF = new StepDimTol_DatumFeature;
-      Handle(StepDimTol_Datum) aDatum = new StepDimTol_Datum;
-      DF->Init(aName, new TCollection_HAsciiString, PDS, StepData_LTrue);
-      Model->AddWithRefs(DF);
-      aDatum->Init(aName, new TCollection_HAsciiString, PDS, StepData_LFalse, anIdentification);
-      Model->AddWithRefs(aDatum);
-      Handle(StepRepr_ShapeAspectRelationship) SAR = new StepRepr_ShapeAspectRelationship;
-      SAR->SetName(aName);
-      SAR->SetRelatingShapeAspect(DF);
-      SAR->SetRelatedShapeAspect(aDatum);
-      Model->AddWithRefs(SAR);
-      // write chain for DatumFeature
-      StepRepr_CharacterizedDefinition CD;
-      CD.SetValue(DF);
-      Handle(StepRepr_PropertyDefinition) PropD = new StepRepr_PropertyDefinition;
-      PropD->Init(aName,Standard_True,aDescription,CD);
-      Model->AddWithRefs(PropD);
-      StepRepr_RepresentedDefinition RD;
-      RD.SetValue(PropD);
-      Handle(StepShape_ShapeRepresentation) SR = new StepShape_ShapeRepresentation;
-      Handle(StepRepr_HArray1OfRepresentationItem) HARI =
-        new StepRepr_HArray1OfRepresentationItem(1,1);
-      HARI->SetValue(1,AF);
-      SR->Init(aName,HARI,RC);
-      Handle(StepShape_ShapeDefinitionRepresentation) SDR = new StepShape_ShapeDefinitionRepresentation;
-      SDR->Init(RD,SR);
-      Model->AddWithRefs(SDR);
-      // write chain for Datum 
-      StepRepr_CharacterizedDefinition CD1;
-      CD1.SetValue(aDatum);
-      Handle(StepRepr_PropertyDefinition) PropD1 = new StepRepr_PropertyDefinition;
-      PropD1->Init(aName,Standard_True,aDescription,CD1);
-      Model->AddWithRefs(PropD1);
-      StepRepr_RepresentedDefinition RD1;
-      RD1.SetValue(PropD1);
-      Handle(StepShape_ShapeRepresentation) SR1 = new StepShape_ShapeRepresentation;
-      Handle(StepRepr_HArray1OfRepresentationItem) HARI1 =
-        new StepRepr_HArray1OfRepresentationItem(1,1);
-      HARI1->SetValue(1,AF->FaceGeometry());
-      SR1->Init(aName,HARI1,RC);
-      Model->AddWithRefs(SR1);
-      Handle(StepShape_ShapeDefinitionRepresentation) SDR1 = new StepShape_ShapeDefinitionRepresentation;
-      SDR1->Init(RD1,SR1);
-      Model->AddWithRefs(SDR1);
-      // add created Datum into Map
-      TCollection_AsciiString stmp(aName->ToCString());
-      stmp.AssignCat(aDescription->ToCString());
-      stmp.AssignCat(anIdentification->ToCString());
-      DatumMap.Bind(stmp,aDatum);
+  Interface_Graph aGraph = aHGraph->Graph();
+  Handle(XCAFDoc_DimTolTool) DGTTool = XCAFDoc_DocumentTool::DimTolTool( labels(1) );
+  if(DGTTool.IsNull() ) return Standard_False;
+
+  TDF_LabelSequence DGTLabels;
+
+  STEPConstruct_DataMapOfAsciiStringTransient DatumMap;
+
+  // write Datums
+  DGTLabels.Clear();
+  DGTTool->GetDatumLabels(DGTLabels);
+  if(DGTLabels.Length()<=0) return Standard_False;
+  Standard_Integer i;
+  for(i=1; i<=DGTLabels.Length(); i++) {
+    TDF_Label DatumL = DGTLabels.Value(i);
+    TDF_LabelSequence ShapeL;
+    TDF_LabelSequence aNullSeq;
+    if(!DGTTool->GetRefShapeLabel(DatumL,ShapeL,aNullSeq)) continue;
+    // find target shape
+    TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL.Value(1));
+    TopLoc_Location Loc;
+    TColStd_SequenceOfTransient seqRI;
+    FindEntities( FP, aShape, Loc, seqRI );
+    if ( seqRI.Length() <= 0 ) {
+      FP->Messenger()->SendInfo() << "Warning: Cannot find RI for "<<aShape.TShape()->DynamicType()->Name()<<std::endl;
+      continue;
     }
+    Handle(StepRepr_ProductDefinitionShape) PDS;
+    Handle(StepRepr_RepresentationContext) RC;
+    Handle(Standard_Transient) ent = seqRI.Value(1);
+    Handle(StepShape_AdvancedFace) AF;
+    Handle(StepShape_EdgeCurve) EC;
+    FindPDSforDGT(aGraph,ent,PDS,RC,AF,EC);
+    if(PDS.IsNull()) continue;
+    //std::cout<<"Model->Number(PDS)="<<Model->Number(PDS)<<std::endl;
+    Handle(XCAFDoc_Datum) DatumAttr;
+    if(!DatumL.FindAttribute(XCAFDoc_Datum::GetID(),DatumAttr)) continue;
+    Handle(TCollection_HAsciiString) aName = DatumAttr->GetName();
+    Handle(TCollection_HAsciiString) aDescription = DatumAttr->GetDescription();
+    Handle(TCollection_HAsciiString) anIdentification = DatumAttr->GetIdentification();
+    Handle(StepDimTol_DatumFeature) DF = new StepDimTol_DatumFeature;
+    Handle(StepDimTol_Datum) aDatum = new StepDimTol_Datum;
+    DF->Init(aName, new TCollection_HAsciiString, PDS, StepData_LTrue);
+    Model->AddWithRefs(DF);
+    aDatum->Init(aName, new TCollection_HAsciiString, PDS, StepData_LFalse, anIdentification);
+    Model->AddWithRefs(aDatum);
+    Handle(StepRepr_ShapeAspectRelationship) SAR = new StepRepr_ShapeAspectRelationship;
+    SAR->SetName(aName);
+    SAR->SetRelatingShapeAspect(DF);
+    SAR->SetRelatedShapeAspect(aDatum);
+    Model->AddWithRefs(SAR);
+    // write chain for DatumFeature
+    StepRepr_CharacterizedDefinition CD;
+    CD.SetValue(DF);
+    Handle(StepRepr_PropertyDefinition) PropD = new StepRepr_PropertyDefinition;
+    PropD->Init(aName,Standard_True,aDescription,CD);
+    Model->AddWithRefs(PropD);
+    StepRepr_RepresentedDefinition RD;
+    RD.SetValue(PropD);
+    Handle(StepShape_ShapeRepresentation) SR = new StepShape_ShapeRepresentation;
+    Handle(StepRepr_HArray1OfRepresentationItem) HARI =
+      new StepRepr_HArray1OfRepresentationItem(1,1);
+    HARI->SetValue(1,AF);
+    SR->Init(aName,HARI,RC);
+    Handle(StepShape_ShapeDefinitionRepresentation) SDR = new StepShape_ShapeDefinitionRepresentation;
+    SDR->Init(RD,SR);
+    Model->AddWithRefs(SDR);
+    // write chain for Datum 
+    StepRepr_CharacterizedDefinition CD1;
+    CD1.SetValue(aDatum);
+    Handle(StepRepr_PropertyDefinition) PropD1 = new StepRepr_PropertyDefinition;
+    PropD1->Init(aName,Standard_True,aDescription,CD1);
+    Model->AddWithRefs(PropD1);
+    StepRepr_RepresentedDefinition RD1;
+    RD1.SetValue(PropD1);
+    Handle(StepShape_ShapeRepresentation) SR1 = new StepShape_ShapeRepresentation;
+    Handle(StepRepr_HArray1OfRepresentationItem) HARI1 =
+      new StepRepr_HArray1OfRepresentationItem(1,1);
+    HARI1->SetValue(1,AF->FaceGeometry());
+    SR1->Init(aName,HARI1,RC);
+    Model->AddWithRefs(SR1);
+    Handle(StepShape_ShapeDefinitionRepresentation) SDR1 = new StepShape_ShapeDefinitionRepresentation;
+    SDR1->Init(RD1,SR1);
+    Model->AddWithRefs(SDR1);
+    // add created Datum into Map
+    TCollection_AsciiString stmp(aName->ToCString());
+    stmp.AssignCat(aDescription->ToCString());
+    stmp.AssignCat(anIdentification->ToCString());
+    DatumMap.Bind(stmp,aDatum);
+  }
 
-    // write Tolerances and Dimensions
-    DGTLabels.Clear();
-    DGTTool->GetDimTolLabels(DGTLabels);
-    if(DGTLabels.Length()<=0) return Standard_False;
-    for(i=1; i<=DGTLabels.Length(); i++) {
-      TDF_Label DimTolL = DGTLabels.Value(i);
-      TDF_LabelSequence ShapeL;
-      TDF_LabelSequence aNullSeq;
-      if(!DGTTool->GetRefShapeLabel(DimTolL,ShapeL,aNullSeq)) continue;
-      // find target shape
-      TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL.Value(1));
-      TopLoc_Location Loc;
-      TColStd_SequenceOfTransient seqRI;
-      FindEntities( FP, aShape, Loc, seqRI );
-      if ( seqRI.Length() <= 0 ) {
-        FP->Messenger()->SendInfo() << "Warning: Cannot find RI for "<<aShape.TShape()->DynamicType()->Name()<<std::endl;
-        continue;
-      }
-      Handle(StepRepr_ProductDefinitionShape) PDS;
-      Handle(StepRepr_RepresentationContext) RC;
-      Handle(Standard_Transient) ent = seqRI.Value(1);
-      Handle(StepShape_AdvancedFace) AF;
-      Handle(StepShape_EdgeCurve) EC;
-      FindPDSforDGT(aGraph,ent,PDS,RC,AF,EC);
-      if(PDS.IsNull()) continue;
-      //std::cout<<"Model->Number(PDS)="<<Model->Number(PDS)<<std::endl;
-
-      Handle(XCAFDoc_DimTol) DimTolAttr;
-      if(!DimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),DimTolAttr)) continue;
-      Standard_Integer kind = DimTolAttr->GetKind();
-      Handle(TColStd_HArray1OfReal) aVal = DimTolAttr->GetVal();
-      Handle(TCollection_HAsciiString) aName = DimTolAttr->GetName();
-      Handle(TCollection_HAsciiString) aDescription = DimTolAttr->GetDescription();
-
-      // common part of writing D&GT entities
-      StepRepr_CharacterizedDefinition CD;
-      Handle(StepRepr_ShapeAspect) SA = new StepRepr_ShapeAspect;
-      SA->Init(aName, new TCollection_HAsciiString, PDS, StepData_LTrue);
-      Model->AddWithRefs(SA);
-      CD.SetValue(SA);
-      Handle(StepRepr_PropertyDefinition) PropD = new StepRepr_PropertyDefinition;
-      PropD->Init(aName,Standard_True,aDescription,CD);
-      Model->AddWithRefs(PropD);
-      StepRepr_RepresentedDefinition RD;
-      RD.SetValue(PropD);
-      Handle(StepShape_ShapeRepresentation) SR = new StepShape_ShapeRepresentation;
-      Handle(StepRepr_HArray1OfRepresentationItem) HARI =
-        new StepRepr_HArray1OfRepresentationItem(1,1);
-      if(kind<20) 
-        HARI->SetValue(1,EC);
-      else
-        HARI->SetValue(1,AF);
-      SR->Init(aName,HARI,RC);
-      Handle(StepShape_ShapeDefinitionRepresentation) SDR = new StepShape_ShapeDefinitionRepresentation;
-      SDR->Init(RD,SR);
-      Model->AddWithRefs(SDR);
-      // define aUnit for creation LengthMeasureWithUnit (common for all)
-      StepBasic_Unit aUnit;
-      aUnit = GetUnit(RC);
-
-      // specific part of writing D&GT entities
-      if(kind<20) { //dimension
-        Handle(StepShape_DimensionalSize) DimSize = new StepShape_DimensionalSize;
-        DimSize->Init(SA,aDescription);
-        Model->AddWithRefs(DimSize);
-        if(aVal->Length()>1) {
-          // create MeasureWithUnits
-          Handle(StepBasic_MeasureValueMember) MVM1 = new StepBasic_MeasureValueMember;
-          MVM1->SetName("POSITIVE_LENGTH_MEASURE");
-          MVM1->SetReal(aVal->Value(1));
-          Handle(StepBasic_MeasureWithUnit) MWU1 = new StepBasic_MeasureWithUnit;
-          MWU1->Init(MVM1,aUnit);
-          Handle(StepBasic_MeasureValueMember) MVM2 = new StepBasic_MeasureValueMember;
-          MVM2->SetName("POSITIVE_LENGTH_MEASURE");
-          MVM2->SetReal(aVal->Value(2));
-          Handle(StepBasic_MeasureWithUnit) MWU2 = new StepBasic_MeasureWithUnit;
-          MWU2->Init(MVM2,aUnit);
-          Handle(StepRepr_RepresentationItem) RI1 = new StepRepr_RepresentationItem;
-          RI1->Init(new TCollection_HAsciiString("lower limit"));
-          Handle(StepRepr_RepresentationItem) RI2 = new StepRepr_RepresentationItem;
-          RI2->Init(new TCollection_HAsciiString("upper limit"));
-          Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMU1 =
-            new StepRepr_ReprItemAndLengthMeasureWithUnit;
-          RILMU1->Init(MWU1,RI1);
-          Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMU2 =
-            new StepRepr_ReprItemAndLengthMeasureWithUnit;
-          RILMU2->Init(MWU2,RI2);
-          Model->AddWithRefs(RILMU1);
-          Model->AddWithRefs(RILMU2);
-          //Handle(StepRepr_CompoundItemDefinitionMember) CIDM =
-          //  new StepRepr_CompoundItemDefinitionMember;
-          //Handle(TColStd_HArray1OfTransient) ArrTr = new TColStd_HArray1OfTransient(1,2);
-          //ArrTr->SetValue(1,RILMU1);
-          //ArrTr->SetValue(2,RILMU2);
-          //CIDM->SetArrTransient(ArrTr);
-          //CIDM->SetName("SET_REPRESENTATION_ITEM");
-          //StepRepr_CompoundItemDefinition CID;
-          //CID.SetValue(CIDM);
-          Handle(StepRepr_HArray1OfRepresentationItem) HARIVR =
-            new StepRepr_HArray1OfRepresentationItem(1,2);
-          HARIVR->SetValue(1,RILMU1);
-          HARIVR->SetValue(2,RILMU2);
-          Handle(StepRepr_ValueRange) VR = new StepRepr_ValueRange;
-          //VR->Init(aName,CID);
-          VR->Init(aName,HARIVR);
-          Model->AddEntity(VR);
-          Handle(StepShape_ShapeDimensionRepresentation) SDimR =
-            new StepShape_ShapeDimensionRepresentation;
-          Handle(StepRepr_HArray1OfRepresentationItem) aHARI =
-            new StepRepr_HArray1OfRepresentationItem(1,1);
-          aHARI->SetValue(1,VR);
-          SDimR->Init(aName,aHARI,RC);
-          Model->AddWithRefs(SDimR);
-          Handle(StepShape_DimensionalCharacteristicRepresentation) DimCharR =
-            new StepShape_DimensionalCharacteristicRepresentation;
-          StepShape_DimensionalCharacteristic DimChar;
-          DimChar.SetValue(DimSize);
-          DimCharR->Init(DimChar,SDimR);
-          Model->AddEntity(DimCharR);
-        }
+  // write Tolerances and Dimensions
+  DGTLabels.Clear();
+  DGTTool->GetDimTolLabels(DGTLabels);
+  if(DGTLabels.Length()<=0) return Standard_False;
+  for(i=1; i<=DGTLabels.Length(); i++) {
+    TDF_Label DimTolL = DGTLabels.Value(i);
+    TDF_LabelSequence ShapeL;
+    TDF_LabelSequence aNullSeq;
+    if(!DGTTool->GetRefShapeLabel(DimTolL,ShapeL,aNullSeq)) continue;
+    // find target shape
+    TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL.Value(1));
+    TopLoc_Location Loc;
+    TColStd_SequenceOfTransient seqRI;
+    FindEntities( FP, aShape, Loc, seqRI );
+    if ( seqRI.Length() <= 0 ) {
+      FP->Messenger()->SendInfo() << "Warning: Cannot find RI for "<<aShape.TShape()->DynamicType()->Name()<<std::endl;
+      continue;
+    }
+    Handle(StepRepr_ProductDefinitionShape) PDS;
+    Handle(StepRepr_RepresentationContext) RC;
+    Handle(Standard_Transient) ent = seqRI.Value(1);
+    Handle(StepShape_AdvancedFace) AF;
+    Handle(StepShape_EdgeCurve) EC;
+    FindPDSforDGT(aGraph,ent,PDS,RC,AF,EC);
+    if(PDS.IsNull()) continue;
+    //std::cout<<"Model->Number(PDS)="<<Model->Number(PDS)<<std::endl;
+
+    Handle(XCAFDoc_DimTol) DimTolAttr;
+    if(!DimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),DimTolAttr)) continue;
+    Standard_Integer kind = DimTolAttr->GetKind();
+    Handle(TColStd_HArray1OfReal) aVal = DimTolAttr->GetVal();
+    Handle(TCollection_HAsciiString) aName = DimTolAttr->GetName();
+    Handle(TCollection_HAsciiString) aDescription = DimTolAttr->GetDescription();
+
+    // common part of writing D&GT entities
+    StepRepr_CharacterizedDefinition CD;
+    Handle(StepRepr_ShapeAspect) SA = new StepRepr_ShapeAspect;
+    SA->Init(aName, new TCollection_HAsciiString, PDS, StepData_LTrue);
+    Model->AddWithRefs(SA);
+    CD.SetValue(SA);
+    Handle(StepRepr_PropertyDefinition) PropD = new StepRepr_PropertyDefinition;
+    PropD->Init(aName,Standard_True,aDescription,CD);
+    Model->AddWithRefs(PropD);
+    StepRepr_RepresentedDefinition RD;
+    RD.SetValue(PropD);
+    Handle(StepShape_ShapeRepresentation) SR = new StepShape_ShapeRepresentation;
+    Handle(StepRepr_HArray1OfRepresentationItem) HARI =
+      new StepRepr_HArray1OfRepresentationItem(1,1);
+    if(kind<20) 
+      HARI->SetValue(1,EC);
+    else
+      HARI->SetValue(1,AF);
+    SR->Init(aName,HARI,RC);
+    Handle(StepShape_ShapeDefinitionRepresentation) SDR = new StepShape_ShapeDefinitionRepresentation;
+    SDR->Init(RD,SR);
+    Model->AddWithRefs(SDR);
+    // define aUnit for creation LengthMeasureWithUnit (common for all)
+    StepBasic_Unit aUnit;
+    aUnit = GetUnit(RC);
+
+    // specific part of writing D&GT entities
+    if(kind<20) { //dimension
+      Handle(StepShape_DimensionalSize) DimSize = new StepShape_DimensionalSize;
+      DimSize->Init(SA,aDescription);
+      Model->AddWithRefs(DimSize);
+      if(aVal->Length()>1) {
+        // create MeasureWithUnits
+        Handle(StepBasic_MeasureValueMember) MVM1 = new StepBasic_MeasureValueMember;
+        MVM1->SetName("POSITIVE_LENGTH_MEASURE");
+        MVM1->SetReal(aVal->Value(1));
+        Handle(StepBasic_MeasureWithUnit) MWU1 = new StepBasic_MeasureWithUnit;
+        MWU1->Init(MVM1,aUnit);
+        Handle(StepBasic_MeasureValueMember) MVM2 = new StepBasic_MeasureValueMember;
+        MVM2->SetName("POSITIVE_LENGTH_MEASURE");
+        MVM2->SetReal(aVal->Value(2));
+        Handle(StepBasic_MeasureWithUnit) MWU2 = new StepBasic_MeasureWithUnit;
+        MWU2->Init(MVM2,aUnit);
+        Handle(StepRepr_RepresentationItem) RI1 = new StepRepr_RepresentationItem;
+        RI1->Init(new TCollection_HAsciiString("lower limit"));
+        Handle(StepRepr_RepresentationItem) RI2 = new StepRepr_RepresentationItem;
+        RI2->Init(new TCollection_HAsciiString("upper limit"));
+        Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMU1 =
+          new StepRepr_ReprItemAndLengthMeasureWithUnit;
+        RILMU1->Init(MWU1,RI1);
+        Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMU2 =
+          new StepRepr_ReprItemAndLengthMeasureWithUnit;
+        RILMU2->Init(MWU2,RI2);
+        Model->AddWithRefs(RILMU1);
+        Model->AddWithRefs(RILMU2);
+        //Handle(StepRepr_CompoundItemDefinitionMember) CIDM =
+        //  new StepRepr_CompoundItemDefinitionMember;
+        //Handle(TColStd_HArray1OfTransient) ArrTr = new TColStd_HArray1OfTransient(1,2);
+        //ArrTr->SetValue(1,RILMU1);
+        //ArrTr->SetValue(2,RILMU2);
+        //CIDM->SetArrTransient(ArrTr);
+        //CIDM->SetName("SET_REPRESENTATION_ITEM");
+        //StepRepr_CompoundItemDefinition CID;
+        //CID.SetValue(CIDM);
+        Handle(StepRepr_HArray1OfRepresentationItem) HARIVR =
+          new StepRepr_HArray1OfRepresentationItem(1,2);
+        HARIVR->SetValue(1,RILMU1);
+        HARIVR->SetValue(2,RILMU2);
+        Handle(StepRepr_ValueRange) VR = new StepRepr_ValueRange;
+        //VR->Init(aName,CID);
+        VR->Init(aName,HARIVR);
+        Model->AddEntity(VR);
+        Handle(StepShape_ShapeDimensionRepresentation) SDimR =
+          new StepShape_ShapeDimensionRepresentation;
+        Handle(StepRepr_HArray1OfRepresentationItem) aHARI =
+          new StepRepr_HArray1OfRepresentationItem(1,1);
+        aHARI->SetValue(1,VR);
+        SDimR->Init(aName,aHARI,RC);
+        Model->AddWithRefs(SDimR);
+        Handle(StepShape_DimensionalCharacteristicRepresentation) DimCharR =
+          new StepShape_DimensionalCharacteristicRepresentation;
+        StepShape_DimensionalCharacteristic DimChar;
+        DimChar.SetValue(DimSize);
+        DimCharR->Init(DimChar,SDimR);
+        Model->AddEntity(DimCharR);
       }
-      else if(kind<50) { //tolerance
-        if(kind<35) { // tolerance with datum system
-          TDF_LabelSequence DatumLabels;
-          DGTTool->GetDatumOfTolerLabels(DimTolL,DatumLabels);
-          Standard_Integer NbDR = DatumLabels.Length();
-          Handle(StepDimTol_HArray1OfDatumReference) HADR = new StepDimTol_HArray1OfDatumReference(1,NbDR);
-          for(Standard_Integer j=1; j<=NbDR; j++) {
-            Handle(XCAFDoc_Datum) DatumAttr;
-            TDF_Label DatumL = DatumLabels.Value(j);
-            if(!DatumL.FindAttribute(XCAFDoc_Datum::GetID(),DatumAttr)) continue;
-            Handle(TCollection_HAsciiString) aNameD = DatumAttr->GetName();
-            Handle(TCollection_HAsciiString) aDescriptionD = DatumAttr->GetDescription();
-            Handle(TCollection_HAsciiString) anIdentificationD = DatumAttr->GetIdentification();
-            TCollection_AsciiString stmp(aNameD->ToCString());
-            stmp.AssignCat(aDescriptionD->ToCString());
-            stmp.AssignCat(anIdentificationD->ToCString());
-            if(DatumMap.IsBound(stmp)) {
-              Handle(StepDimTol_Datum) aDatum = 
-                Handle(StepDimTol_Datum)::DownCast(DatumMap.Find(stmp));
-              Handle(StepDimTol_DatumReference) DR = new StepDimTol_DatumReference;
-              DR->Init(j,aDatum);
-              Model->AddWithRefs(DR);
-              HADR->SetValue(j,DR);
-            }
-          }
-          // create LengthMeasureWithUnit
-          Handle(StepBasic_MeasureValueMember) MVM = new StepBasic_MeasureValueMember;
-          MVM->SetName("LENGTH_MEASURE");
-          MVM->SetReal(aVal->Value(1));
-          Handle(StepBasic_LengthMeasureWithUnit) LMWU = new StepBasic_LengthMeasureWithUnit;
-          LMWU->Init(MVM,aUnit);
-          // create tolerance by it's type
-          if(kind<24) {
-            Handle(StepDimTol_GeometricToleranceWithDatumReference) GTWDR =
-              new StepDimTol_GeometricToleranceWithDatumReference;
-            GTWDR->SetDatumSystem(HADR);
-            Handle(StepDimTol_ModifiedGeometricTolerance) MGT =
-              new StepDimTol_ModifiedGeometricTolerance;
-            if(kind==21) MGT->SetModifier(StepDimTol_MaximumMaterialCondition);
-            else if(kind==22) MGT->SetModifier(StepDimTol_LeastMaterialCondition);
-            else if(kind==23) MGT->SetModifier(StepDimTol_RegardlessOfFeatureSize);
-            Handle(StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol) GTComplex =
-              new StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol;
-            GTComplex->Init(aName,aDescription,LMWU,SA,GTWDR,MGT);
-            Model->AddWithRefs(GTComplex);
-          }
-          else if(kind==24) {
-            Handle(StepDimTol_AngularityTolerance) aToler =
-              new StepDimTol_AngularityTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==25) {
-            Handle(StepDimTol_CircularRunoutTolerance) aToler =
-              new StepDimTol_CircularRunoutTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==26) {
-            Handle(StepDimTol_CoaxialityTolerance) aToler =
-              new StepDimTol_CoaxialityTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==27) {
-            Handle(StepDimTol_ConcentricityTolerance) aToler =
-              new StepDimTol_ConcentricityTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==28) {
-            Handle(StepDimTol_ParallelismTolerance) aToler =
-              new StepDimTol_ParallelismTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==29) {
-            Handle(StepDimTol_PerpendicularityTolerance) aToler =
-              new StepDimTol_PerpendicularityTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==30) {
-            Handle(StepDimTol_SymmetryTolerance) aToler =
-              new StepDimTol_SymmetryTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
-          }
-          else if(kind==31) {
-            Handle(StepDimTol_TotalRunoutTolerance) aToler =
-              new StepDimTol_TotalRunoutTolerance;
-            aToler->Init(aName,aDescription,LMWU,SA,HADR);
-            Model->AddWithRefs(aToler);
+    }
+    else if(kind<50) { //tolerance
+      if(kind<35) { // tolerance with datum system
+        TDF_LabelSequence DatumLabels;
+        DGTTool->GetDatumOfTolerLabels(DimTolL,DatumLabels);
+        Standard_Integer NbDR = DatumLabels.Length();
+        Handle(StepDimTol_HArray1OfDatumReference) HADR = new StepDimTol_HArray1OfDatumReference(1,NbDR);
+        for(Standard_Integer j=1; j<=NbDR; j++) {
+          Handle(XCAFDoc_Datum) DatumAttr;
+          TDF_Label DatumL = DatumLabels.Value(j);
+          if(!DatumL.FindAttribute(XCAFDoc_Datum::GetID(),DatumAttr)) continue;
+          Handle(TCollection_HAsciiString) aNameD = DatumAttr->GetName();
+          Handle(TCollection_HAsciiString) aDescriptionD = DatumAttr->GetDescription();
+          Handle(TCollection_HAsciiString) anIdentificationD = DatumAttr->GetIdentification();
+          TCollection_AsciiString stmp(aNameD->ToCString());
+          stmp.AssignCat(aDescriptionD->ToCString());
+          stmp.AssignCat(anIdentificationD->ToCString());
+          if(DatumMap.IsBound(stmp)) {
+            Handle(StepDimTol_Datum) aDatum = 
+              Handle(StepDimTol_Datum)::DownCast(DatumMap.Find(stmp));
+            Handle(StepDimTol_DatumReference) DR = new StepDimTol_DatumReference;
+            DR->Init(j,aDatum);
+            Model->AddWithRefs(DR);
+            HADR->SetValue(j,DR);
           }
         }
+        // create LengthMeasureWithUnit
+        Handle(StepBasic_MeasureValueMember) MVM = new StepBasic_MeasureValueMember;
+        MVM->SetName("LENGTH_MEASURE");
+        MVM->SetReal(aVal->Value(1));
+        Handle(StepBasic_LengthMeasureWithUnit) LMWU = new StepBasic_LengthMeasureWithUnit;
+        LMWU->Init(MVM,aUnit);
+        // create tolerance by it's type
+        if(kind<24) {
+          Handle(StepDimTol_GeometricToleranceWithDatumReference) GTWDR =
+            new StepDimTol_GeometricToleranceWithDatumReference;
+          GTWDR->SetDatumSystem(HADR);
+          Handle(StepDimTol_ModifiedGeometricTolerance) MGT =
+            new StepDimTol_ModifiedGeometricTolerance;
+          if(kind==21) MGT->SetModifier(StepDimTol_MaximumMaterialCondition);
+          else if(kind==22) MGT->SetModifier(StepDimTol_LeastMaterialCondition);
+          else if(kind==23) MGT->SetModifier(StepDimTol_RegardlessOfFeatureSize);
+          Handle(StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol) GTComplex =
+            new StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol;
+          GTComplex->Init(aName,aDescription,LMWU,SA,GTWDR,MGT);
+          Model->AddWithRefs(GTComplex);
+        }
+        else if(kind==24) {
+          Handle(StepDimTol_AngularityTolerance) aToler =
+            new StepDimTol_AngularityTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==25) {
+          Handle(StepDimTol_CircularRunoutTolerance) aToler =
+            new StepDimTol_CircularRunoutTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==26) {
+          Handle(StepDimTol_CoaxialityTolerance) aToler =
+            new StepDimTol_CoaxialityTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==27) {
+          Handle(StepDimTol_ConcentricityTolerance) aToler =
+            new StepDimTol_ConcentricityTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==28) {
+          Handle(StepDimTol_ParallelismTolerance) aToler =
+            new StepDimTol_ParallelismTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==29) {
+          Handle(StepDimTol_PerpendicularityTolerance) aToler =
+            new StepDimTol_PerpendicularityTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==30) {
+          Handle(StepDimTol_SymmetryTolerance) aToler =
+            new StepDimTol_SymmetryTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
+        else if(kind==31) {
+          Handle(StepDimTol_TotalRunoutTolerance) aToler =
+            new StepDimTol_TotalRunoutTolerance;
+          aToler->Init(aName,aDescription,LMWU,SA,HADR);
+          Model->AddWithRefs(aToler);
+        }
       }
     }
-
-    return Standard_True;
   }
 
+  return Standard_True;
+}
+
 //=======================================================================
 //function : WriteDGTsAP242
 //purpose  : 
@@ -5517,7 +5554,7 @@ Standard_Boolean STEPCAFControl_Writer::GetMaterialMode() const
 
 void STEPCAFControl_Writer::SetKinematicsMode(const Standard_Boolean kinematicsmod)
 {
-  myKPairMode = kinematicsmod;
+  myKinematicMode = kinematicsmod;
 }
 
 //=======================================================================
@@ -5527,5 +5564,5 @@ void STEPCAFControl_Writer::SetKinematicsMode(const Standard_Boolean kinematicsm
 
 Standard_Boolean STEPCAFControl_Writer::GetKinematicsMode() const
 {
-  return myKPairMode;
+  return myKinematicMode;
 }
index fd1515922a6c24b4c7d2291ee7c1c036a51cac2f..371cf0ac03452b43e0ee4854382ff8aadb970ce2 100644 (file)
@@ -150,8 +150,8 @@ public:
   
   Standard_EXPORT Standard_Boolean GetMaterialMode() const;
 
-  //! Set dimtolmode for indicate write D&GTs or not.
-  Standard_EXPORT void SetKinematicsMode(const Standard_Boolean kinematicsmod);
+  //! Set Kinematic mode for indicate write kinematics or not.
+  Standard_EXPORT void SetKinematicsMode(const Standard_Boolean kinematicmode);
 
   Standard_EXPORT Standard_Boolean GetKinematicsMode() const;
 
@@ -237,7 +237,7 @@ private:
   Standard_Boolean myLayerMode;
   Standard_Boolean myPropsMode;
   Standard_Boolean mySHUOMode;
-  Standard_Boolean myKPairMode;
+  Standard_Boolean myKinematicMode;
   MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
   Standard_Boolean myGDTMode;
   Standard_Boolean myMatMode;
index ec55f80bb654a6f167fd02175ff6a21f245b36a3..a47ecbe14d8cba082f06fcc3822c440cfb1a306c 100644 (file)
@@ -1,7 +1,6 @@
-// Created on : Sat May 02 12:41:15 2020 
-// Created by: Irina KRYLOVA
-// Generator:  Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0
-// Copyright (c) Open CASCADE 2020
+// Created on: 2020-05-26
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
index 41addfa989c470f15a7c66c0646d4b3dac382679..e9e8b3ec5bda3784c193c552d51e4d054ca4c37b 100644 (file)
@@ -1,7 +1,6 @@
-// Created on : Sat May 02 12:41:15 2020 
-// Created by: Irina KRYLOVA
-// Generator:  Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0
-// Copyright (c) Open CASCADE 2020
+// Created on: 2020-05-26
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
@@ -47,62 +46,6 @@ public :
                             const Handle(StepKinematics_KinematicJoint)& theJoint,
                             const Handle(StepKinematics_ActuatedKinematicPair)& theActuatedKinematicPair,
                             const Handle(StepKinematics_KinematicPair)& theOrderKinematicPair);
-  ////! Initialize all fields for low order kinematic pair
-  //Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theRepresentationItem_Name,
-  //                          const Handle(TCollection_HAsciiString)& theItemDefinedTransformation_Name,
-  //                          const Standard_Boolean hasItemDefinedTransformation_Description,
-  //                          const Handle(TCollection_HAsciiString)& theItemDefinedTransformation_Description,
-  //                          const Handle(StepRepr_RepresentationItem)& theItemDefinedTransformation_TransformItem1,
-  //                          const Handle(StepRepr_RepresentationItem)& theItemDefinedTransformation_TransformItem2,
-  //                          const Handle(StepKinematics_KinematicJoint)& theKinematicPair_Joint,
-  //                          const Standard_Boolean theLowOrderKinematicPair_TX,
-  //                          const Standard_Boolean theLowOrderKinematicPair_TY,
-  //                          const Standard_Boolean theLowOrderKinematicPair_TZ,
-  //                          const Standard_Boolean theLowOrderKinematicPair_RX,
-  //                          const Standard_Boolean theLowOrderKinematicPair_RY,
-  //                          const Standard_Boolean theLowOrderKinematicPair_RZ,
-  //                          const Standard_Boolean hasUniversalPair_InputSkewAngle,
-  //                          const Standard_Real theUniversalPair_InputSkewAngle,
-  //                          const Standard_Boolean hasLowerLimitFirstRotation,
-  //                          const Standard_Real theLowerLimitFirstRotation,
-  //                          const Standard_Boolean hasUpperLimitFirstRotation,
-  //                          const Standard_Real theUpperLimitFirstRotation,
-  //                          const Standard_Boolean hasLowerLimitSecondRotation,
-  //                          const Standard_Real theLowerLimitSecondRotation,
-  //                          const Standard_Boolean hasUpperLimitSecondRotation,
-  //                          const Standard_Real theUpperLimitSecondRotation);
-
-  ////! Initialize all fields for low order kinematic pair with motions coupling
-  //Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theRepresentationItem_Name,
-  //                          const Handle(TCollection_HAsciiString)& theItemDefinedTransformation_Name,
-  //                          const Standard_Boolean hasItemDefinedTransformation_Description,
-  //                          const Handle(TCollection_HAsciiString)& theItemDefinedTransformation_Description,
-  //                          const Handle(StepRepr_RepresentationItem)& theItemDefinedTransformation_TransformItem1,
-  //                          const Handle(StepRepr_RepresentationItem)& theItemDefinedTransformation_TransformItem2,
-  //                          const Handle(StepKinematics_KinematicJoint)& theKinematicPair_Joint,
-  //                          const Standard_Real theScrewPair_Pitch,
-  //                          const Standard_Real theGearPair_RadiusFirstLink,
-  //                          const Standard_Real theGearPair_RadiusSecondLink,
-  //                          const Standard_Real theGearPair_Bevel,
-  //                          const Standard_Real theGearPair_HelicalAngle,
-  //                          const Standard_Real theGearPair_GearRatio,
-  //                          const Standard_Boolean hasLowerLimitActualRotation1,
-  //                          const Standard_Real theLowerLimitActualRotation1,
-  //                          const Standard_Boolean hasUpperLimitActualRotation1,
-  //                          const Standard_Real theUpperLimitActualRotation1,
-  //                          const Handle(TColStd_HArray1OfReal) theParams);
-
-  ////! Initialize all fields for high order kinematic pair
-  //Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theRepresentationItem_Name,
-  //                          const Handle(TCollection_HAsciiString)& theItemDefinedTransformation_Name,
-  //                          const Standard_Boolean hasItemDefinedTransformation_Description,
-  //                          const Handle(TCollection_HAsciiString)& theItemDefinedTransformation_Description,
-  //                          const Handle(StepRepr_RepresentationItem)& theItemDefinedTransformation_TransformItem1,
-  //                          const Handle(StepRepr_RepresentationItem)& theItemDefinedTransformation_TransformItem2,
-  //                          const Handle(StepKinematics_KinematicJoint)& theKinematicPair_Joint,
-  //                          const Standard_Boolean theOrientation,
-  //                          const Handle(TColStd_HArray1OfReal) theLimits,
-  //                          const NCollection_Array1<Handle(Geom_Geometry)> theGeom);
 
   inline void SetActuatedKinematicPair(const Handle(StepKinematics_ActuatedKinematicPair)& aKP) {
     myActuatedKinematicPair = aKP;
@@ -118,40 +61,6 @@ public :
   inline Handle(StepKinematics_KinematicPair) GetOrderKinematicPair() const {
     return myOrderKinematicPair;
   }
-  ////! Returns field LowerLimitFirstRotation
-  //Standard_EXPORT Standard_Real LowerLimitFirstRotation() const;
-  ////! Sets field LowerLimitFirstRotation
-  //Standard_EXPORT void SetLowerLimitFirstRotation(const Standard_Real theLowerLimitFirstRotation);
-  ////! Returns True if optional field LowerLimitFirstRotation is defined
-  //Standard_EXPORT Standard_Boolean HasLowerLimitFirstRotation() const;
-
-  ////! Returns field UpperLimitFirstRotation
-  //Standard_EXPORT Standard_Real UpperLimitFirstRotation() const;
-  ////! Sets field UpperLimitFirstRotation
-  //Standard_EXPORT void SetUpperLimitFirstRotation(const Standard_Real theUpperLimitFirstRotation);
-  ////! Returns True if optional field UpperLimitFirstRotation is defined
-  //Standard_EXPORT Standard_Boolean HasUpperLimitFirstRotation() const;
-
-  ////! Returns field LowerLimitSecondRotation
-  //Standard_EXPORT Standard_Real LowerLimitSecondRotation() const;
-  ////! Sets field LowerLimitSecondRotation
-  //Standard_EXPORT void SetLowerLimitSecondRotation(const Standard_Real theLowerLimitSecondRotation);
-  ////! Returns True if optional field LowerLimitSecondRotation is defined
-  //Standard_EXPORT Standard_Boolean HasLowerLimitSecondRotation() const;
-
-  ////! Returns field UpperLimitSecondRotation
-  //Standard_EXPORT Standard_Real UpperLimitSecondRotation() const;
-  ////! Sets field UpperLimitSecondRotation
-  //Standard_EXPORT void SetUpperLimitSecondRotation(const Standard_Real theUpperLimitSecondRotation);
-  ////! Returns True if optional field UpperLimitSecondRotation is defined
-  //Standard_EXPORT Standard_Boolean HasUpperLimitSecondRotation() const;
-
-  ////! Returns field InputSkewAngle
-  //Standard_EXPORT Standard_Real InputSkewAngle() const;
-  ////! Sets field InputSkewAngle
-  //Standard_EXPORT void SetInputSkewAngle(const Standard_Real theInputSkewAngle);
-  ////! Returns True if optional field InputSkewAngle is defined
-  //Standard_EXPORT Standard_Boolean HasInputSkewAngle() const;
 
 
 DEFINE_STANDARD_RTTIEXT(StepKinematics_ActuatedKinPairAndOrderKinPair, StepKinematics_KinematicPair)
@@ -159,44 +68,5 @@ DEFINE_STANDARD_RTTIEXT(StepKinematics_ActuatedKinPairAndOrderKinPair, StepKinem
 private:
   Handle(StepKinematics_ActuatedKinematicPair) myActuatedKinematicPair;
   Handle(StepKinematics_KinematicPair) myOrderKinematicPair;
-  //Standard_Boolean myTX;
-  //Standard_Boolean myTY;
-  //Standard_Boolean myTZ;
-  //Standard_Boolean myRX;
-  //Standard_Boolean myRY;
-  //Standard_Boolean myRZ;
-  //Standard_Boolean defInputSkewAngle; //!< flag "is InputSkewAngle defined"
-  //Standard_Real myMinRotationX;    //!< minimum value of the yaw angle
-  //Standard_Real myMaxRotationX;    //!< maximum value of the yaw angle
-  //Standard_Real myMinRotationY;    //!< minimum value of the pitch angle
-  //Standard_Real myMaxRotationY;    //!< maximum value of the pitch angle
-  //Standard_Real myMinRotationZ;    //!< minimum value of the roll angle
-  //Standard_Real myMaxRotationZ;    //!< maximum value of the roll angle
-  //Standard_Real myMinTranslationX; //!< minimum value of translation in x-direction
-  //Standard_Real myMaxTranslationX; //!< maximum value of translation in x-direction
-  //Standard_Real myMinTranslationY; //!< minimum value of translation in y-direction
-  //Standard_Real myMaxTranslationY; //!< maximum value of translation in y-direction
-  //Standard_Real myMinTranslationZ; //!< minimum value of translation in z-direction
-  //Standard_Real myMaxTranslationZ; //!< maximum value of translation in z-direction
-  //Standard_Real myLowerLimitFirstRotation; //!< optional
-  //Standard_Real myUpperLimitFirstRotation; //!< optional
-  //Standard_Real myLowerLimitSecondRotation; //!< optional
-  //Standard_Real myUpperLimitSecondRotation; //!< optional
-  //Standard_Boolean defLowerLimitFirstRotation; //!< flag "is LowerLimitFirstRotation defined"
-  //Standard_Boolean defUpperLimitFirstRotation; //!< flag "is UpperLimitFirstRotation defined"
-  //Standard_Boolean defLowerLimitSecondRotation; //!< flag "is LowerLimitSecondRotation defined"
-  //Standard_Boolean defUpperLimitSecondRotation; //!< flag "is UpperLimitSecondRotation defined"
-  //Standard_Real myRadiusFirstLink;
-  //Standard_Real myRadiusSecondLink;
-  //Standard_Real myBevel;
-  //Standard_Real myHelicalAngle;
-  //Standard_Real myGearRatio;
-  //Standard_Real mySkewAngle;       //!< param for universal/homokinetic pair
-  //Standard_Real myLowLimit;               //!< low limit of motion range
-  //Standard_Real myUpperLimit;             //!< upper limit of motion range
-  //Handle(TColStd_HArray1OfReal) myParams; //!< additional parameters of kinematic pair
-  //Standard_Boolean myOrientation;                   //!< orientation
-  //Handle(TColStd_HArray1OfReal) myLimits;           //!< array of limits, size depends on type
-  //NCollection_Array1<Handle(Geom_Geometry)> myGeom; //!< curve(s) or surface(s) attributes
 };
 #endif // StepKinematics_ActuatedKinPairAndOrderKinPair
index fae011f0d6a1c3f956affb1c64ff4cd6506e2af1..333be3f1b3630e4a7dd004d182853f3bad7ea741 100644 (file)
@@ -1,6 +1,6 @@
-// Created on: 2016-04-26
-// Created by: Irina KRYLOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
+// Created on: 2020-06-18
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
index fed3126919bf4517a7c74ec0600c5afac63168f5..f72a364b4fc97f142d88886cc34f8f84d8da1d3d 100644 (file)
@@ -1,6 +1,6 @@
-// Created on: 2016-04-26
-// Created by: Irina KRYLOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
+// Created on: 2020-06-18
+// Created by: PASUKHIN DMITRY
+// Copyright (c) 2020 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
index d7c42c2649368094e0ef00b9a75fab0c0db7cfca..a9b6f2edba9b5f3c74a7fb67afca19a3a6121f0a 100644 (file)
@@ -339,7 +339,7 @@ const Standard_GUID& XCAFDoc::KinematicRefLink2GUID()
 
 Standard_EXPORT const Standard_GUID& XCAFDoc::KinematicRefJointGUID()
 {
-  static const Standard_GUID ID("6AA96F91-7436-46F9-A955-4B3CCC42692B");
+  static const Standard_GUID ID("596B048C-A965-4514-A059-464560BFAE4E");
   return ID;
 }
 
index 5fc0453ceb29abdbac9926d715d6b7115d15f6e2..60370244ce38fb04b722b86cae047171d82c8ed4 100644 (file)
 // commercial license or contractual agreement.
 
 #include <XCAFDoc_KinematicPair.hxx>
-
 #include <BRep_Builder.hxx>
 #include <gp_Pln.hxx>
 #include <Standard_Dump.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
 #include <Standard_GUID.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 #include <TDataStd_AsciiString.hxx>
@@ -32,6 +32,7 @@
 #include <TNaming_Tool.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <XCAFDoc.hxx>
 #include <XCAFKinematics_HighOrderPairObject.hxx>
 #include <XCAFKinematics_LowOrderPairObject.hxx>
@@ -110,22 +111,6 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
 {
   Backup();
 
-  for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
-  {
-    // Check if it needs to clear value label
-    if (anIter.Value().IsEqual(Label().FindChild(ChildLab_Value))) {
-      Handle(TDataStd_Integer) aTypeAttr;
-      if (Label().FindAttribute(TDataStd_Integer::GetID(), aTypeAttr))
-      {
-        int aType = aTypeAttr->Get();
-        if (aType != theObject->Type())
-          anIter.Value().ForgetAllAttributes();
-      }
-    }
-    else
-      anIter.Value().ForgetAllAttributes();
-  }
-
   // Common attributes
   if (!theObject->Name().IsEmpty())
     TDataStd_Name::Set(Label(), theObject->Name());
@@ -133,7 +118,7 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
   TDataXtd_Plane::Set(Label().FindChild(ChildLab_FirstTrsf), gp_Pln(theObject->FirstTransformation()));
   TDataXtd_Plane::Set(Label().FindChild(ChildLab_SecondTrsf), gp_Pln(theObject->SecondTransformation()));
 
-  if (!theObject->GetAllLimits().IsNull() && theObject->GetAllLimits()->Length() > 0) {
+  if (!theObject->GetAllLimits().IsNull() && theObject->HasLimits()) {
     Handle(TDataStd_RealArray) aLimitsAttr;
     aLimitsAttr = TDataStd_RealArray::Set(Label(), getLimitsID(), 1, theObject->GetAllLimits()->Length());
     aLimitsAttr->ChangeArray(theObject->GetAllLimits());
@@ -149,7 +134,7 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
 
   // Low order pairs with motion coupling
   if (theObject->Type() >= XCAFKinematics_PairType_Screw &&
-      theObject->Type() <= XCAFKinematics_PairType_Gear) {
+      theObject->Type() <= XCAFKinematics_PairType_LinearFlexibleAndPinion) {
     Handle(XCAFKinematics_LowOrderPairObjectWithCoupling) anObject =
       Handle(XCAFKinematics_LowOrderPairObjectWithCoupling)::DownCast(theObject);
     if (!anObject->GetAllParams().IsNull() && anObject->GetAllParams()->Upper() > 0) {
@@ -166,10 +151,13 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
       Handle(XCAFKinematics_HighOrderPairObject)::DownCast(theObject);
     TDataStd_Integer::Set(Label(), getParamsID(), (Standard_Integer)anObject->Orientation());
     BRep_Builder aBuilder;
-    if (theObject->Type() >= XCAFKinematics_PairType_PointOnSurface && !anObject->Surface().IsNull())
+    if (theObject->Type() == XCAFKinematics_PairType_PointOnSurface && !anObject->Surface().IsNull())
     {
       TopoDS_Face aFace;
-      aBuilder.MakeFace(aFace, anObject->Surface(), Precision::Confusion());
+      if (anObject->HasLimits())
+        aBuilder.MakeFace(aFace, anObject->TrimmedSurface(), Precision::Confusion());
+      else
+        aBuilder.MakeFace(aFace, anObject->Surface(), Precision::Confusion());
       TNaming_Builder aTNBuild(Label().FindChild(ChildLab_FirstGeomParam));
       aTNBuild.Generated(aFace);
     }
@@ -191,7 +179,10 @@ void XCAFDoc_KinematicPair::SetObject(const Handle(XCAFKinematics_PairObject)& t
     if (theObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve && !anObject->Curve().IsNull())
     {
       TopoDS_Edge anEdge;
-      aBuilder.MakeEdge(anEdge, anObject->Curve(), Precision::Confusion());
+      if (anObject->HasLimits())
+        aBuilder.MakeEdge(anEdge, anObject->TrimmedCurve(), Precision::Confusion());
+      else 
+        aBuilder.MakeEdge(anEdge, anObject->Curve(), Precision::Confusion());
       TNaming_Builder aTNBuild(Label().FindChild(ChildLab_FirstGeomParam));
       aTNBuild.Generated(anEdge);
     }
index 4a6eb94c97bffc8ca7d5303510aff48d98a8ade0..f5952e33bfb8d773d4f7537a23649d6607cea8f4 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_KinematicPairValue, TDF_Attribute)
 
-// Gor first children are reserved for kinematic pair parameters
-enum ValueLab
-{
-  ValueLab_Values = 3
-};
-
 //=======================================================================
 //function : XCAFDoc_KinematicPairValue
 //purpose  : 
index b41c5a3e7d94935ad51b5bf58c18993f89cdf558..989d91b2c2bfab6f79f40ad9021e7cbe5917802c 100644 (file)
@@ -22,6 +22,7 @@
 #include <TDF_Attribute.hxx>
 #include <TDF_ChildIDIterator.hxx>
 #include <TDF_Label.hxx>
+#include <TDataStd_Integer.hxx>
 #include <XCAFDoc.hxx>
 #include <XCAFDoc_DocumentTool.hxx>
 #include <XCAFDoc_GraphNode.hxx>
@@ -126,15 +127,23 @@ void XCAFDoc_KinematicTool::RemoveMechanism(const TDF_Label& theLabel)
 //function : AddLink
 //purpose  : 
 //=======================================================================
-TDF_Label XCAFDoc_KinematicTool::AddLink(const TDF_Label& theMechanism)
+TDF_Label XCAFDoc_KinematicTool::AddLink(const TDF_Label& theMechanism,
+                                         const Standard_Boolean& IsBase)
 {
   if (!IsMechanism(theMechanism))
     return TDF_Label();
   TDF_TagSource aTag;
   TDF_Label aLink = aTag.NewChild(getRootOfLinks(theMechanism));
-  TCollection_AsciiString aName = "Link ";
-  aName.AssignCat(TCollection_AsciiString(aLink.Tag()));
-  TDataStd_Name::Set(aLink, aName);
+  if (IsBase)
+  {
+    SetBaseLink(aLink);
+  }
+  else
+  {
+    TCollection_AsciiString aName = "Link ";
+    aName.AssignCat(TCollection_AsciiString(aLink.Tag()));
+    TDataStd_Name::Set(aLink, aName);
+  }
   return aLink;
 }
 
@@ -143,90 +152,10 @@ TDF_Label XCAFDoc_KinematicTool::AddLink(const TDF_Label& theMechanism)
 //purpose  : 
 //=======================================================================
 TDF_Label XCAFDoc_KinematicTool::AddLink(const TDF_Label& theMechanism,
-                                         const TDF_LabelSequence& theShapes)
-{
-  TDF_Label aNewLink = AddLink(theMechanism);
-  if (aNewLink.IsNull() || theShapes.Length() == 0)
-    return aNewLink;
-
-  SetLink(aNewLink, theShapes);
-  return aNewLink;
-}
-
-TDF_Label XCAFDoc_KinematicTool::AddBaseLink(const TDF_Label& theMechanism)
-{
-  if (!IsMechanism(theMechanism))
-    return TDF_Label();
-  TDF_Label aRootOfLink = getRootOfLinks(theMechanism);
-  if (aRootOfLink.HasChild())
-  {
-    TDF_Label aFirstLink = aRootOfLink.FindChild(1, Standard_False);
-    TDF_Label aResLink;
-    Handle(TDataStd_Name) aNameOfFirst;
-    aFirstLink.FindAttribute(TDataStd_Name::GetID(), aNameOfFirst);
-    if (!aNameOfFirst.IsNull() && !aNameOfFirst->Get().IsEqual("Base") && !aNameOfFirst->Get().IsEqual("Link 1"))
-    {
-      TDF_TagSource aTag;
-      TDF_Label aResLink = aTag.NewChild(aRootOfLink);
-      aResLink.AddAttribute(aNameOfFirst);
-    }
-    else
-      aResLink = AddLink(theMechanism);
-
-    TDF_LabelSequence theShapes = GetRefShapes(aFirstLink);
-    SetLink(aResLink, theShapes);
-
-    Handle(TDataStd_TreeNode) aJointNode, aLinkNode, aNewLinkNode, aNewJointNode;
-    if (aFirstLink.FindAttribute(XCAFDoc::KinematicRefLink1GUID(), aJointNode))
-    {
-      aJointNode = aJointNode->First();
-      while (!aJointNode.IsNull())
-      {
-        TDF_Label aJoint = aJointNode->Label();
-        aNewJointNode = TDataStd_TreeNode::Set(aJoint, XCAFDoc::KinematicRefLink1GUID()); 
-        aNewLinkNode = TDataStd_TreeNode::Set(aResLink, XCAFDoc::KinematicRefLink1GUID()); 
-        aNewJointNode->Remove(); // fix against bug in TreeNode::Append()
-        aNewLinkNode->Append(aNewJointNode);
-
-        aJointNode = aJointNode->Next();
-      }
-    }
-    if (aFirstLink.FindAttribute(XCAFDoc::KinematicRefLink2GUID(), aJointNode))
-    {
-      aJointNode = aJointNode->First();
-      while (!aJointNode.IsNull())
-      {
-        TDF_Label aJoint = aJointNode->Label();
-        aNewJointNode = TDataStd_TreeNode::Set(aJoint, XCAFDoc::KinematicRefLink2GUID());
-        aNewLinkNode = TDataStd_TreeNode::Set(aResLink, XCAFDoc::KinematicRefLink2GUID());
-        aNewJointNode->Remove(); // fix against bug in TreeNode::Append()
-        aNewLinkNode->Append(aNewJointNode);
-
-        aJointNode = aJointNode->Next();
-      }
-    }
-  }
-  TDF_Label aBaseLink = aRootOfLink.FindChild(1);
-  aBaseLink.ForgetAllAttributes(Standard_False);
-  TCollection_AsciiString aName = "Base";
-  TDataStd_Name::Set(aBaseLink, aName);
-  return aBaseLink;
-}
-
-TDF_Label XCAFDoc_KinematicTool::AddBaseLink(const TDF_Label& theMechanism, const TDF_Label& theShape)
-{
-  TDF_LabelSequence anAuxSequence;
-  anAuxSequence.Append(theShape);
-  return AddBaseLink(theMechanism, anAuxSequence);
-}
-
-//=======================================================================
-//function : AddBaseLink
-//purpose  : 
-//=======================================================================
-TDF_Label XCAFDoc_KinematicTool::AddBaseLink(const TDF_Label& theMechanism, const TDF_LabelSequence& theShapes)
+                                         const TDF_LabelSequence& theShapes,
+                                         const Standard_Boolean& IsBase)
 {
-  TDF_Label aNewLink = AddBaseLink(theMechanism);
+  TDF_Label aNewLink = AddLink(theMechanism, IsBase);
   if (aNewLink.IsNull() || theShapes.Length() == 0)
     return aNewLink;
 
@@ -239,11 +168,12 @@ TDF_Label XCAFDoc_KinematicTool::AddBaseLink(const TDF_Label& theMechanism, cons
 //purpose  : 
 //=======================================================================
 TDF_Label XCAFDoc_KinematicTool::AddLink(const TDF_Label& theMechanism,
-                                         const TDF_Label& theShape)
+                                         const TDF_Label& theShape,
+                                         const Standard_Boolean& IsBase)
 {
   TDF_LabelSequence anAuxSequence;
   anAuxSequence.Append(theShape);
-  return AddLink(theMechanism, anAuxSequence);
+  return AddLink(theMechanism, anAuxSequence, IsBase);
 }
 
 //=======================================================================
@@ -288,6 +218,35 @@ Standard_Boolean XCAFDoc_KinematicTool::SetLink(const TDF_Label& theLink,
   return Standard_True;
 }
 
+//=======================================================================
+//function : SetBaseLink
+//purpose  : 
+//=======================================================================
+Standard_EXPORT Standard_Boolean XCAFDoc_KinematicTool::SetBaseLink(const TDF_Label& theLink)
+{
+  TDataStd_Name::Set(theLink, "Base");
+  TDF_Label aMechanism = theLink.Father().Father();
+  if (!IsMechanism(aMechanism))
+    return Standard_False;
+  TDF_LabelSequence aLinks = GetLinks(aMechanism);
+  for (Standard_Integer anInd = 1; anInd <= aLinks.Length(); ++anInd)
+  {
+    Handle(TDataStd_Integer) aBase;
+    if (aLinks(anInd).FindAttribute(TDataStd_Integer::GetID(), aBase))
+    {
+      aLinks(anInd).ForgetAttribute(aBase);
+      Handle(TDataStd_Name) aLinkName;
+      if (aLinks(anInd).FindAttribute(TDataStd_Name::GetID(), aLinkName) && !aLinkName->Get().IsDifferent("Base"))
+      {
+        TCollection_AsciiString aName = "Link ";
+        aName.AssignCat(TCollection_AsciiString(aLinks(anInd).Tag()));
+        TDataStd_Name::Set(aLinks(anInd), aName);
+      }
+    }
+  }
+  TDataStd_Integer::Set(theLink, 1);
+}
+
 //=======================================================================
 //function : SetLink
 //purpose  : 
@@ -434,7 +393,7 @@ void XCAFDoc_KinematicTool::RemoveJoint(const TDF_Label& theJoint)
 
 }
 
-Standard_EXPORT Standard_Boolean XCAFDoc_KinematicTool::IsValue(const TDF_Label& theValue) const
+Standard_Boolean XCAFDoc_KinematicTool::IsValue(const TDF_Label& theValue) const
 {
   Handle(XCAFDoc_KinematicPairValue) anAttr;
   return theValue.FindAttribute(XCAFDoc_KinematicPairValue::GetID(), anAttr);
@@ -549,15 +508,15 @@ TDF_LabelSequence XCAFDoc_KinematicTool::GetJointsOfLink(const TDF_Label& theLin
 //function : AddState
 //purpose  : 
 //=======================================================================
-Standard_EXPORT TDF_Label XCAFDoc_KinematicTool::AddState(const TDF_Label& theMechanism)
+TDF_Label XCAFDoc_KinematicTool::AddState(const TDF_Label& theMechanism)
 {
   if (!IsMechanism(theMechanism))
     return TDF_Label();
 
-  TDF_Label aRootOfState= getRootOfStates(theMechanism);
+  TDF_Label aRootOfState = getRootOfStates(theMechanism);
   if (aRootOfState.IsNull())
   {
-    aRootOfState = theMechanism.FindChild(3);;
+    aRootOfState = theMechanism.FindChild(3);
     TDataStd_Name::Set(aRootOfState, "States");
   }
   TDF_TagSource aTag;
@@ -572,20 +531,28 @@ Standard_EXPORT TDF_Label XCAFDoc_KinematicTool::AddState(const TDF_Label& theMe
 //function : GetStates
 //purpose  : 
 //=======================================================================
-Standard_EXPORT TDF_LabelSequence XCAFDoc_KinematicTool::GetStates(const TDF_Label& theMechanism) const
+TDF_LabelSequence XCAFDoc_KinematicTool::GetStates(const TDF_Label& theMechanism) const
 {
-  TDF_Label aRootOfState = getRootOfStates(theMechanism);
   TDF_LabelSequence aStatesArray;
+  if (!IsMechanism(theMechanism))
+    return aStatesArray;
+
+  TDF_Label aRootOfState = getRootOfStates(theMechanism);
   if (!IsMechanism(theMechanism) || aRootOfState.IsNull())
     return aStatesArray;
 
   for (TDF_ChildIterator anIt(aRootOfState); anIt.More(); anIt.Next()) {
     TDF_Label aState = anIt.Value();
-    aStatesArray.Append(aState);
+    if(!GetValuesOfState(aState).IsEmpty())
+      aStatesArray.Append(aState);
   }
   return aStatesArray;
 }
 
+//=======================================================================
+//function : GetValuesOfState
+//purpose  : 
+//=======================================================================
 Standard_EXPORT TDF_LabelSequence XCAFDoc_KinematicTool::GetValuesOfState(const TDF_Label& theState) const
 {
   TDF_LabelSequence aValueArray;
@@ -605,7 +572,7 @@ Standard_EXPORT TDF_LabelSequence XCAFDoc_KinematicTool::GetValuesOfState(const
 //function : GetJointOfValue
 //purpose  : 
 //=======================================================================
-Standard_EXPORT TDF_Label XCAFDoc_KinematicTool::GetJointOfValue(const TDF_Label& theValue) const
+TDF_Label XCAFDoc_KinematicTool::GetJointOfValue(const TDF_Label& theValue) const
 {
   TDF_Label aJoint;
   if (!IsValue(theValue))
@@ -618,24 +585,46 @@ Standard_EXPORT TDF_Label XCAFDoc_KinematicTool::GetJointOfValue(const TDF_Label
   return aJoint;
 }
 
+//=======================================================================
+//function : GetValuesOfJoint
+//purpose  : 
+//=======================================================================
+TDF_LabelSequence XCAFDoc_KinematicTool::GetValuesOfJoint(const TDF_Label& theJoint) const
+{
+  TDF_LabelSequence aValuesArray;
+  if (!IsJoint(theJoint))
+    return aValuesArray;
+
+  Handle(TDataStd_TreeNode) aNode, aChildNode;
+
+  if (theJoint.FindAttribute(XCAFDoc::KinematicRefJointGUID(), aNode)) {
+    aChildNode = aNode->First();
+    while (!aChildNode.IsNull()) {
+      aValuesArray.Append(aChildNode->Label());
+      aChildNode = aChildNode->Next();
+    }
+  }
+  return aValuesArray;
+}
+
 //=======================================================================
 //function : RemoveState
 //purpose  : 
 //=======================================================================
-Standard_EXPORT void XCAFDoc_KinematicTool::RemoveState(const TDF_Label& theState)
+void XCAFDoc_KinematicTool::RemoveState(const TDF_Label& theState)
 {
   TDF_Label aMechanism = theState.Father().Father();
   if (!IsMechanism(aMechanism) || theState.Father().Tag() != 3)
     return;
-
   Handle(TDataStd_TreeNode) aNode;
-  theState.FindAttribute(XCAFDoc::KinematicRefLink1GUID(), aNode);
-  aNode->Remove();
-
+  TDF_LabelSequence aSeqOfValues = GetValuesOfState(theState);
+  for (Standard_Integer anInd = 1; anInd <= aSeqOfValues.Length(); ++anInd)
+  {
+    aSeqOfValues(anInd).FindAttribute(XCAFDoc::KinematicRefJointGUID(), aNode);
+    aNode->Remove();
+    aSeqOfValues(anInd).ForgetAllAttributes();
+  }
   theState.ForgetAllAttributes();
-  TDF_Label theStates = theState.Father();
-  if (!theStates.HasChild())
-    theStates.ForgetAllAttributes();
 }
 
 //=======================================================================
@@ -675,7 +664,7 @@ TDF_Label XCAFDoc_KinematicTool::getRootOfJoints(const TDF_Label& theMechanism)
 //function : getRootOfStates
 //purpose  : 
 //=======================================================================
-Standard_EXPORT TDF_Label XCAFDoc_KinematicTool::getRootOfStates(const TDF_Label& theMechanism) const
+TDF_Label XCAFDoc_KinematicTool::getRootOfStates(const TDF_Label& theMechanism) const
 {
   return theMechanism.FindChild(3, Standard_False);
 }
index 747a9bbbde6bb403265f083b91591c48a301fac7..1719f0d848caa44ed75ea39a0dba7f6b0f29ca47 100644 (file)
@@ -63,44 +63,27 @@ public:
 
   //! Adds new empty label for link.
   //! \param[in] theMechanism parent mechanism
-  //! \return created link label
-  Standard_EXPORT TDF_Label AddLink(const TDF_Label& theMechanism);
-
-  //! Adds new label with link.
-  //! param[in] theMechanism parent mechanism
-  //! param[in] theShapes all details of link
+  //! param[in] IsBase link is base of mechanism
   //! \return created link label
   Standard_EXPORT TDF_Label AddLink(const TDF_Label& theMechanism,
-                                    const TDF_LabelSequence& theShapes);
-
-  //! Adds new empty label for link.
-  //! \replace first link  into the end, if it exist
-  //! \param[in] theMechanism parent mechanism
-  //! \return created link label
-  Standard_EXPORT TDF_Label AddBaseLink(const TDF_Label& theMechanism);
+                                    const Standard_Boolean& IsBase = Standard_False);
 
   //! Adds new label with link.
-  //! \replace first link  into the end, if it exist
-  //! \param[in] theMechanism parent mechanism
-  //! \param[in] theShape singular detail of link
-  //! \return created link label
-  Standard_EXPORT TDF_Label AddBaseLink(const TDF_Label& theMechanism,
-                                        const TDF_Label& theShapes);
-
-  //! Adds new label with link.
-  //! \replace first link  into the end, if it exist
   //! param[in] theMechanism parent mechanism
   //! param[in] theShapes all details of link
+  //! param[in] IsBase link is base of mechanism
   //! \return created link label
-  Standard_EXPORT TDF_Label AddBaseLink(const TDF_Label& theMechanism,
-                                        const TDF_LabelSequence& theShapes);
+  Standard_EXPORT TDF_Label AddLink(const TDF_Label& theMechanism,
+                                    const TDF_LabelSequence& theShapes,
+                                    const Standard_Boolean& IsBase = Standard_False);
 
   //! Adds new label with link.
   //! \param[in] theMechanism parent mechanism
   //! \param[in] theShape singular detail of link
   //! \return created link label
   Standard_EXPORT TDF_Label AddLink(const TDF_Label& theMechanism,
-                                    const TDF_Label& theShape);
+                                    const TDF_Label& theShapeá,
+                                    const Standard_Boolean& IsBase = Standard_False);
 
   //! Checks is the given label a link
   //! \return the result of check
@@ -113,6 +96,11 @@ public:
   Standard_EXPORT Standard_Boolean SetLink(const TDF_Label& theLink,
                                            const TDF_LabelSequence& theShapes);
 
+  //! Sets shapes references for link
+  //! param[in] theLink link to set base
+  //! \return true in case of success, false otherwise
+  Standard_EXPORT Standard_Boolean SetBaseLink(const TDF_Label& theLink);
+
   //! Sets shape reference for link
   //! \param[in] theLink link to set shape
   //! \param[in] theShape singular detail of link
@@ -179,6 +167,11 @@ public:
   //! \return a joint
   Standard_EXPORT TDF_Label GetJointOfValue(const TDF_Label& theValue) const;
 
+  //! Gets references to links of the given joint.
+  //! \param[in] theJoint joint to get
+  //! \return set of values
+  Standard_EXPORT TDF_LabelSequence GetValuesOfJoint(const TDF_Label& theJoint) const;
+
   //! Removes the given state
   //! \param[in] theState state to remove
   Standard_EXPORT void RemoveState(const TDF_Label& theState);
index 2b080e5e8724df2f70b7af13a30973a477a68367..2d1483c357657feb8ef494fd86e0246902474e28 100644 (file)
@@ -16,6 +16,8 @@
 #include <XCAFKinematics_HighOrderPairObject.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(XCAFKinematics_HighOrderPairObject, XCAFKinematics_PairObject)
 
@@ -27,6 +29,7 @@ XCAFKinematics_HighOrderPairObject::
 XCAFKinematics_HighOrderPairObject()
 {
   myLimits = NULL;
+  isRanged = Standard_False;
 }
 
 //=======================================================================
@@ -43,6 +46,7 @@ XCAFKinematics_HighOrderPairObject(const Handle(XCAFKinematics_HighOrderPairObje
   myOrientation = theObj->myOrientation;
   myLimits = theObj->myLimits;
   myGeom = theObj->myGeom;
+  isRanged = theObj->HasLimits();
 }
 
 //=======================================================================
@@ -59,12 +63,12 @@ void XCAFKinematics_HighOrderPairObject::SetType(const XCAFKinematics_PairType t
     break;
   }
   case XCAFKinematics_PairType_SlidingSurface: {
-    myLimits = new TColStd_HArray1OfReal(1, 2);
+    myLimits = NULL;
     myGeom = NCollection_Array1<Handle(Geom_Geometry)>(1, 2);
     break;
   }
   case XCAFKinematics_PairType_RollingSurface: {
-    myLimits = new TColStd_HArray1OfReal(1, 2);
+    myLimits = NULL;
     myGeom = NCollection_Array1<Handle(Geom_Geometry)>(1, 2);
     break;
   }
@@ -84,6 +88,7 @@ void XCAFKinematics_HighOrderPairObject::SetType(const XCAFKinematics_PairType t
     break;
   }
   }
+
 }
 
 //=======================================================================
@@ -98,14 +103,6 @@ void XCAFKinematics_HighOrderPairObject::SetAllLimits(const Handle(TColStd_HArra
     aNbLimits = 6;
     break;
   }
-  case XCAFKinematics_PairType_SlidingSurface: {
-    aNbLimits = 2;
-    break;
-  }
-  case XCAFKinematics_PairType_RollingSurface: {
-    aNbLimits = 2;
-    break;
-  }
   case XCAFKinematics_PairType_PointOnPlanarCurve: {
     aNbLimits = 6;
     break;
@@ -113,7 +110,10 @@ void XCAFKinematics_HighOrderPairObject::SetAllLimits(const Handle(TColStd_HArra
   }
 
   if (theLimits->Length() == aNbLimits)
+  {
     myLimits = theLimits;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -122,10 +122,7 @@ void XCAFKinematics_HighOrderPairObject::SetAllLimits(const Handle(TColStd_HArra
 //=======================================================================
 Standard_Boolean XCAFKinematics_HighOrderPairObject::HasLimits() const
 {
-  Standard_Boolean IsConstraint = Standard_False;
-  for (Standard_Integer anInd = 1; anInd < myLimits->Length() && !IsConstraint; ++anInd)
-    IsConstraint = myLimits->Value(anInd) != NULL;
-  return IsConstraint;
+  return isRanged;
 }
 
 //=======================================================================
@@ -135,7 +132,10 @@ Standard_Boolean XCAFKinematics_HighOrderPairObject::HasLimits() const
 void XCAFKinematics_HighOrderPairObject::SetRotationLowLimit(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_SlidingSurface || Type() == XCAFKinematics_PairType_RollingSurface)
+  {
     myLimits->ChangeValue(1) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -156,7 +156,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::RotationLowLimit()
 void XCAFKinematics_HighOrderPairObject::SetRotationUpperLimit(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_SlidingSurface || Type() == XCAFKinematics_PairType_RollingSurface)
+  {
     myLimits->ChangeValue(2) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -177,7 +180,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::RotationUpperLimit()
 void XCAFKinematics_HighOrderPairObject::SetLowLimitYaw(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+  {
     myLimits->ChangeValue(1) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -198,7 +204,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::LowLimitYaw()
 void XCAFKinematics_HighOrderPairObject::SetUpperLimitYaw(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+  {
     myLimits->ChangeValue(2) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -219,7 +228,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::UpperLimitYaw()
 void XCAFKinematics_HighOrderPairObject::SetLowLimitRoll(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+  {
     myLimits->ChangeValue(3) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -240,7 +252,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::LowLimitRoll()
 void XCAFKinematics_HighOrderPairObject::SetUpperLimitRoll(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+  {
     myLimits->ChangeValue(4) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -261,7 +276,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::UpperLimitRoll()
 void XCAFKinematics_HighOrderPairObject::SetLowLimitPitch(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+  {
     myLimits->ChangeValue(5) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -282,7 +300,10 @@ Standard_Real XCAFKinematics_HighOrderPairObject::LowLimitPitch()
 void XCAFKinematics_HighOrderPairObject::SetUpperLimitPitch(const Standard_Real theLimit)
 {
   if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+  {
     myLimits->ChangeValue(6) = theLimit;
+    isRanged = Standard_True;
+  }
 }
 
 //=======================================================================
@@ -312,8 +333,16 @@ void XCAFKinematics_HighOrderPairObject::SetCurve(const Handle(Geom_Curve)& theC
 //=======================================================================
 Handle(Geom_Curve) XCAFKinematics_HighOrderPairObject::Curve() const
 {
-  if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve)
-    return Handle(Geom_Curve)::DownCast(myGeom.First());
+  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());
+  }
   return NULL;
 }
 
@@ -359,6 +388,28 @@ 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  : 
@@ -376,7 +427,13 @@ void XCAFKinematics_HighOrderPairObject::SetSurface(const Handle(Geom_Surface)&
 Handle(Geom_Surface) XCAFKinematics_HighOrderPairObject::Surface() const
 {
   if (Type() == XCAFKinematics_PairType_PointOnSurface)
-    return Handle(Geom_Surface)::DownCast(myGeom.First());
+    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 NULL;
 }
 
@@ -421,3 +478,25 @@ 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 3bbcc9fbaca33f77b392f08e38745bcb761b8a8a..a782f906ded938fafd10b8a4e213dafe1434b70a 100644 (file)
@@ -23,6 +23,8 @@
 
 class Geom_Curve;
 class Geom_Surface;
+class Geom_RectangularTrimmedSurface;
+class Geom_TrimmedCurve;
 
 DEFINE_STANDARD_HANDLE(XCAFKinematics_HighOrderPairObject, XCAFKinematics_PairObject)
 
@@ -62,7 +64,10 @@ public:
 
   Handle(TColStd_HArray1OfReal) GetAllLimits() const Standard_OVERRIDE
   {
-    return myLimits;
+    Handle(TColStd_HArray1OfReal) aLimitArray;
+    if (HasLimits())
+      aLimitArray = myLimits;
+    return aLimitArray;
   }
 
   //! Sets low limit of rotation attribute (only for SlidingSurface and RollingSurface)
@@ -153,6 +158,21 @@ public:
   //! \return curve
   Standard_EXPORT Handle(Geom_Curve) SecondCurve() const;
 
+  ////! Sets curve attribute (only for PointOnCurve)
+  ////! \param[in] theTrimmedCurve trimmed curve
+  //Standard_EXPORT void SetTrimmedCurve(const Standard_Real& theTrim1, const Standard_Real& theTrim2);
+
+  //! 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;
+
+  ////! \return trimmed curve
+  //Standard_EXPORT void TrimmedCurve(Standard_Real& theTrim1,Standard_Real& theTrim2) const;
+
   //! Sets surface attribute (only for PointOnSurface)
   //! \param[in] theSurface surface
   Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& theSurface);
@@ -177,6 +197,18 @@ public:
   //! \return surface
   Standard_EXPORT Handle(Geom_Surface) SecondSurface() const;
 
+  ////! Sets surface attribute (only for PointOnSurface)
+  ////! \param[in] theTrimmedSurface trimmed surface
+  //Standard_EXPORT void SetTrimmedSurface(const Standard_Real& U1, const Standard_Real& U2, const Standard_Real& V1, const Standard_Real& V2);
+
+  //! 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:
@@ -184,6 +216,7 @@ private:
   Standard_Boolean myOrientation;                   //!< orientation
   Handle(TColStd_HArray1OfReal) myLimits;           //!< array of limits, size depends on type
   NCollection_Array1<Handle(Geom_Geometry)> myGeom; //!< curve(s) or surface(s) attributes
+  Standard_Boolean isRanged;                         //!< flag "is limits defined"
 
 };
 
index c079c0da4587bc58f0b3a0f672f8994e18d7490d..475e9ee926fb6cd792f4d90c6bab3135a625697f 100644 (file)
@@ -36,6 +36,7 @@ XCAFKinematics_LowOrderPairObject::XCAFKinematics_LowOrderPairObject()
   myMaxTranslationY = Precision::Infinite();
   myMinTranslationZ = -Precision::Infinite();
   myMaxTranslationZ = Precision::Infinite();
+  isRanged = Standard_False;
 }
 
 //=======================================================================
@@ -61,6 +62,7 @@ XCAFKinematics_LowOrderPairObject::
   myMaxTranslationY = theObj->myMaxTranslationY;
   myMinTranslationZ = theObj->myMinTranslationZ;
   myMaxTranslationZ = theObj->myMaxTranslationZ;
+  isRanged = theObj->HasLimits();
 }
 
 //=======================================================================
@@ -68,8 +70,11 @@ XCAFKinematics_LowOrderPairObject::
 //purpose  : 
 //=======================================================================
 Handle(TColStd_HArray1OfReal) XCAFKinematics_LowOrderPairObject::GetAllLimits() const
-{
-  Handle(TColStd_HArray1OfReal) aLimitArray = new TColStd_HArray1OfReal(1, 12);
+{  
+  Handle(TColStd_HArray1OfReal) aLimitArray;
+  if (!HasLimits())
+    return aLimitArray;
+  aLimitArray = new TColStd_HArray1OfReal(1, 12);
   aLimitArray->ChangeValue(1) = myMinRotationX;
   aLimitArray->ChangeValue(2) = myMaxRotationX;
   aLimitArray->ChangeValue(3) = myMinRotationY;
@@ -91,20 +96,7 @@ Handle(TColStd_HArray1OfReal) XCAFKinematics_LowOrderPairObject::GetAllLimits()
 //=======================================================================
 Standard_Boolean XCAFKinematics_LowOrderPairObject::HasLimits() const
 {
-  return 
-  (  myMinRotationX != -Precision::Infinite() ||
-      myMaxRotationX != Precision::Infinite() ||
-     myMinRotationY != -Precision::Infinite() ||
-      myMaxRotationY != Precision::Infinite() ||
-     myMinRotationZ != -Precision::Infinite() ||
-      myMaxRotationZ != Precision::Infinite() ||
-  myMinTranslationX != -Precision::Infinite() ||
-   myMaxTranslationX != Precision::Infinite() ||
-  myMinTranslationY != -Precision::Infinite() ||
-   myMaxTranslationY != Precision::Infinite() ||
-  myMinTranslationZ != -Precision::Infinite() ||
-   myMaxTranslationZ != Precision::Infinite()
-  );
+  return isRanged;
 }
 
 //=======================================================================
@@ -127,4 +119,5 @@ void XCAFKinematics_LowOrderPairObject::SetAllLimits(const Handle(TColStd_HArray
   myMaxTranslationY = theLimits->Value(10);
   myMinTranslationZ = theLimits->Value(11);
   myMaxTranslationZ = theLimits->Value(12);
+  isRanged = Standard_True;
 }
index abc982871196c3436746815195a94f7c42eaa7a5..53c961f626f0ed2e447138ac9a176f1ee33f5665 100644 (file)
@@ -52,6 +52,7 @@ public:
   void SetMinRotationX(const Standard_Real theLimit)
   {
     myMinRotationX = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MinRotationX() const
@@ -62,6 +63,7 @@ public:
   void SetMaxRotationX(const Standard_Real theLimit)
   {
     myMaxRotationX = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MaxRotationX() const
@@ -74,6 +76,7 @@ public:
   void SetMinRotationY(const Standard_Real theLimit)
   {
     myMinRotationY = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MinRotationY() const
@@ -84,6 +87,7 @@ public:
   void SetMaxRotationY(const Standard_Real theLimit)
   {
     myMaxRotationY = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MaxRotationY() const
@@ -96,6 +100,7 @@ public:
   void SetMinRotationZ(const Standard_Real theLimit)
   {
     myMinRotationZ = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MinRotationZ() const
@@ -106,6 +111,7 @@ public:
   void SetMaxRotationZ(const Standard_Real theLimit)
   {
     myMaxRotationZ = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MaxRotationZ() const
@@ -118,6 +124,7 @@ public:
   void SetMinTranslationX(const Standard_Real theLimit)
   {
     myMinTranslationX = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MinTranslationX() const
@@ -128,6 +135,7 @@ public:
   void SetMaxTranslationX(const Standard_Real theLimit)
   {
     myMaxTranslationX = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MaxTranslationX() const
@@ -140,6 +148,7 @@ public:
   void SetMinTranslationY(const Standard_Real theLimit)
   {
     myMinTranslationY = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MinTranslationY() const
@@ -150,6 +159,7 @@ public:
   void SetMaxTranslationY(const Standard_Real theLimit)
   {
     myMaxTranslationY = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MaxTranslationY() const
@@ -162,6 +172,7 @@ public:
   void SetMinTranslationZ(const Standard_Real theLimit)
   {
     myMinTranslationZ = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MinTranslationZ() const
@@ -172,6 +183,7 @@ public:
   void SetMaxTranslationZ(const Standard_Real theLimit)
   {
     myMaxTranslationZ = theLimit;
+    isRanged = Standard_True;
   }
 
   Standard_Real MaxTranslationZ() const
@@ -217,6 +229,7 @@ private:
   Standard_Real myMinTranslationZ; //!< minimum value of translation in z-direction
   Standard_Real myMaxTranslationZ; //!< maximum value of translation in z-direction
   Standard_Real mySkewAngle;       //!< param for universal/homokinetic pair
+  Standard_Boolean isRanged;        //!< flag "is limits defined"
 
 };
 
index 58a58281a9cc4bdb04efc0f69899aba437893aad..149ccf09c6521761fad4137ffda9e17e7d6f2cd0 100644 (file)
@@ -24,6 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFKinematics_LowOrderPairObjectWithCoupling, XCAFKi
 XCAFKinematics_LowOrderPairObjectWithCoupling::
   XCAFKinematics_LowOrderPairObjectWithCoupling()
 {
+  isRanged = Standard_False;
   myLowLimit = -Precision::Infinite();
   myUpperLimit = Precision::Infinite();
   myParams = NULL;
@@ -40,6 +41,7 @@ XCAFKinematics_LowOrderPairObjectWithCoupling::
   SetType(theObj->Type());
   SetFirstTransformation(theObj->FirstTransformation());
   SetSecondTransformation(theObj->SecondTransformation());
+  isRanged = theObj->HasLimits();
   myLowLimit = theObj->LowLimit();
   myUpperLimit = theObj->UpperLimit();
   myParams = theObj->GetAllParams();
@@ -64,7 +66,10 @@ void XCAFKinematics_LowOrderPairObjectWithCoupling::SetType(const XCAFKinematics
 //=======================================================================
 Handle(TColStd_HArray1OfReal) XCAFKinematics_LowOrderPairObjectWithCoupling::GetAllLimits() const
 {
-  Handle(TColStd_HArray1OfReal) aLimitArray = new TColStd_HArray1OfReal(1, 2);
+  Handle(TColStd_HArray1OfReal) aLimitArray;
+  if (!HasLimits())
+    return aLimitArray;
+  aLimitArray = new TColStd_HArray1OfReal(1, 2);
   aLimitArray->ChangeValue(1) = myLowLimit;
   aLimitArray->ChangeValue(2) = myUpperLimit;
   return aLimitArray;
@@ -233,10 +238,7 @@ void XCAFKinematics_LowOrderPairObjectWithCoupling::SetAllParams(const Handle(TC
 //=======================================================================
 Standard_Boolean XCAFKinematics_LowOrderPairObjectWithCoupling::HasLimits() const
 {
-  return
-    (  myLowLimit != -Precision::Infinite() ||
-      myUpperLimit != Precision::Infinite()
-    );
+  return isRanged;
 }
 
 //=======================================================================
@@ -247,6 +249,7 @@ void XCAFKinematics_LowOrderPairObjectWithCoupling::SetAllLimits(const Handle(TC
 {
   if (theLimits->Length() == 2)
   {
+    isRanged = Standard_True;
     myLowLimit = theLimits->Value(1);
     myUpperLimit = theLimits->Value(2);
   }
index 3234cb65af81d55927fcf7ac93feea85e2eb4f9d..58772632159f25187554a8aed72b60f5d3eee854 100644 (file)
@@ -41,6 +41,7 @@ public:
 
   void SetLowLimit(const Standard_Real theLimit)
   {
+    isRanged = Standard_True;
     myLowLimit = theLimit;
   }
 
@@ -51,6 +52,7 @@ public:
 
   void SetUpperLimit(const Standard_Real theLimit)
   {
+    isRanged = Standard_True;
     myUpperLimit = theLimit;
   }
 
@@ -139,6 +141,7 @@ private:
   Standard_Real myLowLimit;               //!< low limit of motion range
   Standard_Real myUpperLimit;             //!< upper limit of motion range
   Handle(TColStd_HArray1OfReal) myParams; //!< additional parameters of kinematic pair
+  Standard_Boolean isRanged;               //!< flag "is limits defined"
 
 };
 
index 4f9bb66fb74f011f0801f0a6177dc9e41b4b869c..fb690a7f3c353439b4b0471bcd8e47105d2ee23c 100644 (file)
@@ -29,6 +29,8 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <XCAFDoc_DocumentTool.hxx>
 #include <XCAFDoc_KinematicPair.hxx>
 #include <XCAFDoc_KinematicPairValue.hxx>
@@ -162,7 +164,7 @@ static Standard_Integer removeMechanism(Draw_Interpretor& di, Standard_Integer a
 static Standard_Integer addLink(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
   if (argc < 3) {
-    di << "Use: XAddLink Doc ParentMechanism [-Base] [shapeLabel1 .. shapeLabelN]\n";
+    di << "Use: XAddLink Doc ParentMechanism [-base] [shapeLabel1 .. shapeLabelN]\n";
     return 1;
   }
 
@@ -173,7 +175,7 @@ static Standard_Integer addLink(Draw_Interpretor& di, Standard_Integer argc, con
   TDF_Label aMechanism;
   if (!getLabel(di, aDoc, argv[2], aMechanism))
     return 1;
-  Standard_Boolean IsBase = argc >= 4 && TCollection_AsciiString(argv[3]).IsEqual("-Base");
+  Standard_Boolean IsBase = argc >= 4 && TCollection_AsciiString(argv[3]).IsEqual("-base");
   TDF_LabelSequence aShapeArray;
   for (Standard_Integer i = (IsBase) ? 4 : 3; i < argc; i++) {
     TDF_Label aLabel;
@@ -183,10 +185,7 @@ static Standard_Integer addLink(Draw_Interpretor& di, Standard_Integer argc, con
   }
 
   Handle(XCAFDoc_KinematicTool) aTool = XCAFDoc_DocumentTool::KinematicTool(aDoc->Main());
-  if(IsBase)
-    di << getEntry(aTool->AddBaseLink(aMechanism, aShapeArray));
-  else 
-    di << getEntry(aTool->AddLink(aMechanism, aShapeArray));
+  di << getEntry(aTool->AddLink(aMechanism, aShapeArray, IsBase));
   return 0;
 }
 
@@ -196,8 +195,8 @@ static Standard_Integer addLink(Draw_Interpretor& di, Standard_Integer argc, con
 //=======================================================================
 static Standard_Integer setLink(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
-  if (argc < 3) {
-    di << "Use: XAddLink Doc Link shapeLabel1 .. shapeLabelN\n";
+  if (argc < 4) {
+    di << "Use: XSetLink Doc Link shapeLabel1 .. shapeLabelN\n";
     return 1;
   }
 
@@ -224,6 +223,32 @@ static Standard_Integer setLink(Draw_Interpretor& di, Standard_Integer argc, con
   return 0;
 }
 
+//=======================================================================
+//function : setBaseLink
+//purpose  : 
+//=======================================================================
+static Standard_Integer setBaseLink(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XSetBaseLink Doc Link\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDoc;
+  if (!getDocument(di, argv[1], aDoc))
+    return 1;
+
+  TDF_Label aLink;
+  if (!getLabel(di, aDoc, argv[2], aLink))
+    return 1;
+
+  Handle(XCAFDoc_KinematicTool) aTool = XCAFDoc_DocumentTool::KinematicTool(aDoc->Main());
+  if (!aTool->SetBaseLink(aLink))
+    return 1;
+
+  return 0;
+}
+
 //=======================================================================
 //function : isLink
 //purpose  : 
@@ -804,7 +829,8 @@ static Standard_Integer setLimits(Draw_Interpretor& di, Standard_Integer argc, c
   if (aJoint.FindAttribute(XCAFDoc_KinematicPair::GetID(), aPair)) {
     Handle(XCAFKinematics_PairObject) anObject = aPair->GetObject();
     anObject->SetAllLimits(aLimitArray);
-    aPair->SetObject(anObject);
+    if (anObject->HasLimits())
+      aPair->SetObject(anObject);
   }
 
   return 0;
@@ -1159,7 +1185,10 @@ static Standard_Integer getGeomParam(Draw_Interpretor& di, Standard_Integer argc
     // Surface
     Handle(Geom_Surface) aSurface;
     if (anObject->Type() == XCAFKinematics_PairType_PointOnSurface)
-      aSurface = anObject->Surface();
+      if (!anObject->HasLimits())
+        aSurface = anObject->Surface();
+      else
+        aSurface = anObject->TrimmedSurface();
     else {
       switch (aTrsfNb) {
       case 1: aSurface = anObject->FirstSurface();
@@ -1177,7 +1206,10 @@ static Standard_Integer getGeomParam(Draw_Interpretor& di, Standard_Integer argc
     // Curve
     Handle(Geom_Curve) aCurve;
     if (anObject->Type() == XCAFKinematics_PairType_PointOnPlanarCurve)
+    if (!anObject->HasLimits())
       aCurve = anObject->Curve();
+    else
+      aCurve = anObject->TrimmedCurve();
     else {
       switch (aTrsfNb) {
       case 1: aCurve = anObject->FirstCurve();
@@ -1532,12 +1564,15 @@ void XDEDRAW_Kinematics::InitCommands(Draw_Interpretor& di)
   di.Add("XRemoveMechanism", "XRemoveMechanism Doc Label",
     __FILE__, removeMechanism, g);
 
-  di.Add("XAddLink", "XAddLink Doc ParentMechanism [-Base] [shapeLabel1 .. shapeLabelN]",
+  di.Add("XAddLink", "XAddLink Doc ParentMechanism [-base] [shapeLabel1 .. shapeLabelN]",
     __FILE__, addLink, g);
 
   di.Add("XSetLink", "XSetLink Doc Link shapeLabel1 .. shapeLabelN",
     __FILE__, setLink, g);
 
+  di.Add("XSetBaseLink", "XSetBaseLink Doc Link",
+    __FILE__, setBaseLink, g);
+
   di.Add("XIsLink", "XIsLink Doc Label",
     __FILE__, isLink, g);
 
index f65a581d781a420fbf2991792c561fec21e5237f..fb3257f8ebfd07f55efb0d6bce446a53782ea58d 100644 (file)
@@ -52,8 +52,8 @@ set result [XGetPairName D $joint1]
 if {$result != "Low order"} {
   puts "Error: wrong kinematic pair data."
 }
-plane p1 0 0 0 1 0 0
-plane p2 0 0 0 0 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint1 1 p1
 set dump_in [dump p1]
 XGetPairTransformation D $joint1 1 p1
@@ -110,9 +110,8 @@ if {[lindex $params 20] != "5"} {
 }
 
 set joint3 [XAddJoint D $mech $link3 $link2]
-XSetPairType D $joint3 15
+XSetPairType D $joint3 16
 XSetPairName D $joint3 High order surface
-XSetPairLimits D $joint3 30 60
 sphere sph 4 4 4 1
 set dump_in [dump sph]
 XSetPairGeomParam D $joint3 1 sph
@@ -121,6 +120,7 @@ set dump_out [dump sph]
 if {$dump_in != $dump_out} {
   puts "Error: wrong kinematic pair data."
 }
+XSetPairLimits D $joint3 30 60
 cylinder cyl 0 0 0 0 1 0 2
 trim cyl cyl 0 2 0 2
 set dump_in [dump cyl]
@@ -133,7 +133,7 @@ if {$dump_in != $dump_out} {
 }
 
 set joint4 [XAddJoint D $mech $link3 0:1:11:1:1:1]
-XSetPairType D $joint4 17
+XSetPairType D $joint4 18
 XSetPairName D $joint4 High order curve
 circle cir 0 0 0 3
 set dump_in [dump cir]
index f5434a7f08f609177ce64772dfd050feb6a1bfd4..11a13ee44b9b38014041f3bc688a620737bfe4f0 100644 (file)
@@ -8,7 +8,7 @@ XAddShape D b
 XAddShape D bb
 set mech [XAddMechanism D]
 set link1 [XAddLink D $mech 0:1:1:1]
-set link2 [XAddLink D $mech 0:1:1:2]
+set link2 [XAddLink D $mech -base 0:1:1:2]
 set joint [XAddJoint D $mech $link1 $link2]
 
 # Start testing
@@ -23,8 +23,8 @@ if {$type != "2"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 0 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,9 +40,9 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 0 45 0 0 0 0 0 0 0 0 0 0
+XSetPairLimits D $joint 0 0 0 0 0 45 0 0 0 0 0 0
 set limits [XGetPairLimits D $joint]
-if {$limits != "0 45 0 0 0 0 0 0 0 0 0 0 "} {
+if {$limits != "0 0 0 0 0 45 0 0 0 0 0 0 "} {
   puts "Error: wrong parameter"
 }
 
@@ -54,22 +54,5 @@ set values [XGetPairValues D $value -rotation]
 if {$values != "15"} {
   puts "Error: wrong parameter"
 }
-set link4 [XAddLink D $mech -Base 0:1:1:2]
-set link3 [XAddLink D $mech 0:1:1:1]
-set joint2 [XAddJoint D $mech $link3 $link4]
-
-XSetPairTransformation D $joint2 1 p1
-XSetPairTransformation D $joint2 2 p2
-set dump_in [dump p1]
-XGetPairTransformation D $joint 1 p1
-set dump_out [dump p1]
-if {$dump_in != $dump_out} {
-  puts "Error: wrong parameter"
-}
-set dump_in [dump p2]
-XGetPairTransformation D $joint 2 p2
-set dump_out [dump p2]
-if {$dump_in != $dump_out} {
-  puts "Error: wrong parameter"
-}
 
+Close D
\ No newline at end of file
index 767d746e8fce156e2cc0e8ffb1b7e55705fe6b07..6933c49132927c9254855c737311cb40b6aa0170 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "3"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 1 0 0 0 1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,9 +40,9 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 0 0 0 0 0 0 0 0 0 10 0 0
+XSetPairLimits D $joint 0 0 0 0 0 0 0 10 0 0 0 0
 set limits [XGetPairLimits D $joint]
-if {$limits != "0 0 0 0 0 0 0 0 0 10 0 0 "} {
+if {$limits != "0 0 0 0 0 0 0 10 0 0 0 0 "} {
   puts "Error: wrong parameter"
 }
 
@@ -55,4 +55,4 @@ if {$values != "3"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index d1e22eccfa182e5f3d6f2e939c6e7102d66e1279..400c53d25a21cb0b36e63618bc82a7435478432d 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "4"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 1 0 0 0 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,9 +40,9 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 0 45 0 0 0 0 0 0 0 10 0 0
+XSetPairLimits D $joint 0 0 0 0 0 45 0 0 0 0 0 45
 set limits [XGetPairLimits D $joint]
-if {$limits != "0 45 0 0 0 0 0 0 0 10 0 0 "} {
+if {$limits != "0 0 0 0 0 45 0 0 0 0 0 45 "} {
   puts "Error: wrong parameter"
 }
 
@@ -60,5 +60,5 @@ set values [XGetPairValues D $value -rotation]
 if {$values != "15"} {
   puts "Error: wrong parameter"
 }
-Close D
 
+Close D
\ No newline at end of file
index 27421bdbf1d3f6316a346d373ce258f61daf5eaa..9bef9571cfac10e0fb7804b58464602206bb3e76 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "5"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 1 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,9 +40,9 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 0 45 10 20 0 0 0 0 0 0 0 0
+XSetPairLimits D $joint 0 25 0 0 0 45 0 0 0 0 0 0
 set limits [XGetPairLimits D $joint]
-if {$limits != "0 45 10 20 0 0 0 0 0 0 0 0 "} {
+if {$limits != "0 25 0 0 0 45 0 0 0 0 0 0 "} {
   puts "Error: wrong parameter"
 }
 
@@ -65,4 +65,4 @@ if {$values != "15"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 802121009501edbad1f903e54c5a40bb3d5f9591..65548c221b33fcbfd7f52738dfa4183c6b1e3d12 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "6"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 1 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,12 +40,6 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 0 45 0 45 0 0 0 0 0 0 0 0
-set limits [XGetPairLimits D $joint]
-if {$limits != "0 45 0 45 0 0 0 0 0 0 0 0 "} {
-  puts "Error: wrong parameter"
-}
-
 XSetPairParams D $joint 30
 set param [XGetPairParams D $joint]
 if {$param != "Skew Angle = 30"} {
@@ -65,4 +59,4 @@ if {$values != "20"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index f8ff00d14a8149c6e010c04401b21a289966e331..d08eb54f29a459fe7376f1ef38823c29f6d05efb 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "7"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 1 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -55,4 +55,4 @@ if {$values != "10 0 30"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index ec3e7dbac7db907f908ec312a62631e0fe47ab31..bb4ffdc7bd516b74e4ff75455607a59d7d4d3f2f 100644 (file)
@@ -12,9 +12,9 @@ set link2 [XAddLink D $mech 0:1:1:2]
 set joint [XAddJoint D $mech $link1 $link2]
 
 # Start testing
-XSetPairName D $joint spherical with pin
+XSetPairName D $joint spherical
 set name [XGetPairName D $joint]
-if {$name != "spherical with pin"} {
+if {$name != "spherical"} {
   puts "Error: wrong parameter"
 }
 XSetPairType D $joint 8
@@ -23,8 +23,8 @@ if {$type != "8"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 1 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -55,4 +55,4 @@ if {$values != "10 20 30"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 171fe6477b49f770352523dacd90ccc584d8e1e0..1c893f8707e6f3ecc3366c9854812cf02a6fb0b0 100644 (file)
@@ -64,4 +64,4 @@ if {$values != "2.1"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 6a8b2d98603547ecf85645de7c2fb34d2c830792..eac4dec9c08758a41ac03bffa4e9eea0d6aff0d3 100644 (file)
@@ -56,4 +56,4 @@ if {$values!= "10 10 10\n1 0 0\n0 -1 0"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 649859020d6b1dcc8df6b9ff78f0773018c2534b..44c6fc2e2f6f68cba5f8c4694d3b3f381a911666 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "11"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 0 1 1 1 0
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
index 09925c8148655bad71117eddce67d89d3a823c22..284f305589dde5640ccfb9c01e376b7028445ed1 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "12"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 0 1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
index 047835c04417275ce04919bc560bd64a51697e7f..c5853c1f46c58be00a306eaaf2e94e53e077f2cf 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "13"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 0 1
-plane p2 0 0 0 0 0 1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -61,4 +61,4 @@ if {$values != "24"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 5d708a5649e1bc69bc409d3c56c8f1d07ec0d82d..f88a42aa217b8f88de2945cd59767fce132c5e4e 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "15"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 1 0 1 1 0
-plane p2 0 0 0 0 0 1 0 1 -1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -46,11 +46,13 @@ if {$limits != "10 20 30 40 50 60 "} {
   puts "Error: wrong parameter"
 }
 
-sphere sph 4 4 4 1
-XSetPairGeomParam D $joint 1 sph
-set dump_in [dump sph]
-XGetPairGeomParam D $joint 1 sph
-set dump_out [dump sph]
+cylinder cy 10 
+trimv cy cy 0 50 
+trimu cy cy 0 50
+XSetPairGeomParam D $joint 1 cy
+set dump_in [dump cy]
+XGetPairGeomParam D $joint 1 cy
+set dump_out [dump cy]
 if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
@@ -74,4 +76,4 @@ if {$values != "12 13 14"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 4d8c16c17d86e3c98d38508c97f900f9ca170ef1..44c213c84eb1a829cf36909269dc7261ba455830 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "16"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 1 0 1 1 0
-plane p2 0 0 0 0 0 1 0 1 -1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,12 +40,6 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 10 20
-set limits [XGetPairLimits D $joint]
-if {$limits != "10 20 "} {
-  puts "Error: wrong parameter"
-}
-
 sphere sph1 4 4 4 1
 plane p2 0 0 0 1 0 0
 XSetPairGeomParam D $joint 1 sph1
@@ -86,4 +80,4 @@ if {$values != "30"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index c0c8f364d6e5f437f92e538cf0def12103dcf4df..7d019a3ee812de3708a2f1a74c0c110fe1599d75 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "17"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 1 0 1 1 0
-plane p2 0 0 0 0 0 1 0 1 -1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -40,12 +40,6 @@ if {$dump_in != $dump_out} {
   puts "Error: wrong parameter"
 }
 
-XSetPairLimits D $joint 10 20
-set limits [XGetPairLimits D $joint]
-if {$limits != "10 20 "} {
-  puts "Error: wrong parameter"
-}
-
 sphere sph1 4 4 4 1
 plane p2 0 0 0 1 0 0
 XSetPairGeomParam D $joint 1 sph1
@@ -82,4 +76,4 @@ if {$values != "30"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index 172b1393f4f6de2608d04d190f6a0ab79a29ff35..18704ec670312c4d3e8335eb718ce271a3505b26 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "18"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 1 0 1 1 0
-plane p2 0 0 0 0 0 1 0 1 -1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -47,6 +47,7 @@ if {$limits != "10 20 30 40 50 60 "} {
 }
 
 circle cir 4 4 4 1
+trim cir cir 0 pi/2 
 XSetPairGeomParam D $joint 1 cir
 set dump_in [dump cir]
 XGetPairGeomParam D $joint 1 cir
index cdf6677f5e0ef3c7c2b3a124cec21ce2f667a005..cac4981ba8691e8c40b253ad8b85707c7cfbbb7e 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "19"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 1 0 1 1 0
-plane p2 0 0 0 0 0 1 0 1 -1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -76,4 +76,4 @@ if {$values != "7"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file
index d97ab780b873cc3bd263a2a1920f4e05dc42dc1e..623375d798e379031077e573584bc6e555adf145 100644 (file)
@@ -23,8 +23,8 @@ if {$type != "20"} {
   puts "Error: wrong parameter"
 }
 
-plane p1 0 0 0 0 1 0 1 1 0
-plane p2 0 0 0 0 0 1 0 1 -1
+plane p1 10 20 30 -1 0 0 
+plane p2 10 0 0 1 0 0 0 1 0 
 XSetPairTransformation D $joint 1 p1
 XSetPairTransformation D $joint 2 p2
 set dump_in [dump p1]
@@ -72,4 +72,4 @@ if {$values != "1.5"} {
   puts "Error: wrong parameter"
 }
 
-Close D
+Close D
\ No newline at end of file