-// 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.
//
-// 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.
-// 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.
//
-// 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.
//
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,
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());
}
//=======================================================================
iter.AddItem (ent->ActualPointOnCurve());
- iter.AddItem (ent->InputOrientation().Value());
+ if (!ent->InputOrientation().RotationAboutDirection().IsNull())
+ iter.AddItem(ent->InputOrientation().Value());
}
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,
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());
}
//=======================================================================
iter.AddItem (ent->ActualPointOnSurface());
- iter.AddItem (ent->InputOrientation().Value());
+ if (!ent->InputOrientation().RotationAboutDirection().IsNull())
+ iter.AddItem(ent->InputOrientation().Value());
}
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,
//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());
}
//=======================================================================
// Own fields of SphericalPairValue
- iter.AddItem (ent->InputOrientation().Value());
+ if (!ent->InputOrientation().RotationAboutDirection().IsNull())
+ iter.AddItem(ent->InputOrientation().Value());
}
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();
{
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;
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());
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
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());
// 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);
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);
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)))
{
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)))
{
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;
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)))
{
aValueObject = new XCAFKinematics_PairValueObject();
aValueObject->SetType(aType);
+ if (aType == 0)
+ return Standard_False;
TDF_TagSource aTag;
TDF_Label aValueL = aTag.NewChild(aState);
}
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())
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)
#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>
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;
mySHUOMode(Standard_True),
myGDTMode(Standard_True),
myMatMode(Standard_True),
- myKPairMode(Standard_True)
+ myKinematicMode(Standard_True)
{
STEPCAFControl_Controller::Init();
Init ( WS, scratch );
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
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
const Interface_Graph& aGraph,
const TDF_Label& theLabelLink,
Handle(StepShape_ShapeRepresentation)& aShapeRepr,
- Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO)
+ Handle(StepRepr_PropertyDefinition)& aPDS)
{
theLink = new StepKinematics_KinematicLink;
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;
}
//=======================================================================
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();
}
}
{
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
{
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):
{
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,
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);
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);
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);
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,
}
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);
}
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);
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;
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;
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());
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());
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());
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):
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);
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):
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;
}
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):
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);
{
//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));
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);
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
//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);
{
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)
{
//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> 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> 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> 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> 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 :
void STEPCAFControl_Writer::SetKinematicsMode(const Standard_Boolean kinematicsmod)
{
- myKPairMode = kinematicsmod;
+ myKinematicMode = kinematicsmod;
}
//=======================================================================
Standard_Boolean STEPCAFControl_Writer::GetKinematicsMode() const
{
- return myKPairMode;
+ return myKinematicMode;
}
Standard_EXPORT Standard_Boolean GetMaterialMode() const;
- //! Set dimtolmode for indicate write D>s 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;
Standard_Boolean myLayerMode;
Standard_Boolean myPropsMode;
Standard_Boolean mySHUOMode;
- Standard_Boolean myKPairMode;
+ Standard_Boolean myKinematicMode;
MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
Standard_Boolean myGDTMode;
Standard_Boolean myMatMode;
-// 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.
//
-// 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.
//
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;
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)
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
-// 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.
//
-// 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.
//
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;
}
// 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>
#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>
{
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());
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());
// 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) {
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);
}
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);
}
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 :
#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>
//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;
}
//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;
//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);
}
//=======================================================================
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 :
}
-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);
//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;
//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;
//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))
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();
}
//=======================================================================
//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);
}
//! 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
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
//! \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);
#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)
XCAFKinematics_HighOrderPairObject()
{
myLimits = NULL;
+ isRanged = Standard_False;
}
//=======================================================================
myOrientation = theObj->myOrientation;
myLimits = theObj->myLimits;
myGeom = theObj->myGeom;
+ isRanged = theObj->HasLimits();
}
//=======================================================================
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;
}
break;
}
}
+
}
//=======================================================================
aNbLimits = 6;
break;
}
- case XCAFKinematics_PairType_SlidingSurface: {
- aNbLimits = 2;
- break;
- }
- case XCAFKinematics_PairType_RollingSurface: {
- aNbLimits = 2;
- break;
- }
case XCAFKinematics_PairType_PointOnPlanarCurve: {
aNbLimits = 6;
break;
}
if (theLimits->Length() == aNbLimits)
+ {
myLimits = theLimits;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
//=======================================================================
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;
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetRotationLowLimit(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_SlidingSurface || Type() == XCAFKinematics_PairType_RollingSurface)
+ {
myLimits->ChangeValue(1) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetRotationUpperLimit(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_SlidingSurface || Type() == XCAFKinematics_PairType_RollingSurface)
+ {
myLimits->ChangeValue(2) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetLowLimitYaw(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+ {
myLimits->ChangeValue(1) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetUpperLimitYaw(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+ {
myLimits->ChangeValue(2) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetLowLimitRoll(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+ {
myLimits->ChangeValue(3) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetUpperLimitRoll(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+ {
myLimits->ChangeValue(4) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetLowLimitPitch(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+ {
myLimits->ChangeValue(5) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
void XCAFKinematics_HighOrderPairObject::SetUpperLimitPitch(const Standard_Real theLimit)
{
if (Type() == XCAFKinematics_PairType_PointOnPlanarCurve || Type() == XCAFKinematics_PairType_PointOnSurface)
+ {
myLimits->ChangeValue(6) = theLimit;
+ isRanged = Standard_True;
+ }
}
//=======================================================================
//=======================================================================
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;
}
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 :
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;
}
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());
+}
class Geom_Curve;
class Geom_Surface;
+class Geom_RectangularTrimmedSurface;
+class Geom_TrimmedCurve;
DEFINE_STANDARD_HANDLE(XCAFKinematics_HighOrderPairObject, XCAFKinematics_PairObject)
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)
//! \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);
//! \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:
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"
};
myMaxTranslationY = Precision::Infinite();
myMinTranslationZ = -Precision::Infinite();
myMaxTranslationZ = Precision::Infinite();
+ isRanged = Standard_False;
}
//=======================================================================
myMaxTranslationY = theObj->myMaxTranslationY;
myMinTranslationZ = theObj->myMinTranslationZ;
myMaxTranslationZ = theObj->myMaxTranslationZ;
+ isRanged = theObj->HasLimits();
}
//=======================================================================
//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;
//=======================================================================
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;
}
//=======================================================================
myMaxTranslationY = theLimits->Value(10);
myMinTranslationZ = theLimits->Value(11);
myMaxTranslationZ = theLimits->Value(12);
+ isRanged = Standard_True;
}
void SetMinRotationX(const Standard_Real theLimit)
{
myMinRotationX = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MinRotationX() const
void SetMaxRotationX(const Standard_Real theLimit)
{
myMaxRotationX = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MaxRotationX() const
void SetMinRotationY(const Standard_Real theLimit)
{
myMinRotationY = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MinRotationY() const
void SetMaxRotationY(const Standard_Real theLimit)
{
myMaxRotationY = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MaxRotationY() const
void SetMinRotationZ(const Standard_Real theLimit)
{
myMinRotationZ = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MinRotationZ() const
void SetMaxRotationZ(const Standard_Real theLimit)
{
myMaxRotationZ = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MaxRotationZ() const
void SetMinTranslationX(const Standard_Real theLimit)
{
myMinTranslationX = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MinTranslationX() const
void SetMaxTranslationX(const Standard_Real theLimit)
{
myMaxTranslationX = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MaxTranslationX() const
void SetMinTranslationY(const Standard_Real theLimit)
{
myMinTranslationY = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MinTranslationY() const
void SetMaxTranslationY(const Standard_Real theLimit)
{
myMaxTranslationY = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MaxTranslationY() const
void SetMinTranslationZ(const Standard_Real theLimit)
{
myMinTranslationZ = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MinTranslationZ() const
void SetMaxTranslationZ(const Standard_Real theLimit)
{
myMaxTranslationZ = theLimit;
+ isRanged = Standard_True;
}
Standard_Real MaxTranslationZ() const
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"
};
XCAFKinematics_LowOrderPairObjectWithCoupling::
XCAFKinematics_LowOrderPairObjectWithCoupling()
{
+ isRanged = Standard_False;
myLowLimit = -Precision::Infinite();
myUpperLimit = Precision::Infinite();
myParams = NULL;
SetType(theObj->Type());
SetFirstTransformation(theObj->FirstTransformation());
SetSecondTransformation(theObj->SecondTransformation());
+ isRanged = theObj->HasLimits();
myLowLimit = theObj->LowLimit();
myUpperLimit = theObj->UpperLimit();
myParams = theObj->GetAllParams();
//=======================================================================
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;
//=======================================================================
Standard_Boolean XCAFKinematics_LowOrderPairObjectWithCoupling::HasLimits() const
{
- return
- ( myLowLimit != -Precision::Infinite() ||
- myUpperLimit != Precision::Infinite()
- );
+ return isRanged;
}
//=======================================================================
{
if (theLimits->Length() == 2)
{
+ isRanged = Standard_True;
myLowLimit = theLimits->Value(1);
myUpperLimit = theLimits->Value(2);
}
void SetLowLimit(const Standard_Real theLimit)
{
+ isRanged = Standard_True;
myLowLimit = theLimit;
}
void SetUpperLimit(const Standard_Real theLimit)
{
+ isRanged = Standard_True;
myUpperLimit = theLimit;
}
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"
};
#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>
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;
}
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;
}
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;
}
//=======================================================================
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;
}
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 :
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;
// 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();
// 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();
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);
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
}
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
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]
}
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]
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
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]
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"
}
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
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]
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"
}
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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"
}
if {$values != "15"} {
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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"
}
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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"} {
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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
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]
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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]
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]
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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"
}
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
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
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
}
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
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]
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file
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]
puts "Error: wrong parameter"
}
-Close D
+Close D
\ No newline at end of file