示例#1
0
        public void PopulateStructuralInterface(CyPhy.Connector a,
                                                CyPhy.CADModel acadmodel)
        {
            // META-947: Connector instead of StructuralInterface
            // [1] Connectors can be nested so find all cad datums within a connector recursively
            // [2] Find connected datums
            //     Skip Connector without any Datum Ports

            // Limitref datums won't be considered part of the connection
            List <CyPhy.CADDatum> CadDatum_List      = new List <CyPhy.CADDatum>();
            List <CyPhy.CADDatum> LimitRefDatum_List = new List <CyPhy.CADDatum>();

            FindCadDatumsInConnector(a, CadDatum_List, LimitRefDatum_List);

            Dictionary <string, DataRep.Datum> featuremap  = new Dictionary <string, DataRep.Datum>();
            Dictionary <string, DataRep.Datum> limitrefmap = new Dictionary <string, DataRep.Datum>();

            foreach (CyPhy.CADDatum item in CadDatum_List)
            {
                FindMatchingDatums(item, acadmodel, featuremap);
            }
            foreach (CyPhy.CADDatum item in LimitRefDatum_List)
            {
                FindMatchingDatums(item, acadmodel, limitrefmap);
            }

            this.DatumList     = featuremap;
            this.DegreeFreedom = GetDegreesOfFreedom();

            SetupJoint(CadDatum_List, LimitRefDatum_List, limitrefmap);

            SetupAdjoiningTreatment();

            foreach (var intfgeom in a.SrcConnections.InterfaceGeometryCollection.Union(a.DstConnections.InterfaceGeometryCollection))
            {
                var geom = (intfgeom.SrcEnds.GeometryTypes == null) ? intfgeom.DstEnds.GeometryTypes : intfgeom.SrcEnds.GeometryTypes;
                if (geom != null)
                {
                    Geometry.Add(CADGeometry.CreateGeometry(geom));
                }
            }
        }
