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); }
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; }