コード例 #1
0
        private CAD.PairType MakeRootConstraint(string location,
                                                string componentDispID,
                                                string assemblyID,
                                                bool rootIsAsmType,
                                                Datum datum)
        {
            CAD.PairType pair = new CAD.PairType();
            pair._id = UtilityHelpers.MakeUdmID();
            pair.FeatureGeometryType  = "SURFACE";
            pair.FeatureAlignmentType = "ALIGN";
            pair.FeatureInterfaceType = "CAD_DATUM";

            List <CAD.ConstraintFeatureType> featurelist = new List <CAD.ConstraintFeatureType>();

            CAD.ConstraintFeatureType constraintFeature = new CAD.ConstraintFeatureType();
            constraintFeature._id                    = UtilityHelpers.MakeUdmID();
            constraintFeature.ComponentID            = componentDispID;
            constraintFeature.FeatureOrientationType = "SIDE_A";
            if (rootIsAsmType)
            {
                constraintFeature.FeatureName = "ASM_" + location;
            }
            else
            {
                constraintFeature.FeatureName = location;
            }

            // META-3555 hack
            if (datum != null && datum.Marker != null)
            {
                constraintFeature.GeometryMarker = datum.Marker.ToCADXml();
            }

            featurelist.Add(constraintFeature);

            CAD.ConstraintFeatureType asmConstraint = new CAD.ConstraintFeatureType();
            asmConstraint._id                    = UtilityHelpers.MakeUdmID();
            asmConstraint.ComponentID            = assemblyID;
            asmConstraint.FeatureOrientationType = "SIDE_A";
            asmConstraint.FeatureName            = "ASM_" + location;
            featurelist.Add(asmConstraint);
            pair.ConstraintFeature = featurelist.ToArray();

            return(pair);
        }
コード例 #2
0
        private CAD.PairType MakeRootConstraint(string location,
                                                string componentDispID,
                                                string assemblyID,
                                                bool rootIsAsmType)
        {
            CAD.PairType pair = new CAD.PairType();
            pair._id = UtilityHelpers.MakeUdmID();
            pair.FeatureGeometryType = "SURFACE";
            pair.FeatureAlignmentType = "ALIGN";
            pair.FeatureInterfaceType = "CAD_DATUM";

            List<CAD.ConstraintFeatureType> featurelist = new List<CAD.ConstraintFeatureType>();
            CAD.ConstraintFeatureType constraintFeature = new CAD.ConstraintFeatureType();
            constraintFeature._id = UtilityHelpers.MakeUdmID();
            constraintFeature.ComponentID = componentDispID;
            constraintFeature.FeatureOrientationType = "SIDE_A";
            if (rootIsAsmType)
            {
                constraintFeature.FeatureName = "ASM_" + location;
            }
            else
            {
                constraintFeature.FeatureName = location;
            }
            featurelist.Add(constraintFeature);

            CAD.ConstraintFeatureType asmConstraint = new CAD.ConstraintFeatureType();
            asmConstraint._id = UtilityHelpers.MakeUdmID();
            asmConstraint.ComponentID = assemblyID;
            asmConstraint.FeatureOrientationType = "SIDE_A";
            asmConstraint.FeatureName = "ASM_" + location;
            featurelist.Add(asmConstraint);
            pair.ConstraintFeature = featurelist.ToArray();

            return pair;
        }
コード例 #3
0
        public CAD.ConstraintType ToCADXMLOutput(TestBenchModel.TestBenchBase testBenchBase)
        {
            CAD.ConstraintType constraintout = new CAD.ConstraintType();
            constraintout._id = UtilityHelpers.MakeUdmID();
            CADComponent src = Src as CADComponent;
            CADComponent dst = Dst as CADComponent;

            string srcid = src.DisplayID;
            string dstid = dst.DisplayID;

            if (ConstraintPairs.Any())
            {
                List<CAD.PairType> pairlist = new List<CAD.PairType>();

                foreach (var item in ConstraintPairs)
                {
                    List<CAD.ConstraintFeatureType> constrainfeaturelist = new List<CAD.ConstraintFeatureType>();
                    CAD.PairType pair = new CAD.PairType();
                    pair._id = UtilityHelpers.MakeUdmID();
                    pair.FeatureAlignmentType = item.Item1.Alignment;
                    pair.FeatureGeometryType = item.Item1.Type.ToString().ToUpper();
                    pair.FeatureInterfaceType = "CAD_DATUM";
                    if (item.Item1.Guide || item.Item2.Guide)
                    {
                        pair.Guide = "True";
                    }
                    
                    CAD.ConstraintFeatureType afeature = new CAD.ConstraintFeatureType();
                    afeature._id = UtilityHelpers.MakeUdmID();
                    afeature.ComponentID = item.Item1.ComponentID;
                    afeature.FeatureName = item.Item1.DatumName;
                    afeature.FeatureOrientationType = item.Item1.Orientation;
                    if (item.Item1.Marker != null)
                    {
                        afeature.GeometryMarker = item.Item1.Marker.ToCADXml();
                    }

                    CAD.ConstraintFeatureType bfeature = new CAD.ConstraintFeatureType();
                    bfeature._id = UtilityHelpers.MakeUdmID();
                    bfeature.ComponentID = item.Item2.ComponentID;
                    bfeature.FeatureName = item.Item2.DatumName;
                    bfeature.FeatureOrientationType = item.Item2.Orientation;
                    if (item.Item2.Marker != null)
                    {
                        bfeature.GeometryMarker = item.Item2.Marker.ToCADXml();
                    }

                    constrainfeaturelist.Add(afeature);
                    constrainfeaturelist.Add(bfeature);
                    pair.ConstraintFeature = constrainfeaturelist.ToArray();
                    pairlist.Add(pair);

                }
                constraintout.Pair = pairlist.ToArray();

                // META-3124
                if (KinematicJointPair != null)
                {
                   constraintout.Joint = KinematicJointPair.ToCADXMLOutput();
                }

                // Associated geomnetries
                List<CAD.GeometryType> geoms = new List<CAD.GeometryType>();
                foreach (var geom in SrcIntf.Geometry.Union(DstIntf.Geometry))
                {
                    geoms.Add(geom.ToCADXMLOutput());
                }
                constraintout.Geometry = geoms.ToArray();

                // Adjoining surface treatment (if any)
                if (testBenchBase is TestBenchModel.FEATestBench)
                {
                    string surftreatment = GetAdjoiningSurfaceTreatment(testBenchBase as TestBenchModel.FEATestBench);
                    constraintout.AdjoiningSurfaceType = surftreatment;
                }
            }


            return constraintout;
        }
