/// <summary> /// Creates instance objects based on a string identifying an item's type in PowerSHAPE. /// </summary> /// <param name="powerSHAPE">The base instance to interact with PowerShape.</param> /// <param name="type">The identifier PowerSHAPE uses to identify this type of entity.</param> /// <param name="id">The identifier of the entity.</param> /// <param name="name">The name of the entity.</param> /// <returns>The new entity.</returns> internal static object CreateEntity(PSAutomation powerSHAPE, string type, int id, string name) { PSEntity entity = null; switch (type.ToUpper()) { case PSAnnotation.ANNOTATION_IDENTIFIER: entity = new PSAnnotation(powerSHAPE, id, name); break; case PSArc.ARC_IDENTIFIER: entity = new PSArc(powerSHAPE, id, name); break; case PSCompCurve.COMPCURVE_IDENTIFIER: case "COMPOSITE CURVE": entity = new PSCompCurve(powerSHAPE, id, name); break; case PSCurve.CURVE_IDENTIFIER: entity = new PSCurve(powerSHAPE, id, name); break; case PSElectrode.ELECTRODE_IDENTIFIER: entity = new PSElectrode(powerSHAPE, id, name); break; case PSLine.LINE_IDENTIFIER: entity = new PSLine(powerSHAPE, id, name); break; case PSPoint.POINT_IDENTIFIER: entity = new PSPoint(powerSHAPE, id, name); break; case PSSolid.SOLID_IDENTIFIER: entity = (PSEntity)PSSolidFactory.CreateSolid(powerSHAPE, id, name); break; case PSMesh.MESH_IDENTIFIER: entity = new PSMesh(powerSHAPE, id, name); break; case PSSurface.SURFACE_IDENTIFIER: entity = (PSEntity)PSSurfaceFactory.CreateSurface(powerSHAPE, id, name); break; case PSWorkplane.WORKPLANE_IDENTIFIER: entity = new PSWorkplane(powerSHAPE, id, name); break; } return(entity); }
/// <summary> /// Creates instance objects based on a string identifying an item's type in PowerSHAPE. /// </summary> /// <param name="powerSHAPE">The base instance to interact with PowerShape.</param> /// <param name="type">The identifier PowerSHAPE uses to identify this type of entity.</param> /// <param name="id">The identifier of the entity.</param> /// <param name="name">The name of the entity.</param> /// <returns>The new entity.</returns> internal static object CreateEntity( PSAutomation powerSHAPE, int type, int id, string name, string description, string level) { PSEntity entity = null; switch (type) { case 61: entity = new PSAnnotation(powerSHAPE, id, name); break; case 52: entity = new PSArc(powerSHAPE, id, name); break; case 59: entity = new PSCompCurve(powerSHAPE, id, name); break; case 53: entity = new PSCurve(powerSHAPE, id, name); break; case 58: entity = new PSLine(powerSHAPE, id, name); break; case 49: entity = new PSPoint(powerSHAPE, id, name); break; case 40: entity = (PSEntity)PSSolidFactory.CreateSolid(powerSHAPE, id, name, description); break; case 60: switch (description) { case "Mesh": entity = new PSMesh(powerSHAPE, id, name); break; case "Point": entity = new PSPoint(powerSHAPE, id, name); break; case "Electrode": entity = new PSElectrode(powerSHAPE, id, name); break; } break; case 21: entity = (PSEntity)PSSurfaceFactory.CreateSurface(powerSHAPE, id, name, description); break; case 54: entity = new PSWorkplane(powerSHAPE, id, name); break; } if (entity != null) { entity._levelNumber = int.Parse(level); } return(entity); }