示例#2
0
        public static CADGeometry CreateGeometry(CyPhy.GeometryTypes geometryBase)
        {
            List <KeyValuePair <string, string> > featureList = new List <KeyValuePair <string, string> >();
            string      geometryType = geometryBase.Kind;
            CADGeometry geometryRep  = new CADGeometry
            {
                FeatureID        = geometryBase.ID,
                GeometryType     = geometryType.ToUpper(),
                PrimaryQualifier = geometryBase.Attributes.BoundaryQualifier.ToString().Replace("_", string.Empty)
            };

            if (geometryType == "Sphere")
            {
                CyPhy.Sphere sphere = CyPhyClasses.Sphere.Cast(geometryBase.Impl);
                if (AddSphere(sphere, featureList))
                {
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                {
                    geometryRep = null;
                }
            }
            else if (geometryType == "Cylinder")
            {
                CyPhy.Cylinder cylinder = CyPhyClasses.Cylinder.Cast(geometryBase.Impl);
                geometryRep.SecondaryQualifier = cylinder.Attributes.EndCapInclusionQualifier.ToString();
                if (AddCylinder(cylinder, featureList))
                {
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                {
                    geometryRep = null;
                }
            }
            else if (geometryType == "Extrusion")
            {
                CyPhy.Extrusion extrusion = CyPhyClasses.Extrusion.Cast(geometryBase.Impl);
                if (AddExtrusion(extrusion, featureList))
                {
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                {
                    geometryRep = null;
                }
            }
            else if (geometryType == "Polygon")
            {
                CyPhy.Polygon polygon = CyPhyClasses.Polygon.Cast(geometryBase.Impl);
                if (AddPolygon(polygon, featureList))
                {
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                {
                    geometryRep = null;
                }
            }
            else if (geometryType == "Circle")
            {
                CyPhy.Circle circle = CyPhyClasses.Circle.Cast(geometryBase.Impl);
                if (AddCircle(circle, featureList))
                {
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                {
                    geometryRep = null;
                }
            }
            else if (geometryType == "Face")
            {
                CyPhy.Face face = CyPhyClasses.Face.Cast(geometryBase.Impl);
                CADGeometry.FeatureTypeEnum type;
                if (AddFace(face,
                            featureList,
                            out type))
                {
                    geometryRep.featureType = type;
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                {
                    geometryRep = null;
                }
            }
            else
            {
                Logger.Instance.AddLogMessage("Geometry shape not supported [" + geometryType + "]", Severity.Warning);
                geometryRep = null;
            }

            return(geometryRep);
        }
示例#3
0
        public static CADGeometry CreateGeometry(CyPhy.GeometryTypes geometryBase)
        {
            List<KeyValuePair<string, string>> featureList = new List<KeyValuePair<string, string>>();
            string geometryType = geometryBase.Kind;
            CADGeometry geometryRep = new CADGeometry
            {
                FeatureID = geometryBase.ID,
                GeometryType = geometryType.ToUpper(),
                PrimaryQualifier = geometryBase.Attributes.BoundaryQualifier.ToString().Replace("_", string.Empty)
            };
            if (geometryType == "Sphere")
            {
                CyPhy.Sphere sphere = CyPhyClasses.Sphere.Cast(geometryBase.Impl);
                if (AddSphere(sphere, featureList))
                    geometryRep.CreateGeometryFeature(featureList);
                else
                    geometryRep = null;

            }
            else if (geometryType == "Cylinder")
            {
                CyPhy.Cylinder cylinder = CyPhyClasses.Cylinder.Cast(geometryBase.Impl);
                geometryRep.SecondaryQualifier = cylinder.Attributes.EndCapInclusionQualifier.ToString();
                if (AddCylinder(cylinder, featureList))
                    geometryRep.CreateGeometryFeature(featureList);
                else
                    geometryRep = null;
            }
            else if (geometryType == "Extrusion")
            {
                CyPhy.Extrusion extrusion = CyPhyClasses.Extrusion.Cast(geometryBase.Impl);
                if (AddExtrusion(extrusion, featureList))
                    geometryRep.CreateGeometryFeature(featureList);
                else
                    geometryRep = null;
            }
            else if (geometryType == "Polygon")
            {
                CyPhy.Polygon polygon = CyPhyClasses.Polygon.Cast(geometryBase.Impl);
                if (AddPolygon(polygon, featureList))
                    geometryRep.CreateGeometryFeature(featureList);
                else
                    geometryRep = null;
            }
            else if (geometryType == "Circle")
            {
                CyPhy.Circle circle = CyPhyClasses.Circle.Cast(geometryBase.Impl);
                if (AddCircle(circle, featureList))
                    geometryRep.CreateGeometryFeature(featureList);
                else
                    geometryRep = null;
            }
            else if (geometryType == "Face")
            {
                CyPhy.Face face = CyPhyClasses.Face.Cast(geometryBase.Impl);
                CADGeometry.FeatureTypeEnum type;
                if (AddFace(face,
                            featureList,
                            out type))
                {
                    geometryRep.featureType = type;
                    geometryRep.CreateGeometryFeature(featureList);
                }
                else
                    geometryRep = null;
            }
            else
            {
                Logger.Instance.AddLogMessage("Geometry shape not supported [" + geometryType + "]", Severity.Warning);
                geometryRep = null;
            }

            return geometryRep;
        }
示例#4
0
        private static bool AddFace(CyPhy.Face face, List<KeyValuePair<string, string>> featureList, out CADGeometry.FeatureTypeEnum type)
        {
            int ptCnt = face.Children.PointCollection.Count(),
                surfCnt = face.Children.SurfaceCollection.Count();

            type = CADGeometry.FeatureTypeEnum.POINT;
            if ((ptCnt + surfCnt) > 1)
            {
                // insert error message
                Logger.Instance.AddLogMessage(String.Format("Face geometry must contain a ReferencePoint or a ReferenceSurface: {0}", face.ToHyperLink()), Severity.Error);
                return false;
            }

            if (ptCnt > 0)          // Plane
            {
                type = CADGeometry.FeatureTypeEnum.POINT;
                CyPhy.Point point = face.Children.PointCollection.First();
                if (CreateFeatureFromPoint(point,
                                           featureList))
                    return true;
                else
                {
                    Logger.Instance.AddLogMessage(String.Format("Face geometry's ReferencePoint must connect to a Point datum inside a CADModel: {0}", face.ToHyperLink()), Severity.Error);
                    return false;
                }

            }

            if (surfCnt > 0)        // Surface
            {
                type = CADGeometry.FeatureTypeEnum.SURFACE;
                CyPhy.Surface surface = face.Children.SurfaceCollection.First();
                if (CreateFeatureFromPoint(surface,
                                           featureList))
                    return true;
                else
                {
                    Logger.Instance.AddLogMessage(String.Format("Face geometry's ReferenceSurface must connect to a Surface datum inside a CADModel: {0}", face.ToHyperLink()), Severity.Error);
                    return false;
                }
            }

            return false;

        }
示例#5
0
 public void AddGeometry(CADGeometry geometry)
 {
     Geometry = geometry;
 }
示例#6
0
        public static FEAThermalElement[] Extract(CyPhy.ThermalFEAElements thermalElement, string compid, CADGeometry geom)
        {
            List<FEAThermalElement> result = new List<FEAThermalElement>();

            if (thermalElement is CyPhy.ThermalEnvironment)
            {
                if ((thermalElement as CyPhy.ThermalEnvironment).Children.ParameterCollection.Any())
                {
                    var param = (thermalElement as CyPhy.ThermalEnvironment).Children.ParameterCollection.First();
                    string role = ((MgaFCO)param.Impl).MetaRole.Name;
                    var elem = new FEAThermalElement(param) { ComponentID = compid, Geometry = geom };
                    result.Add(elem);
                }
            }
            else if (thermalElement is CyPhy.ThermalLoad)
            {
                foreach (var param in (thermalElement as CyPhy.ThermalLoad).Children.ParameterCollection)
                {
                    var elem = new FEAThermalElement(param) { ComponentID = compid, Geometry = geom };
                    if (elem.Type == "Convection")
                    {
                        elem.Unit = "J/(s-mm^2-K)";
                    }
                    else if (elem.Type == "HeatFlux")
                    {
                        elem.Unit = "J/(s-mm^2)";
                    }
                    else if (elem.Type == "HeatGeneration")
                    {
                        elem.Unit = "J/s";
                    }
                    else if (elem.Type == "InitialTemperature")
                    {
                        elem.Unit = "K";
                    }
                    else if (elem.Type == "SpecifiedTemperature")
                    {
                        elem.Unit = "K";
                    }
                    result.Add(elem);
                }
            }
            return result.ToArray();
        }