コード例 #4
0
ファイル: CADEdge.cs プロジェクト: landunin/meta-core
        public CAD.ConstraintType ToCADXMLOutput(TestBenchModel.TestBenchBase testBenchBase)
        {
            CAD.ConstraintType constraintout = new CAD.ConstraintType();
            constraintout._id = UtilityHelpers.MakeUdmID();
            CADComponent src = Src as CADComponent;
            CADComponent dst = Dst as CADComponent;

            string srcid = src.DisplayID;
            string dstid = dst.DisplayID;

            if (ConstraintPairs.Any())
            {
                List <CAD.PairType> pairlist = new List <CAD.PairType>();

                foreach (var item in ConstraintPairs)
                {
                    List <CAD.ConstraintFeatureType> constrainfeaturelist = new List <CAD.ConstraintFeatureType>();
                    CAD.PairType pair = new CAD.PairType();
                    pair._id = UtilityHelpers.MakeUdmID();
                    pair.FeatureAlignmentType = item.Item1.Alignment;
                    pair.FeatureGeometryType  = item.Item1.Type.ToString().ToUpper();
                    pair.FeatureInterfaceType = "CAD_DATUM";
                    if (item.Item1.Guide || item.Item2.Guide)
                    {
                        pair.Guide = "True";
                    }

                    CAD.ConstraintFeatureType afeature = new CAD.ConstraintFeatureType();
                    afeature._id                    = UtilityHelpers.MakeUdmID();
                    afeature.ComponentID            = item.Item1.ComponentID;
                    afeature.FeatureName            = item.Item1.DatumName;
                    afeature.FeatureOrientationType = item.Item1.Orientation;
                    if (item.Item1.Marker != null)
                    {
                        afeature.GeometryMarker = item.Item1.Marker.ToCADXml();
                    }

                    CAD.ConstraintFeatureType bfeature = new CAD.ConstraintFeatureType();
                    bfeature._id                    = UtilityHelpers.MakeUdmID();
                    bfeature.ComponentID            = item.Item2.ComponentID;
                    bfeature.FeatureName            = item.Item2.DatumName;
                    bfeature.FeatureOrientationType = item.Item2.Orientation;
                    if (item.Item2.Marker != null)
                    {
                        bfeature.GeometryMarker = item.Item2.Marker.ToCADXml();
                    }

                    constrainfeaturelist.Add(afeature);
                    constrainfeaturelist.Add(bfeature);
                    pair.ConstraintFeature = constrainfeaturelist.ToArray();
                    pairlist.Add(pair);
                }
                constraintout.Pair = pairlist.ToArray();

                // META-3124
                if (KinematicJointPair != null)
                {
                    constraintout.Joint = KinematicJointPair.ToCADXMLOutput();
                }

                // Associated geomnetries
                List <CAD.GeometryType> geoms = new List <CAD.GeometryType>();
                foreach (var geom in SrcIntf.Geometry.Union(DstIntf.Geometry))
                {
                    geoms.Add(geom.ToCADXMLOutput());
                }
                constraintout.Geometry = geoms.ToArray();

                // Adjoining surface treatment (if any)
                if (testBenchBase is TestBenchModel.FEATestBench)
                {
                    string surftreatment = GetAdjoiningSurfaceTreatment(testBenchBase as TestBenchModel.FEATestBench);
                    constraintout.AdjoiningSurfaceType = surftreatment;
                }
            }


            return(constraintout);
        }