示例#1
0
        public Datum(CyPhy.CADDatum datum,
                     string compid, bool guide)
        {
            DatumName = datum.Attributes.DatumName;
            if (datum.Kind == "CoordinateSystem")
            {
                Type = DatumType.CSYS;
            }
            else if (datum.Kind == "Point")
            {
                Type = DatumType.Point;
            }
            else if (datum.Kind == "Surface")
            {
                Type = DatumType.Surface;
            }
            else if (datum.Kind == "Axis")
            {
                Type = DatumType.Axis;
            }

            ComponentID = compid;
            DatumID     = datum.ID;
            Guide       = guide;
            if (!String.IsNullOrEmpty(datum.Attributes.GeometricMarker))
            {
                Marker = new GeometryMarkerRep(datum.Attributes.GeometricMarker);
            }
        }
示例#2
0
        public CyPhy.KinematicJoint CyphyJoint; // The original joint

        public KinematicJoint(CyPhy.KinematicJoint kJoint)
        {
            CyphyJoint = kJoint;
            JointType  = GetJointType(kJoint);
            Name       = kJoint.Name;
            CyPhyID    = kJoint.ID;

            // TODO: Error handling - many things can go wrong here
            if (kJoint is CyPhy.HasKinematicRotationalLimit)
            {
                foreach (var limit in (kJoint as CyPhy.HasKinematicRotationalLimit).SrcConnections.KinematicRotationalLimitCollection)
                {
                    if (limit.Attributes.LimitType == CyPhyClasses.KinematicRotationalLimit.AttributesClass.LimitType_enum.Default)
                    {
                        RotationLimitDefault = Double.Parse(limit.SrcEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicRotationalLimit.AttributesClass.LimitType_enum.Max)
                    {
                        RotationLimitMax = Double.Parse(limit.SrcEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicRotationalLimit.AttributesClass.LimitType_enum.Min)
                    {
                        RotationLimitMin = Double.Parse(limit.SrcEnds.Parameter.Attributes.Value);
                    }
                }
            }
            if (kJoint is CyPhy.HasKinematicTranslationalLimit)
            {
                foreach (var limit in (kJoint as CyPhy.HasKinematicTranslationalLimit).DstConnections.KinematicTranslationallLimitCollection)
                {
                    if (limit.Attributes.LimitType == CyPhyClasses.KinematicTranslationallLimit.AttributesClass.LimitType_enum.Default)
                    {
                        TranslationLimitDefault = Double.Parse(limit.DstEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicTranslationallLimit.AttributesClass.LimitType_enum.Max)
                    {
                        TranslationLimitMax = Double.Parse(limit.DstEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicTranslationallLimit.AttributesClass.LimitType_enum.Min)
                    {
                        TranslationLimitMin = Double.Parse(limit.DstEnds.Parameter.Attributes.Value);
                    }
                }
            }

            if (!String.IsNullOrEmpty(kJoint.Attributes.GeometricMarker))
            {
                Marker = new GeometryMarkerRep(kJoint.Attributes.GeometricMarker);
                if (kJoint.ParentContainer.ParentContainer.Kind == "Component")
                {
                    Marker.ComponentID = CyPhyClasses.Component.Cast(kJoint.ParentContainer.ParentContainer.Impl).Attributes.InstanceGUID;
                }
            }
        }
示例#3
0
        public Datum(CyPhy.CADDatum datum,
                     string compid, bool guide)
        {
            DatumName = datum.Attributes.DatumName;
            if (datum.Kind == "CoordinateSystem")
                Type = DatumType.CSYS;
            else if (datum.Kind == "Point")
                Type = DatumType.Point;
            else if (datum.Kind == "Surface")
                Type = DatumType.Surface;
            else if (datum.Kind == "Axis")
                Type = DatumType.Axis;

            ComponentID = compid;
            DatumID = datum.ID;
            Guide = guide;
            if (!String.IsNullOrEmpty(datum.Attributes.GeometricMarker))
                Marker = new GeometryMarkerRep(datum.Attributes.GeometricMarker);
        }
        public CyPhy.KinematicJoint CyphyJoint; // The original joint

        public KinematicJoint(CyPhy.KinematicJoint kJoint)
        {
            CyphyJoint = kJoint;
            JointType = GetJointType(kJoint);
            Name = kJoint.Name;
            CyPhyID = kJoint.ID;

            // TODO: Error handling - many things can go wrong here
            if (kJoint is CyPhy.HasKinematicRotationalLimit)
            {
                foreach (var limit in (kJoint as CyPhy.HasKinematicRotationalLimit).SrcConnections.KinematicRotationalLimitCollection)
                {
                    if (limit.Attributes.LimitType == CyPhyClasses.KinematicRotationalLimit.AttributesClass.LimitType_enum.Default)
                    {
                        RotationLimitDefault = Double.Parse(limit.SrcEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicRotationalLimit.AttributesClass.LimitType_enum.Max)
                    {
                        RotationLimitMax = Double.Parse(limit.SrcEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicRotationalLimit.AttributesClass.LimitType_enum.Min)
                    {
                        RotationLimitMin = Double.Parse(limit.SrcEnds.Parameter.Attributes.Value);
                    }
                }
            }
            if (kJoint is CyPhy.HasKinematicTranslationalLimit)
            {
                foreach (var limit in (kJoint as CyPhy.HasKinematicTranslationalLimit).DstConnections.KinematicTranslationallLimitCollection)
                {
                    if (limit.Attributes.LimitType == CyPhyClasses.KinematicTranslationallLimit.AttributesClass.LimitType_enum.Default)
                    {
                        TranslationLimitDefault = Double.Parse(limit.DstEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicTranslationallLimit.AttributesClass.LimitType_enum.Max)
                    {
                        TranslationLimitMax = Double.Parse(limit.DstEnds.Parameter.Attributes.Value);
                    }
                    else if (limit.Attributes.LimitType == CyPhyClasses.KinematicTranslationallLimit.AttributesClass.LimitType_enum.Min)
                    {
                        TranslationLimitMin = Double.Parse(limit.DstEnds.Parameter.Attributes.Value);
                    }
                }
            }

            if (!String.IsNullOrEmpty(kJoint.Attributes.GeometricMarker))
            {
                Marker = new GeometryMarkerRep(kJoint.Attributes.GeometricMarker);
                if (kJoint.ParentContainer.ParentContainer.Kind == "Component")
                {
                    Marker.ComponentID = CyPhyClasses.Component.Cast(kJoint.ParentContainer.ParentContainer.Impl).Attributes.InstanceGUID;
                }
            }


        }