Ejemplo n.º 1
0
        /// <summary>
        /// The parameters array should be populated with default values here
        /// </summary>
        public override void Initialize()
        {
            _inputParam    = new Parameter[3];
            _inputParam[0] = new FeatureSetParam(TextStrings.input1FeatureSet)
            {
                HelpText = TextStrings.InputFeatureSettodelete
            };

            _inputParam[1] = new IntParam(TextStrings.Index, 0)
            {
                HelpText = TextStrings.IndexNotoOverwrite
            };

            _inputParam[2] = new FeatureSetParam(TextStrings.input2FeatureSettoOverwrite)
            {
                HelpText = TextStrings.InputFeatureSettobeoverwrite
            };

            _outputParam    = new Parameter[2];
            _outputParam[0] = new FeatureSetParam(TextStrings.OutputFeatureSet)
            {
                HelpText = TextStrings.SelectResultFeatureSetDirectory
            };
            _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The Parameter array should be populated with default values here
        /// </summary>
        public override void Initialize()
        {
            _inputParam    = new Parameter[4];
            _inputParam[0] = new FileParam(TextStrings.lasFilename, "LAS Files(*.las)|*.las")
            {
                HelpText = TextStrings.LasFullpath
            };
            _inputParam[1] = new ExtentParam(TextStrings.RasterExtent)
            {
                HelpText           = TextStrings.GeographicExtent,
                DefaultToMapExtent = true
            };
            _inputParam[2] = new IntParam(TextStrings.NumRows)
            {
                HelpText = TextStrings.numberofrows
            };
            _inputParam[3] = new IntParam(TextStrings.NumColumns)
            {
                HelpText = TextStrings.numberofcolums
            };

            _outputParam    = new Parameter[2];
            _outputParam[0] = new RasterParam(TextStrings.OutputRaster)
            {
                HelpText = TextStrings.ResultRasterDirectory
            };
            _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true);
        }
Ejemplo n.º 3
0
        //列表绑定
        protected void rptInsure_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                byte   tradeType = ( byte )DataBinder.Eval(e.Item.DataItem, "TradeType");
                string userID    = DataBinder.Eval(e.Item.DataItem, "SourceUserID").ToString();
                switch (tradeType)
                {
                case 1:
                    (( Label )e.Item.FindControl("lblTradeType")).Text = "存款";
                    break;

                case 2:
                    (( Label )e.Item.FindControl("lblTradeType")).Text = "取款";
                    break;

                case 3:
                    if (userID == IntParam.ToString( ))
                    {
                        (( Label )e.Item.FindControl("lblTradeType")).Text = "转出";
                    }
                    else
                    {
                        (( Label )e.Item.FindControl("lblTradeType")).Text = "转入";
                    }
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The Parameter array should be populated with default values here
        /// </summary>
        public override void Initialize()
        {
            _inputParam    = new Parameter[4];
            _inputParam[0] = new FileParam(TextStrings.lasFilename, "LAS Files(*.las)|*.las")
            {
                HelpText = TextStrings.LasFullpath
            };
            ExtentParam p = new ExtentParam(TextStrings.RasterExtent);

            p.HelpText           = TextStrings.GeographicExtent;
            p.DefaultToMapExtent = true;

            _inputParam[1] = p;

            _inputParam[2] = new IntParam(TextStrings.NumRows)
            {
                HelpText = TextStrings.numberofrows
            };

            _inputParam[3] = new IntParam(TextStrings.NumColumns)
            {
                HelpText = TextStrings.numberofcolums
            };

            _outputParam    = new Parameter[1];
            _outputParam[0] = new RasterParam(TextStrings.OutputRaster)
            {
                HelpText = TextStrings.ResultRasterDirectory
            };
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The Parameter array should be populated with default values here
        /// </summary>
        public override void Initialize()
        {
            _inputParam    = new Parameter[7];
            _inputParam[0] = new PointFeatureSetParam(TextStrings.PointFeatureSet);
            _inputParam[1] = new ListParam(TextStrings.Zvalue)
            {
                HelpText = TextStrings.layercontainsvalues
            };
            _inputParam[2] = new DoubleParam(TextStrings.CellSize, 0, 0, double.MaxValue)
            {
                HelpText = TextStrings.Thecellsizeingeographicunits
            };
            _inputParam[3] = new DoubleParam(TextStrings.Power, 2, 1, double.MaxValue)
            {
                HelpText = TextStrings.Theinfluenceofdistance
            };
            _neighborhoodType = new List <string> {
                TextStrings.FixedDistance, TextStrings.FixedCount
            };
            _inputParam[4] = new ListParam(TextStrings.NeighborhoodType, _neighborhoodType, 0)
            {
                HelpText = TextStrings.Selectthetypeofneighborhood
            };
            _inputParam[5] = new IntParam(TextStrings.MinMaxnumberofpoints, 12, 0, int.MaxValue)
            {
                HelpText = TextStrings.FixedDistanceHelpText
            };
            _inputParam[6] = new DoubleParam(TextStrings.MinMaxdistance, 0, 0, double.MaxValue)
            {
                HelpText = TextStrings.FixedDistanceHelpText
            };

            _outputParam    = new Parameter[1];
            _outputParam[0] = new RasterParam(TextStrings.Raster);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Executes the random geometry tool, returning true when it has completed.
        /// </summary>
        /// <param name="cancelProgressHandler"></param>
        /// <returns></returns>
        public override bool Execute(ICancelProgressHandler cancelProgressHandler)
        {
            //Get the needed input and output parameters
            IFeatureSet inputFeatures  = _inputParam[0].Value as IFeatureSet;
            IFeatureSet outputFeatures = _outputParam[0].Value as IFeatureSet;
            IntParam    intInput       = _inputParam[1] as IntParam;

            int numPoints = 1;

            if (intInput != null)
            {
                numPoints = intInput.Value;
            }

            RandomGeometry.RandomPoints(inputFeatures, numPoints, outputFeatures, cancelProgressHandler);

            if (cancelProgressHandler.Cancel)
            {
                //Set output param to null so that ToolManager does not attempt to open file.
                _outputParam = null;
                return(false);
            }
            else
            {
                outputFeatures.Save();
                return(true);
            }
        }
Ejemplo n.º 7
0
        public void TestIntParam()
        {
            IntParam sparam  = new IntParam("myname", 42);
            IntParam sparam2 = (IntParam)sparam.ToXmlAndBack();

            Assert.AreEqual(sparam.Value, sparam2.Value);
            Assert.AreEqual(sparam.Name, sparam2.Name);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Inititalize input and output arrays with parameter types and default values.
 /// </summary>
 public override void Initialize()
 {
     _inputParam     = new Parameter[2];
     _inputParam[0]  = new FeatureSetParam(TextStrings.InputFeatureSet);
     _inputParam[1]  = new IntParam(TextStrings.RandomGeometryNumPoint, 10);
     _outputParam    = new Parameter[1];
     _outputParam[0] = new FeatureSetParam(TextStrings.OutputFeatureSet);
 }
    static void Main(string[] args)
    {
        var s       = new StringParam("Glenn");
        var i       = new IntParam("12");
        var coolDel = new CoolDelegate(DoSomethingCool);

        coolDel(s, i);
    }
Ejemplo n.º 10
0
 /// <summary>
 /// Inititalize input and output arrays with parameter types and default values.
 /// </summary>
 public override void Initialize()
 {
     _inputParam     = new Parameter[2];
     _inputParam[0]  = new FeatureSetParam(TextStrings.InputFeatureSet);
     _inputParam[1]  = new IntParam(TextStrings.RandomGeometryNumPoint, 10);
     _outputParam    = new Parameter[2];
     _outputParam[0] = new FeatureSetParam(TextStrings.OutputFeatureSet);
     _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true);
 }
Ejemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     base.moduleID = 140;
     if (!IsPostBack)
     {
         list1.SelectedValue = IntParam.ToString();
         AccountsDataBind();
     }
 }
Ejemplo n.º 12
0
    private void OnRequestScene(IEventParam e)
    {
        IntParam p = (IntParam)e;

        if (p.val > -1)
        {
            Requested = p.val;
        }
    }
Ejemplo n.º 13
0
 internal void SetData(Dictionary <string, int> v, string[] keys, int d)
 {
     Parameter[] p = new Parameter[keys.Length];
     for (int i = 0; i < p.Length; i++)
     {
         p[i] = new IntParam(keys[i], v.ContainsKey(keys[i]) ? v[keys[i]] : d);
     }
     parameterPanel1.Init(new Parameters(p));
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IntElement"/> class.
        /// </summary>
        /// <param name="param">The parameter this element represents.</param>
        public IntElement(IntParam param)
        {
            // Needed by the designer
            InitializeComponent();
            GroupBox.Text = param.Name;

            // We save the parameters passed in
            Param = param;

            HandleStatusLight();
        }
Ejemplo n.º 15
0
 void OnDestroy()
 {
     f1   = null;
     f2   = null;
     f3   = null;
     f4   = null;
     f5   = null;
     farr = null;
     flua = null;
     ie   = null;
     add  = null;
     luaenv.Dispose();
 }
Ejemplo n.º 16
0
        public void ErzeugeKreismusterAußenverzahnung(Data dat)
        {
            ShapeFactory       SF  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;

            //Skizze und Referenzen
            Factory2D Factory2D1 = hsp_catiaProfil.Factory2D;

            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = hsp_catiaPart.Part.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = hsp_catiaPart.Part.CreateReferenceFromObject(XDir);

            //Kreismuster mit Daten füllen
            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D1, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / dat.getZaehnezahlZahnrad1());
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(dat.getZaehnezahlZahnrad1()) + 1;

            //geschlossene Kontur
            Reference           Ref_Kreismuster = hsp_catiaPart.Part.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = hsp_catiaPart.Part.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);

            hsp_catiaPart.Part.Update();

            Bodies bodies = hsp_catiaPart.Part.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);

            hsp_catiaPart.Part.Update();

            //Erzeuge Block aus Skizze
            hsp_catiaPart.Part.InWorkObject = myBody;
            Pad myPad = SF.AddNewPadFromRef(Ref_Verbindung, dat.getBreiteZahnrad1());

            hsp_catiaPart.Part.Update();
        }
Ejemplo n.º 17
0
        public void ErzeugeZahnrad(int Zaehnezahl, double Dicke, double Modul)
        {
            ShapeFactory       SF = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory; Part myPart = hsp_catiaPart.Part;
            Factory2D          Factory2D1 = hsp_catiaProfil.Factory2D;


            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = myPart.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = myPart.CreateReferenceFromObject(XDir);


            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D1, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / Convert.ToDouble(Zaehnezahl));
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(Zaehnezahl) + 1;


            Reference           Ref_Kreismuster = myPart.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster); Reference Ref_Verbindung = myPart.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);

            myPart.Update();

            Bodies bodies = myPart.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);
            myPart.Update();
            myPart.InWorkObject = myBody;
            Pad myPad = SF.AddNewPadFromRef(Ref_Verbindung, Dicke);

            myPart.Update();
        }
        public void ErzeugeDasNeueKreismuster(Data dat)
        {
            ShapeFactory       shapeFactory1       = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory hybridShapeFactory1 = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;

            Factory2D factory2D1 = hsp_catiaProfil.Factory2D;

            HybridShapePointCoord ursprung    = hybridShapeFactory1.AddNewPointCoord(0, 0, 0);
            Reference             refUrsprung = hsp_catiaPart.Part.CreateReferenceFromObject(ursprung);

            HybridShapeDirection xRichtung    = hybridShapeFactory1.AddNewDirectionByCoord(1, 0, 0);
            Reference            refxRichtung = hsp_catiaPart.Part.CreateReferenceFromObject(xRichtung);

            CircPattern kreismuster = shapeFactory1.AddNewSurfacicCircPattern(factory2D1, 1, 2, 0, 0, 1, 1, refUrsprung, refxRichtung, false, 0, true, false);

            kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / dat.getZähnezahl());
            AngularRepartition angularRepartition2 = kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(dat.getZähnezahl()) + 1;


            //Kreismusterenden verbinden

            Reference           refKreismuster = hsp_catiaPart.Part.CreateReferenceFromObject(kreismuster);
            HybridShapeAssemble verbindung     = hybridShapeFactory1.AddNewJoin(refKreismuster, refKreismuster);
            Reference           refVerbindung  = hsp_catiaPart.Part.CreateReferenceFromObject(verbindung);

            hybridShapeFactory1.GSMVisibility(refVerbindung, 0);

            hsp_catiaPart.Part.MainBody.InsertHybridShape(verbindung);



            hsp_catiaPart.Part.Update();

            ErzeugedenNeuenBlock(refVerbindung, shapeFactory1, dat);
        }
Ejemplo n.º 19
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            var context        = executionContext.GetExtension <IWorkflowContext>();
            var serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            var service        = serviceFactory.CreateOrganizationService(context.UserId);

            var textPar = TextParam.Get <string>(executionContext);
            var intPar  = IntParam.Get <int>(executionContext);
            var email   = EmailParam.Get <string>(executionContext);

            Entity updatedEntity = new Entity(context.PrimaryEntityName);

            updatedEntity.Id            = context.PrimaryEntityId;
            updatedEntity["new_textin"] = textPar;
            updatedEntity["new_number"] = intPar;
            {
                OutParam.Set(executionContext, email);
            }
            service.Update(updatedEntity);
        }
        /// <summary>
        /// The Parameter array should be populated with default values here
        /// </summary>
        public override void Initialize()
        {
            _inputParam    = new Parameter[7];
            _inputParam[0] = new RasterParam(TextStrings.input1altitudeRaster)
            {
                HelpText = TextStrings.InputRasterforaverageslopecalculation
            };
            _inputParam[1] = new DoubleParam(TextStrings.inputZfactor, 1.0)
            {
                HelpText = TextStrings.InputZfactorforslopedisplay
            };
            _inputParam[2] = new BooleanParam(TextStrings.slopeinpercentage, TextStrings.boxSlopeInPercentage, false)
            {
                HelpText = TextStrings.slopeinpercentage
            };
            _inputParam[3] = new FeatureSetParam(TextStrings.input1polygonfeatureset)
            {
                HelpText = TextStrings.averageslopeinarribute
            };
            _inputParam[4] = new FeatureSetParam(TextStrings.inputtheareaofinterest)
            {
                HelpText = TextStrings.featuresetcontainareainterest
            };
            _inputParam[5] = new IntParam(TextStrings.Indexofareaofinterestfeature, 0)
            {
                HelpText = TextStrings.indexspecificarea
            };
            _inputParam[6] = new StringParam(TextStrings.Fieldnameforavrageslope, TextStrings.AveSlope)
            {
                HelpText = TextStrings.Fieldnamecolomavrageslope
            };

            _outputParam    = new Parameter[2];
            _outputParam[0] = new FeatureSetParam(TextStrings.Outputwithaverageslope)
            {
                HelpText = TextStrings.SelecttheResultofOutput
            };
            _outputParam[2] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true);
        }
Ejemplo n.º 21
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            var context        = executionContext.GetExtension <IWorkflowContext>();
            var serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            var service        = serviceFactory.CreateOrganizationService(context.UserId);

            string          textPar = TextParam.Get <string>(executionContext);
            int             intPar  = IntParam.Get <int>(executionContext);
            EntityReference company = Account.Get <EntityReference>(executionContext);

            Entity updatedEntity = new Entity(context.PrimaryEntityName)
            {
                Id = context.PrimaryEntityId
            };

            updatedEntity["new_text"] = textPar;
            updatedEntity["new_noun"] = intPar;

            if (company == null)
            {
                OutParam.Set(executionContext, "Record doesn't have account");
            }
            else
            {
                Entity account = service.Retrieve(company.LogicalName, company.Id, new ColumnSet("emailaddress1"));
                if (account.Attributes.ContainsKey("emailaddress1"))
                {
                    OutParam.Set(executionContext, account.GetAttributeValue <string>("emailaddress1"));
                }
                else
                {
                    OutParam.Set(executionContext, "Record's account doesn't have Email");
                }
            }

            service.Update(updatedEntity);
        }
Ejemplo n.º 22
0
        private void buttonPrepareExport_Click(object sender, EventArgs e)
        {
            if (cbProcNames.Items.Count > 0)
            {
                List <ReportParamV2> paramList = new List <ReportParamV2>();

                Dictionary <string, string> parameters =
                    ServicesProvider.GetInstance().GetAccountingServices().SelectExportAccountingProcParams("ExportAccounting_" + cbProcNames.Text);

                if (parameters != null && parameters.Count > 0)
                {
                    foreach (var parameter in parameters)
                    {
                        ReportParamV2 reportParam;
                        string        paramName = parameter.Key.TrimStart('@');
                        if (paramName.Equals("branch_id", StringComparison.CurrentCultureIgnoreCase))
                        {
                            reportParam = new BranchParam(string.Empty);
                        }
                        else
                        {
                            string paramType = parameter.Value;
                            switch (paramType)
                            {
                            case "bit":
                                reportParam = new BoolParam(false);
                                break;

                            case "datetime":
                                reportParam = new DateParam(DateTime.Today);
                                break;

                            case "char":
                                reportParam = new CharParam(' ');
                                break;

                            case "nvarchar":
                            case "varchar":
                            case "text":
                                reportParam = new StringParam(string.Empty);
                                break;

                            case "int":
                                reportParam = new IntParam(1);
                                break;

                            case "float":
                                reportParam = new DoubleParam(1d);
                                break;

                            case "money":
                                reportParam = new DecimalParam(1m);
                                break;

                            default:
                                throw new NotImplementedException(string.Format("Sql type:{0} is not handled.", paramName));
                            }
                        }

                        reportParam.Label = paramName;
                        reportParam.Name  = paramName;
                        paramList.Add(reportParam);
                    }
                    ReportParamsForm frm = new ReportParamsForm(paramList, cbProcNames.Text);
                    frm.ShowDialog();
                }

                _dataTable =
                    ServicesProvider.GetInstance().GetAccountingServices().FindElementaryMvtsToExport(
                        "ExportAccounting_"
                        + cbProcNames.Text, paramList, out _idTable);

                _total = _dataTable.Rows.Count;

                _bwSelect = new BackgroundWorker {
                    WorkerSupportsCancellation = true
                };
                _bwSelect.DoWork += BwSelect_DoWork;

                ExportBookings_Load(this, null);
            }
        }
Ejemplo n.º 23
0
 private static extern void inputInt(string label, ref IntParam param);
Ejemplo n.º 24
0
 public void SetParam(IntParam param, int value) 
 {
     this._model.GetEnv().Set(param.param, value);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/>
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public static Parameter Convert(Parameter p)
 {
     if (p.Type == ParamType.Server)
     {
         return(p);
     }
     if (p is RegexReplaceParamWf)
     {
         RegexReplaceParamWf q = (RegexReplaceParamWf)p;
         RegexReplaceParam   b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is RegexMatchParamWf)
     {
         RegexMatchParamWf q = (RegexMatchParamWf)p;
         RegexMatchParam   b = new RegexMatchParam(q.Name, q.Value, q.Previews)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is BoolParamWf)
     {
         BoolParamWf q = (BoolParamWf)p;
         BoolParam   b = new BoolParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is BoolWithSubParamsWf)
     {
         BoolWithSubParamsWf q = (BoolWithSubParamsWf)p;
         q.SubParamsFalse?.Convert(Convert);
         q.SubParamsTrue?.Convert(Convert);
         BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value)
         {
             Help           = q.Help,
             Visible        = q.Visible,
             SubParamsFalse = q.SubParamsFalse,
             SubParamsTrue  = q.SubParamsTrue,
             Default        = q.Default,
             ParamNameWidth = q.ParamNameWidth,
             TotalWidth     = q.TotalWidth,
             Url            = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is DictionaryIntValueParamWf)
     {
         DictionaryIntValueParamWf q = (DictionaryIntValueParamWf)p;
         DictionaryIntValueParam   b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is DoubleParamWf)
     {
         DoubleParamWf q = (DoubleParamWf)p;
         DoubleParam   b = new DoubleParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is FileParamWf)
     {
         FileParamWf q = (FileParamWf)p;
         FileParam   b = new FileParam(q.Name, q.Value)
         {
             Help            = q.Help,
             Visible         = q.Visible,
             Default         = q.Default,
             Filter          = q.Filter,
             ProcessFileName = q.ProcessFileName,
             Save            = q.Save,
             Url             = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is FolderParamWf)
     {
         FolderParamWf q = (FolderParamWf)p;
         FolderParam   b = new FolderParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is IntParamWf)
     {
         IntParamWf q = (IntParamWf)p;
         IntParam   b = new IntParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is LabelParamWf)
     {
         LabelParamWf q = (LabelParamWf)p;
         LabelParam   b = new LabelParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is MultiChoiceMultiBinParamWf)
     {
         MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf)p;
         MultiChoiceMultiBinParam   b = new MultiChoiceMultiBinParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Values  = q.Values,
             Bins    = q.Bins,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is MultiChoiceParamWf)
     {
         MultiChoiceParamWf q = (MultiChoiceParamWf)p;
         MultiChoiceParam   b = new MultiChoiceParam(q.Name, q.Value)
         {
             Help                  = q.Help,
             Visible               = q.Visible,
             Repeats               = q.Repeats,
             Values                = q.Values,
             Default               = q.Default,
             DefaultSelections     = q.DefaultSelections,
             DefaultSelectionNames = q.DefaultSelectionNames,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is MultiFileParamWf)
     {
         MultiFileParamWf q = (MultiFileParamWf)p;
         MultiFileParam   b = new MultiFileParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Filter  = q.Filter,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is MultiStringParamWf)
     {
         MultiStringParamWf q = (MultiStringParamWf)p;
         MultiStringParam   b = new MultiStringParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is SingleChoiceParamWf)
     {
         SingleChoiceParamWf q = (SingleChoiceParamWf)p;
         SingleChoiceParam   b = new SingleChoiceParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Values  = q.Values,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is SingleChoiceWithSubParamsWf)
     {
         SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf)p;
         foreach (Parameters param in q.SubParams)
         {
             param?.Convert(Convert);
         }
         SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value)
         {
             Help           = q.Help,
             Visible        = q.Visible,
             Values         = q.Values,
             Default        = q.Default,
             SubParams      = new Parameters[q.SubParams.Count],
             ParamNameWidth = q.ParamNameWidth,
             TotalWidth     = q.TotalWidth,
             Url            = q.Url
         };
         for (int i = 0; i < q.SubParams.Count; i++)
         {
             b.SubParams[i] = q.SubParams[i];
         }
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is StringParamWf)
     {
         StringParamWf q = (StringParamWf)p;
         StringParam   b = new StringParam(q.Name, q.Value)
         {
             Help    = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url     = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     if (p is Ms1LabelParamWf)
     {
         Ms1LabelParamWf q = (Ms1LabelParamWf)p;
         Ms1LabelParam   b = new Ms1LabelParam(q.Name, q.Value)
         {
             Values       = q.Values,
             Multiplicity = q.Multiplicity,
             Help         = q.Help,
             Visible      = q.Visible,
             Default      = q.Default,
             Url          = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers())
         {
             b.ValueChanged += act;
         }
         return(b);
     }
     throw new Exception("Could not convert ParamWfeter");
 }
Ejemplo n.º 26
0
 public void TestIntParam()
 {
     var sparam = new IntParam("myname", 42);
     var sparam2 = (IntParam) sparam.ToXmlAndBack();
     Assert.AreEqual(sparam.Value, sparam2.Value);
     Assert.AreEqual(sparam.Name, sparam2.Name);
 }
Ejemplo n.º 27
0
        public void Stirnzahnrad(Außenverzahnung av)
        {
            //Profil erstellen
            //Nullpunkt
            double x0 = 0;
            double y0 = 0;

            //Hilfsgrößen
            double Teilkreisradius   = av.d / 2;
            double Hilfskreisradius  = Teilkreisradius * 0.94;
            double Fußkreisradius    = Teilkreisradius - (1.25 * av.m);
            double Kopfkreisradius   = Teilkreisradius + av.m;
            double Verrundungsradius = 0.35 * av.m;

            double Alpha         = 20;
            double Beta          = 90 / av.z;
            double Betarad       = Math.PI * Beta / 180;
            double Gamma         = 90 - (Alpha - Beta);
            double Gammarad      = Math.PI * Gamma / 180;
            double Totalangel    = 360.0 / av.z;
            double Totalangelrad = Math.PI + Totalangel / 180;

            //Punkte erzeugen
            //Kleiner Kreis
            double xMittelpunktaufEvol_links = Hilfskreisradius * Math.Cos(Gammarad);
            double yMittelpunktaufEvol_links = Hilfskreisradius * Math.Sin(Gammarad);

            //Schnittpunkt auf Evolvente und Teilkreisradius
            double xPunktaufEvolvente = -Teilkreisradius *Math.Sin(Betarad);

            double yPunktaufEvolvente = Teilkreisradius * Math.Cos(Betarad);

            //Evolventenkreis Radius
            double EvolventenkreisRadius = Math.Sqrt(Math.Pow((xMittelpunktaufEvol_links - xPunktaufEvolvente), 2) + Math.Pow((yMittelpunktaufEvol_links - yPunktaufEvolvente), 2));

            //Koordinaten Schnittpunkt Kopfkreis und Evolventenkreis
            double xEvolventenkopfkreis_links = Schnittpunkt_X(x0, y0, Kopfkreisradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius);
            double yEvolventenkopfkreis_links = Schnittpunkt_Y(x0, y0, Kopfkreisradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius);

            //Mittelpunktkoordinaten Verrundung
            double xMittelpunktVerrundung_links = Schnittpunkt_X(x0, y0, Fußkreisradius + Verrundungsradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius + Verrundungsradius);
            double yMittelpunktVerrundung_links = Schnittpunkt_Y(x0, y0, Fußkreisradius + Verrundungsradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius + Verrundungsradius);

            //Schnittpunktkoordinaten Verrundung - Evolventenkreis
            double x_SP_EvolventeVerrundung_links = Schnittpunkt_X(xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);
            double y_SP_EvolventeVerrundung_links = Schnittpunkt_Y(xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);

            //Schnittpunktkoordinaten Verrundung - Fußkreis
            double x_SP_FußkreisradiusVerrundung_links = Schnittpunkt_X(x0, y0, Fußkreisradius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);
            double y_SP_FußkreisradiusVerrundung_links = Schnittpunkt_Y(x0, y0, Fußkreisradius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);

            //Koordinaten Anfangspunkt Fußkreis
            double Hilfswinkel            = Totalangelrad - Math.Atan(Math.Abs(x_SP_FußkreisradiusVerrundung_links) / Math.Abs(y_SP_FußkreisradiusVerrundung_links));
            double x_AnfangspunktFußkreis = -Fußkreisradius *Math.Sin(Hilfswinkel);

            double y_AnfangspunktFußkreis = Fußkreisradius * Math.Cos(Hilfswinkel);

            //Ende

            //Skizze umbenennen
            hsp_catiaProfil.set_Name("Zahnrad-Test");
            Factory2D catfactory2D1 = hsp_catiaProfil.OpenEdition();

            //Punkte in Skizze
            Point2D point_Ursprung                   = catfactory2D1.CreatePoint(x0, y0);
            Point2D pointAnfangFußkreisLinks         = catfactory2D1.CreatePoint(x_AnfangspunktFußkreis, y_AnfangspunktFußkreis);
            Point2D pointFußkreisVerrundungLinks     = catfactory2D1.CreatePoint(x_SP_FußkreisradiusVerrundung_links, y_SP_FußkreisradiusVerrundung_links);
            Point2D pointFußkreisVerrundungRechts    = catfactory2D1.CreatePoint(-x_SP_FußkreisradiusVerrundung_links, y_SP_FußkreisradiusVerrundung_links);
            Point2D pointMittelpunktVerrundungLinks  = catfactory2D1.CreatePoint(xMittelpunktVerrundung_links, yMittelpunktVerrundung_links);
            Point2D pointMittelpunktVerrundungRechts = catfactory2D1.CreatePoint(-xMittelpunktVerrundung_links, yMittelpunktVerrundung_links);
            Point2D pointVerrundungEvolventeLinks    = catfactory2D1.CreatePoint(x_SP_EvolventeVerrundung_links, y_SP_EvolventeVerrundung_links);
            Point2D pointVerrundungEvolventeRechts   = catfactory2D1.CreatePoint(-x_SP_EvolventeVerrundung_links, y_SP_EvolventeVerrundung_links);
            Point2D pointMittelpunktevolventeLinks   = catfactory2D1.CreatePoint(xMittelpunktaufEvol_links, xMittelpunktaufEvol_links);
            Point2D pointMittelpunktevolventeRechts  = catfactory2D1.CreatePoint(-xMittelpunktaufEvol_links, yMittelpunktaufEvol_links);
            Point2D pointEvolventenKopfkreisLinks    = catfactory2D1.CreatePoint(xEvolventenkopfkreis_links, yEvolventenkopfkreis_links);
            Point2D pointEvolventenKopfkreisRechts   = catfactory2D1.CreatePoint(-xEvolventenkopfkreis_links, yEvolventenkopfkreis_links);

            //Kreise
            Circle2D KreisFußkreis = catfactory2D1.CreateCircle(x0, y0, Fußkreisradius, 0, Math.PI * 2);

            KreisFußkreis.CenterPoint = point_Ursprung;
            KreisFußkreis.StartPoint  = pointFußkreisVerrundungLinks;
            KreisFußkreis.EndPoint    = pointAnfangFußkreisLinks;

            Circle2D KreisVerrundungLinks = catfactory2D1.CreateCircle(xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius, 0, Math.PI * 2);

            KreisVerrundungLinks.CenterPoint = pointMittelpunktVerrundungLinks;
            KreisVerrundungLinks.StartPoint  = pointFußkreisVerrundungLinks;
            KreisVerrundungLinks.EndPoint    = pointVerrundungEvolventeLinks;

            Circle2D KreisEvolventenkreisLinks = catfactory2D1.CreateCircle(xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, 0, Math.PI * 2);

            KreisEvolventenkreisLinks.CenterPoint = pointMittelpunktevolventeLinks;
            KreisEvolventenkreisLinks.StartPoint  = pointEvolventenKopfkreisLinks;
            KreisEvolventenkreisLinks.EndPoint    = pointVerrundungEvolventeLinks;

            Circle2D KreisKopfkreis = catfactory2D1.CreateCircle(x0, y0, Kopfkreisradius, 0, Math.PI * 2);

            KreisKopfkreis.CenterPoint = point_Ursprung;
            KreisKopfkreis.StartPoint  = pointEvolventenKopfkreisRechts;
            KreisKopfkreis.EndPoint    = pointEvolventenKopfkreisLinks;

            Circle2D KreisEvolventenkreisRechts = catfactory2D1.CreateCircle(-xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, 0, Math.PI * 2);

            KreisEvolventenkreisRechts.CenterPoint = pointMittelpunktVerrundungRechts;
            KreisEvolventenkreisRechts.StartPoint  = pointVerrundungEvolventeRechts;
            KreisEvolventenkreisRechts.EndPoint    = pointEvolventenKopfkreisRechts;

            Circle2D KreisVerrundungRechts = catfactory2D1.CreateCircle(-xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius, 0, Math.PI * 2);

            KreisVerrundungRechts.CenterPoint = pointMittelpunktVerrundungRechts;
            KreisVerrundungRechts.StartPoint  = pointVerrundungEvolventeRechts;
            KreisVerrundungRechts.EndPoint    = pointFußkreisVerrundungRechts;

            //Skizzierer schließen
            hsp_catiaProfil.CloseEdition();

            //Aktualisieren
            hsp_catiaPart.Part.Update();



            //Kreismuster erstellen
            //Deklarierung
            ShapeFactory       SF  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;
            Part myPart            = hsp_catiaPart.Part;

            Factory2D             Factory2D1  = hsp_catiaProfil.Factory2D;
            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = myPart.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = myPart.CreateReferenceFromObject(XDir);

            //Kreismuster Daten ausfüllen
            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D1, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / Convert.ToDouble(av.z));
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(av.z) + 1;

            //geschlossene Kontur herstellen
            Reference           Ref_Kreismuster = myPart.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = myPart.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);
            myPart.Update();
            Bodies bodies = myPart.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);
            myPart.Update();
        }
Ejemplo n.º 28
0
        public void Stirnzahnrad(MainWindow.Außenverzahnung av)
        {
            //Profil Erstellen

            //Nullpunkt
            double x0 = 0;
            double y0 = 0;

            //Hilfsgrößen
            double Teilkreisradius   = av.d / 2;
            double Hilfskreisradius  = Teilkreisradius * 0.94;
            double Fußkreisradius    = Teilkreisradius - (1.25 * av.m);
            double Kopfkreisradius   = Teilkreisradius + av.m;
            double Verrundungsradius = 0.35 * av.m;

            double Alpha         = 2;
            double Alpharad      = Math.PI * Alpha / 180;
            double Beta          = 140 / av.z;
            double Betarad       = Math.PI * Beta / 180;
            double Gamma         = 90 - (Alpha - Beta);
            double Gammarad      = Math.PI * Gamma / 180;
            double Totalangel    = 360.0 / av.z;
            double Totalangelrad = Math.PI * Totalangel / 180;


            //Punkte
            //Kopfkreis
            double xKopfkreis = -Kopfkreisradius *Math.Sin(Alpharad);

            double yKopfkreis = Kopfkreisradius * Math.Cos(Alpharad);

            //Fußkreis
            double xFußkreis = -Fußkreisradius *Math.Sin(Betarad);

            double yFußkreis = Fußkreisradius * Math.Cos(Betarad);

            //Koordinaten Anfangspunkt Fußkreis
            double Hilfswinkel            = Totalangelrad - Math.Atan(Math.Abs(xFußkreis) / Math.Abs(yFußkreis));
            double x_AnfangspunktFußkreis = Fußkreisradius * Math.Sin(Hilfswinkel);
            double y_AnfangspunktFußkreis = Fußkreisradius * Math.Cos(Hilfswinkel);

            //Skizze umbenennen und öffnen
            hsp_catiaProfil.set_Name("Zahnradskizze");
            Factory2D catfactory2D1 = hsp_catiaProfil.OpenEdition();

            //Nun die Punkte in die Skizze
            Point2D point_Ursprung          = catfactory2D1.CreatePoint(x0, y0);
            Point2D point_KopfkreisLinks    = catfactory2D1.CreatePoint(xKopfkreis, yKopfkreis);
            Point2D point_FußkreisLinks     = catfactory2D1.CreatePoint(xFußkreis, yFußkreis);
            Point2D point_KopfkreisRechts   = catfactory2D1.CreatePoint(-xKopfkreis, yKopfkreis);
            Point2D point_FußkreisRechts    = catfactory2D1.CreatePoint(-xFußkreis, yFußkreis);
            Point2D point_AnfangspunktLinks = catfactory2D1.CreatePoint(-x_AnfangspunktFußkreis, y_AnfangspunktFußkreis);

            //Linien
            Line2D line_FußkreisKopfkreis = catfactory2D1.CreateLine(xFußkreis, yFußkreis, xKopfkreis, yKopfkreis);

            line_FußkreisKopfkreis.StartPoint = point_FußkreisLinks;
            line_FußkreisKopfkreis.EndPoint   = point_KopfkreisLinks;

            Line2D line_KopfkreisFußkreis = catfactory2D1.CreateLine(-xKopfkreis, yKopfkreis, -xFußkreis, yFußkreis);

            line_KopfkreisFußkreis.StartPoint = point_KopfkreisRechts;
            line_KopfkreisFußkreis.EndPoint   = point_FußkreisRechts;


            //Kreise
            Circle2D circle_KopfkreisLinksRechts = catfactory2D1.CreateCircle(x0, y0, Kopfkreisradius, 0, Math.PI * 2);

            circle_KopfkreisLinksRechts.CenterPoint = point_Ursprung;
            circle_KopfkreisLinksRechts.EndPoint    = point_KopfkreisLinks;
            circle_KopfkreisLinksRechts.StartPoint  = point_KopfkreisRechts;

            Circle2D circle_AnfangFußkreis = catfactory2D1.CreateCircle(x0, x0, Fußkreisradius, 0, Math.PI * 2);

            circle_AnfangFußkreis.CenterPoint = point_Ursprung;
            circle_AnfangFußkreis.EndPoint    = point_AnfangspunktLinks;
            circle_AnfangFußkreis.StartPoint  = point_FußkreisLinks;

            hsp_catiaProfil.CloseEdition();

            hsp_catiaPart.Part.Update();


            //Profilerstellen Ende

            //Kreismuster

            ShapeFactory       SF  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;
            Part myPart            = hsp_catiaPart.Part;

            Factory2D             Factory2D2  = hsp_catiaProfil.Factory2D;
            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = myPart.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = myPart.CreateReferenceFromObject(XDir);

            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D2, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / Convert.ToDouble(av.z));
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(av.z) + 1;

            Reference           Ref_Kreismuster = myPart.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = myPart.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);
            myPart.Update();
            Bodies bodies = myPart.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);
            myPart.Update();

            myPart.InWorkObject = myBody;
            Pad myPad = SF.AddNewPadFromRef(Ref_Verbindung, av.t);

            myPart.Update();


            //Bohrung
            Reference RefBohrung1       = hsp_catiaPart.Part.CreateReferenceFromBRepName("FSur:(Face:(Brp:(Pad.1;2);None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithInitialFeatureSupport;MonoFond;MFBRepVersion_CXR15)", myPad);
            Hole      catBohrung1       = SF.AddNewHoleFromPoint(0, 0, 0, RefBohrung1, 0);
            Length    catLengthBohrung1 = catBohrung1.Diameter;

            catLengthBohrung1.Value = Convert.ToDouble(av.d / 2);

            hsp_catiaPart.Part.Update();
        }
Ejemplo n.º 29
0
        //InnenVerzahnung
        public void ErstelleProfilInnen(Data dat)
        {
            //geometrisches set auswählen und umbenennen
            HybridBodies catHybridBodies_I = hsp_catiaPart.Part.HybridBodies;
            HybridBody   catHybridBody_I;

            try
            {
                catHybridBody_I = catHybridBodies_I.Item("Geometrisches Set.1");
            }
            catch (Exception)
            {
                MessageBox.Show("Kein geometrisches Set gefunden!\nEin PART manuell erzeugen und darauf achten, dass ein 'Geometisches Set' aktiviert ist.", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            catHybridBody_I.set_Name("Profile");

            //Neue Skizze im ausgewählten geometrischen Set anlegen
            Sketches       catSketches_I       = catHybridBody_I.HybridSketches;
            OriginElements catOriginElements_I = hsp_catiaPart.Part.OriginElements;
            Reference      catReference_I      = (Reference)catOriginElements_I.PlaneYZ;

            hsp_catiaProfil = catSketches_I.Add(catReference_I);

            //Achsensystem in Skizze erzeugen
            ErzeugeAchsensystem();

            //Part aktualisieren
            hsp_catiaPart.Part.Update();

            hsp_catiaProfil.set_Name("InnenverzahnungBlock");
            Factory2D catFactory_I = hsp_catiaProfil.OpenEdition();

            Circle2D catC2D_I = catFactory_I.CreateClosedCircle(0, 0, dat.getFußkreisdurchmesser_iZahnrad1());

            hsp_catiaProfil.CloseEdition();
            hsp_catiaPart.Part.Update();

            ShapeFactory       SF_I  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF_I = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;

            //Erzeuge Block aus Skizze
            hsp_catiaPart.Part.InWorkObject = hsp_catiaPart.Part.MainBody;
            Pad myPad = SF_I.AddNewPad(hsp_catiaProfil, dat.getBreiteZahnrad1());

            hsp_catiaPart.Part.Update();



            //Neue Skizze im ausgewählten geometrischen Set anlegen
            Sketches       catSketches1      = catHybridBody_I.HybridSketches;
            OriginElements catOriginElements = hsp_catiaPart.Part.OriginElements;
            Reference      catReference1     = (Reference)catOriginElements.PlaneYZ;

            hsp_catiaProfil = catSketches1.Add(catReference1);

            //Achsensystem in Skizze erzeugen
            ErzeugeAchsensystem();

            //Part aktualisieren
            hsp_catiaPart.Part.Update();


            //HilfsRadien
            double d_r  = (dat.getModulZahnrad1() * dat.getZaehnezahlZahnrad1()) / 2;
            double hk_r = d_r * 1.06;
            double da_r = d_r - (1.25 * dat.getModulZahnrad1());
            double df_r = d_r + dat.getModulZahnrad1();
            double vd_r = 0.35 * dat.getModulZahnrad1();

            //HilfsWinkel
            double alpha   = 20;
            double beta    = 90 / dat.getZaehnezahlZahnrad1();
            double beta_r  = Math.PI * beta / 180;
            double gamma   = 90 - (alpha - beta);
            double gamma_r = Math.PI * gamma / 180;
            double ta      = 360.0 / dat.getZaehnezahlZahnrad1();
            double ta_r    = Math.PI * ta / 180;

            //Nullpunkte
            double x0 = 0;
            double y0 = 0;

            //MittelPunkt EvolventenKreis
            double MP_EvolventenKreis_x = hk_r * Math.Cos(gamma_r);
            double MP_EvolventenKreis_y = hk_r * Math.Sin(gamma_r);

            // SchnittPunkt Evolventenkreis & Teilkreisradius
            double SP_EvolventenTeilKreis_x = -d_r *Math.Sin(beta_r);

            double SP_EvolventenTeilKreis_y = d_r * Math.Cos(beta_r);

            //Evolventenkreis Radius
            double Evolventenkreis_r = Math.Sqrt(Math.Pow((MP_EvolventenKreis_x - SP_EvolventenTeilKreis_x), 2) + Math.Pow((MP_EvolventenKreis_y - SP_EvolventenTeilKreis_y), 2));

            //SchnittPunkt Evolventenkreis & Kopfkreisradius
            double SP_EvolventenKopfKreis_x = Schnittpunkt_x(x0, y0, da_r, MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r);
            double SP_EvolventenKopfKreis_y = Schnittpunkt_y(x0, y0, da_r, MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r);

            //MittelPunkt VerrundungsRadius
            double MP_Verrundung_x = Schnittpunkt_x(x0, y0, df_r + vd_r, MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r + vd_r);
            double MP_Verrundung_y = Schnittpunkt_y(x0, y0, df_r + vd_r, MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r + vd_r);

            //SchnittPunkt Evolventenkreis & Verrundungsradius
            double SP_EvolventeVerrundung_x = Schnittpunkt_x(MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r, MP_Verrundung_x, MP_Verrundung_y, vd_r);
            double SP_EvolventeVerrundung_y = Schnittpunkt_y(MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r, MP_Verrundung_x, MP_Verrundung_y, vd_r);

            //SchnittPunkt Fußkreis & Verrundungs Radius
            double SP_FußkreisVerrundungsRadius_x = Schnittpunkt_x(x0, y0, df_r, MP_Verrundung_x, MP_Verrundung_y, vd_r);
            double SP_FußkreisVerrundungsRadius_y = Schnittpunkt_y(x0, y0, df_r, MP_Verrundung_x, MP_Verrundung_y, vd_r);

            //StartPunkt Fußkreis Radius
            double phi = ta_r - Math.Atan(Math.Abs(SP_FußkreisVerrundungsRadius_x) / Math.Abs(SP_FußkreisVerrundungsRadius_y));
            double StartPkt_Fußkreis_x = -df_r *Math.Sin(phi);

            double StartPkt_Fußkreis_y = df_r * Math.Cos(phi);

            //Skizze umbenennen und öffnen
            hsp_catiaProfil.set_Name("InnenverzahnungEinzel");
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            //Punkte
            Point2D catP2D_Ursprung = catFactory2D1.CreatePoint(x0, y0);

            Point2D catP2D_StartPkt_Fußkreis             = catFactory2D1.CreatePoint(StartPkt_Fußkreis_x, StartPkt_Fußkreis_y);
            Point2D catP2D_SP_FußkreisVerrundungsRadius1 = catFactory2D1.CreatePoint(SP_FußkreisVerrundungsRadius_x, SP_FußkreisVerrundungsRadius_y);
            Point2D catP2D_SP_FußkreisVerrundungsRadius2 = catFactory2D1.CreatePoint(-SP_FußkreisVerrundungsRadius_x, SP_FußkreisVerrundungsRadius_y);

            Point2D catP2D_MP_EvolventenKreis1 = catFactory2D1.CreatePoint(MP_EvolventenKreis_x, MP_EvolventenKreis_y);
            Point2D catP2D_MP_EvolventenKreis2 = catFactory2D1.CreatePoint(-MP_EvolventenKreis_x, MP_EvolventenKreis_y);

            Point2D catP2D_SP_EvolventenKopfKreis1 = catFactory2D1.CreatePoint(SP_EvolventenKopfKreis_x, SP_EvolventenKopfKreis_y);
            Point2D catP2D_SP_EvolventenKopfKreis2 = catFactory2D1.CreatePoint(-SP_EvolventenKopfKreis_x, SP_EvolventenKopfKreis_y);

            Point2D catP2D_MP_Verrundung1 = catFactory2D1.CreatePoint(MP_Verrundung_x, MP_Verrundung_y);
            Point2D catP2D_MP_Verrundung2 = catFactory2D1.CreatePoint(-MP_Verrundung_x, MP_Verrundung_y);

            Point2D catP2D_SP_EvolventeVerrundung1 = catFactory2D1.CreatePoint(SP_EvolventeVerrundung_x, SP_EvolventeVerrundung_y);
            Point2D catP2D_SP_EvolventeVerrundung2 = catFactory2D1.CreatePoint(-SP_EvolventeVerrundung_x, SP_EvolventeVerrundung_y);


            //Kreise
            Circle2D catC2D_Frußkreis = catFactory2D1.CreateCircle(x0, y0, df_r, 0, 0);

            catC2D_Frußkreis.CenterPoint = catP2D_Ursprung;
            catC2D_Frußkreis.StartPoint  = catP2D_SP_FußkreisVerrundungsRadius1;
            catC2D_Frußkreis.EndPoint    = catP2D_StartPkt_Fußkreis;

            Circle2D catC2D_Kopfkreis = catFactory2D1.CreateCircle(x0, y0, da_r, 0, 0);

            catC2D_Kopfkreis.CenterPoint = catP2D_Ursprung;
            catC2D_Kopfkreis.StartPoint  = catP2D_SP_EvolventenKopfKreis2;
            catC2D_Kopfkreis.EndPoint    = catP2D_SP_EvolventenKopfKreis1;

            Circle2D catC2D_EvolventenKreis1 = catFactory2D1.CreateCircle(MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r, 0, 0);

            catC2D_EvolventenKreis1.CenterPoint = catP2D_MP_EvolventenKreis1;
            catC2D_EvolventenKreis1.StartPoint  = catP2D_SP_EvolventenKopfKreis1;
            catC2D_EvolventenKreis1.EndPoint    = catP2D_SP_EvolventeVerrundung1;

            Circle2D catC2D_Evolventenkreis2 = catFactory2D1.CreateCircle(-MP_EvolventenKreis_x, MP_EvolventenKreis_y, Evolventenkreis_r, 0, 0);

            catC2D_Evolventenkreis2.CenterPoint = catP2D_MP_EvolventenKreis2;
            catC2D_Evolventenkreis2.StartPoint  = catP2D_SP_EvolventeVerrundung2;
            catC2D_Evolventenkreis2.EndPoint    = catP2D_SP_EvolventenKopfKreis2;

            Circle2D catC2D_VerrundungsKreis1 = catFactory2D1.CreateCircle(MP_Verrundung_x, MP_Verrundung_y, vd_r, 0, 0);

            catC2D_VerrundungsKreis1.CenterPoint = catP2D_MP_Verrundung1;
            catC2D_VerrundungsKreis1.StartPoint  = catP2D_SP_FußkreisVerrundungsRadius1;
            catC2D_VerrundungsKreis1.EndPoint    = catP2D_SP_EvolventeVerrundung1;

            Circle2D catC2D_VerrundungsKreis2 = catFactory2D1.CreateCircle(-MP_Verrundung_x, MP_Verrundung_y, vd_r, 0, 0);

            catC2D_VerrundungsKreis2.CenterPoint = catP2D_MP_Verrundung2;
            catC2D_VerrundungsKreis2.StartPoint  = catP2D_SP_EvolventeVerrundung2;
            catC2D_VerrundungsKreis2.EndPoint    = catP2D_SP_FußkreisVerrundungsRadius2;

            hsp_catiaProfil.CloseEdition();

            hsp_catiaPart.Part.Update();

            //Skizze und Referenzen
            Factory2D Factory2D1 = hsp_catiaProfil.Factory2D;

            HybridShapePointCoord Ursprung    = HSF_I.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = hsp_catiaPart.Part.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF_I.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = hsp_catiaPart.Part.CreateReferenceFromObject(XDir);

            //Kreismuster mit Daten füllen
            CircPattern Kreismuster = SF_I.AddNewSurfacicCircPattern(Factory2D1, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / dat.getZaehnezahlZahnrad1());
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(dat.getZaehnezahlZahnrad1()) + 1;

            //geschlossene Kontur
            Reference           Ref_Kreismuster = hsp_catiaPart.Part.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF_I.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = hsp_catiaPart.Part.CreateReferenceFromObject(Verbindung);

            HSF_I.GSMVisibility(Ref_Verbindung, 0);

            hsp_catiaPart.Part.Update();

            /*Bodies bodies = hsp_catiaPart.Part.Bodies;
             * Body myBody = bodies.Add();
             * myBody.set_Name("Zahnrad");
             * myBody.InsertHybridShape(Verbindung);
             *
             * hsp_catiaPart.Part.Update();*/

            //Tasche für Innenverzahnung(grob)
            hsp_catiaPart.Part.InWorkObject = hsp_catiaPart.Part.MainBody;

            Pocket catPocketInnen = SF_I.AddNewPocketFromRef(Ref_Verbindung, dat.getBreiteZahnrad1());

            hsp_catiaPart.Part.Update();
        }
Ejemplo n.º 30
0
        public void ErzeugeKreismusterMitBohrung(Data dat)
        {
            //Erzeuge Kreismuster

            ShapeFactory       SF  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;

            //Skizze und Referenzen
            Factory2D Factory2D1 = hsp_catiaProfil.Factory2D;

            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = hsp_catiaPart.Part.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = hsp_catiaPart.Part.CreateReferenceFromObject(XDir);

            //Kreismuster mit Daten füllen
            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D1, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / dat.getZaehnezahlZahnrad1());
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(dat.getZaehnezahlZahnrad1()) + 1;

            //geschlossene Kontur
            Reference           Ref_Kreismuster = hsp_catiaPart.Part.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = hsp_catiaPart.Part.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);

            hsp_catiaPart.Part.Update();

            Bodies bodies = hsp_catiaPart.Part.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);

            hsp_catiaPart.Part.Update();

            //Erzeuge Block aus Skizze
            hsp_catiaPart.Part.InWorkObject = myBody;
            Pad myPad = SF.AddNewPadFromRef(Ref_Verbindung, dat.getBreiteZahnrad1());

            hsp_catiaPart.Part.Update();


            //Erzeuge Skizze für Bohrung
            Reference RefBohrung1       = hsp_catiaPart.Part.CreateReferenceFromBRepName("FSur:(Face:(Brp:(Pad.1;2);None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithInitialFeatureSupport;MonoFond;MFBRepVersion_CXR15)", myPad);
            Hole      catBohrung1       = SF.AddNewHoleFromPoint(0, 0, 0, RefBohrung1, dat.getBreiteZahnrad1());
            Length    catLengthBohrung1 = catBohrung1.Diameter;

            catLengthBohrung1.Value = Convert.ToDouble(dat.getTeilkreisdurchmesserZahnrad1() / 2);

            hsp_catiaPart.Part.Update();
        }
Ejemplo n.º 31
0
        protected override Parameter[] SpecificParameters(IMatrixData data, ref string errString)
        {
            if (data.StringColumnCount == 0)
            {
                errString = "Please add at least one string column";
                return(null);
            }


            var ConditionColumn1Param = new SingleChoiceParam("Condition column, eg R.FileName")
            {
                Values = data.StringColumnNames,
                Value  = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("r.filename"))),
                Help   = "Chose experimental condition column, such as R.FileName, which will be used to create wide-format intensity columns. Has to be a text column."
            };

            var PerlParam = new SingleChoiceWithSubParams("Condition grouping")
            {
                Values = new[] { "Group by condition column", "Skip" },
                Value  = 0,
                Help   = "Chose if input should be grouped from long-format (e.g. Spectronaut report or MaxQuant LFQ evidence) or mixed-format " +
                         "(e.g. MaxQuant TMT evidence with conditions) into wide-format required for this plugin. Chose skip if data is already in wide-format " +
                         "(e.g. MaxQuant TMT evidence without conditions).",
                SubParams = new Parameters[] {             // Define the different sub-parameter groups
                    new Parameters(ConditionColumn1Param), // condition grouping
                    new Parameters()                       // Skip
                }
            };



            var Cutoff1aParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };
            var Cutoff1bParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };
            var Cutoff2aParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };
            var Cutoff2bParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };
            var Cutoff2cParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };
            var Cutoff3aParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };
            var Cutoff3bParam = new DoubleParam("Localization cutoff", 0.75)
            {
                Help = "Localization cutoff to be used to filter PTM localization. Can be between 0 and 1. Setting to 0 will not filter anything."
            };

            var PTMPosCol1Param = new SingleChoiceParam("PTM position column type")
            {
                Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)" },
                Help   = "Chose which column PTM positions should be extracted from. Requires respective columns."
            };
            var PTMPosCol2Param = new SingleChoiceParam("PTM position column type")
            {
                Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)", "Modified sequence (MQ)" },
                Help   = "Chose which column PTM positions should be extracted from. Requires respective columns."
            };
            var PTMPosCol3Param = new SingleChoiceParam("PTM position column type")
            {
                Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PrecursorId (SN)" },
                Help   = "Chose which column PTM positions should be extracted from. Requires respective columns."
            };

            var PTMPosCol2cParam = new SingleChoiceParam("Target PTM Probabilities column")
            {
                Values = data.StringColumnNames,
                Value  = Math.Max(0, data.StringColumnNames.FindIndex(col => col.ToLower().Equals("phospho (sty) probabilities"))),
                Help   = "Chose which column PTM target probabilities should be extracted from. Requires respective columns."
            };

            var ProbType1Param = new SingleChoiceWithSubParams("Probability column type")
            {
                Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column" },
                Help   = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " +
                         "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId.",
                SubParams = new Parameters[] {      // Define the different sub-parameter groups
                    new Parameters(Cutoff1aParam),  // EG.PTMLocalizationProbabilities
                    new Parameters(Cutoff1bParam),  // EG.PTMAssayProbability
                    new Parameters(PTMPosCol1Param) // Ignored
                }
            };
            var ProbType2Param = new SingleChoiceWithSubParams("Probability column type")
            {
                Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)",
                                 "No probability column", "Modified sequence (MQ)" },
                Help = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " +
                       "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId. Modified sequence will extract probabilities from provided PTM Probabilities columns.",
                SubParams = new Parameters[] {                      // Define the different sub-parameter groups
                    new Parameters(Cutoff2aParam),                  // EG.PTMLocalizationProbabilities
                    new Parameters(Cutoff2bParam),                  // EG.PTMAssayProbability
                    new Parameters(PTMPosCol2Param),                // Ignored
                    new Parameters(Cutoff2cParam, PTMPosCol2cParam) // Modified sequence
                }
            };
            var ProbType3Param = new SingleChoiceWithSubParams("Probability column type")
            {
                Values = new[] { "EG.PTMLocalizationProbabilities (SN)", "EG.PTMAssayProbability (SN)", "No probability column" },
                Help   = "Chose which column probabilities and PTM positions should be extracted from. Requires resepctive columns. " +
                         "EG.PTMAssayProbability will extract PTM positions from EG.PrecursorId.",
                SubParams = new Parameters[] {      // Define the different sub-parameter groups
                    new Parameters(Cutoff3aParam),  // EG.PTMLocalizationProbabilities
                    new Parameters(Cutoff3bParam),  // EG.PTMAssayProbability
                    new Parameters(PTMPosCol3Param) // Ignored
                }
            };

            var GenesParam = new SingleChoiceParam("Genes or protein groups")
            {
                Values = new[] { "PG.Genes", "PG.ProteinGroups" },
                Help   = "Chose if sites should be collapsed on gene or protein level."
            };
            var FastaFileParam = new FileParam("FASTA file (optional)")
            {
                Help = "Define file location of FASTA file for PTM motif sequence annotation. Leaving blank will skip annotation."
            };
            var FastaStringParam = new StringParam("FASTA identifier rule", ".*GN=([^ ]*) .*")
            {
                Help = "If FASTA file is provided, define identifier parsing rule. This is crucial to allow gene or protein name matching as defined above. Set e.g." +
                       ".*GN=([^ ]*) .* for gene readout, or .*\\|(.*)\\|.* for protein readout"
            };
            var StoichParam = new SingleChoiceParam("Stoichiometry calculation")
            {
                Values = new[] { "Calculate stoichiometries", "Skip" },
                Help   = "Chose if target PTM stoichiometries should be calculated."
            };


            var CollapseParam = new SingleChoiceWithSubParams("Collapse level")
            {
                Values = new[] { "Target PTM site-level, e.g. ABC1_S15_M1", "Target PTM peptide-level, e.g. FS[ph]EAMST[ph]R (stoichiometry possible)",
                                 "ModSpec peptide-level, e.g. FSEAMSTR_2[ph];1[ox]" },
                Value     = 0,
                Help      = "Chose if precursors should be collapsed on peptide- or site-level. Site-level requires PEP.PeptidePosition column.",
                SubParams = new Parameters[] {                                                    // Define the different sub-parameter groups
                    new Parameters(ProbType1Param, GenesParam, FastaFileParam, FastaStringParam), // Localized Site
                    new Parameters(ProbType2Param, StoichParam),                                  // Localized Peptide
                    new Parameters(ProbType3Param)                                                // ModSpec Peptide
                }
            };



            var PTMTypesParam = new StringParam("Variable PTMs, target PTM first", "[Phospho (STY)];[Deamidation (NQ)];[Oxidation (M)];[Carbamidomethyl (C)]")
            {
                Help = "List PTMs as listed in EG.PrecursorId, separated by semicolon. If target site- or target peptide-level collapse is performed, " +
                       "target PTM needs to be listed first."
            };



            var AggParam = new SingleChoiceParam("Aggregation type")
            {
                Values = new[] { "Linear modeling based", "Summing" },
                Help   = "Chose if peptide intensities should be aggregated based on a linear model or simply summed."
            };


            var NumberOfCoresParam = new IntParam("CPUcores", 8)
            {
                Help = "Number of CPU threads to be created by the plugin where possible. Set to 1 for lowest CPU usage. Do not set higher than actual number of available CPU threads."
            };


            return(new Parameter[]
            {
                PerlParam,
                CollapseParam,
                PTMTypesParam,
                AggParam,
                NumberOfCoresParam,
            });
        }
Ejemplo n.º 32
0
        /// <summary>
        /// 设置查询条件
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        private void SetCondition(string startDate, string endDate)
        {
            StringBuilder condition = new StringBuilder( );

            condition.AppendFormat(" WHERE DrawID IN (SELECT DrawID FROM  RecordDrawScore WHERE UserID={0})", IntParam.ToString( ));
            if (!string.IsNullOrEmpty(startDate))
            {
                condition.AppendFormat(" AND ConcludeTime >= '{0}' ", startDate);
            }
            if (!string.IsNullOrEmpty(endDate))
            {
                condition.AppendFormat(" AND ConcludeTime < '{0}'", Convert.ToDateTime(endDate).AddDays(1).ToString("yyyy-MM-dd"));
            }
            ViewState["SearchItems"] = condition.ToString( );
        }
 /// <summary>
 /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/>
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public static Parameter Convert(Parameter p)
 {
     if (p.Type == ParamType.Server){
         return p;
     }
     if (p is RegexReplaceParamWf){
         RegexReplaceParamWf q = (RegexReplaceParamWf) p;
         RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is RegexMatchParamWf){
         RegexMatchParamWf q = (RegexMatchParamWf) p;
         RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is BoolParamWf){
         BoolParamWf q = (BoolParamWf) p;
         BoolParam b = new BoolParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is BoolWithSubParamsWf){
         BoolWithSubParamsWf q = (BoolWithSubParamsWf) p;
         q.SubParamsFalse?.Convert(Convert);
         q.SubParamsTrue?.Convert(Convert);
         BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             SubParamsFalse = q.SubParamsFalse,
             SubParamsTrue = q.SubParamsTrue,
             Default = q.Default,
             ParamNameWidth = q.ParamNameWidth,
             TotalWidth = q.TotalWidth,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is DictionaryIntValueParamWf){
         DictionaryIntValueParamWf q = (DictionaryIntValueParamWf) p;
         DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is DoubleParamWf){
         DoubleParamWf q = (DoubleParamWf) p;
         DoubleParam b = new DoubleParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is FileParamWf){
         FileParamWf q = (FileParamWf) p;
         FileParam b = new FileParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Filter = q.Filter,
             ProcessFileName = q.ProcessFileName,
             Save = q.Save,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is FolderParamWf){
         FolderParamWf q = (FolderParamWf) p;
         FolderParam b = new FolderParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is IntParamWf){
         IntParamWf q = (IntParamWf) p;
         IntParam b = new IntParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is LabelParamWf){
         LabelParamWf q = (LabelParamWf) p;
         LabelParam b = new LabelParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is MultiChoiceMultiBinParamWf){
         MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf) p;
         MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Values = q.Values,
             Bins = q.Bins,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is MultiChoiceParamWf){
         MultiChoiceParamWf q = (MultiChoiceParamWf) p;
         MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Repeats = q.Repeats,
             Values = q.Values,
             Default = q.Default,
             DefaultSelections = q.DefaultSelections,
             DefaultSelectionNames = q.DefaultSelectionNames,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is MultiFileParamWf){
         MultiFileParamWf q = (MultiFileParamWf) p;
         MultiFileParam b = new MultiFileParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Filter = q.Filter,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is MultiStringParamWf){
         MultiStringParamWf q = (MultiStringParamWf) p;
         MultiStringParam b = new MultiStringParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is SingleChoiceParamWf){
         SingleChoiceParamWf q = (SingleChoiceParamWf) p;
         SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Values = q.Values,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is SingleChoiceWithSubParamsWf){
         SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf) p;
         foreach (Parameters param in q.SubParams){
             param?.Convert(Convert);
         }
         SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Values = q.Values,
             Default = q.Default,
             SubParams = new Parameters[q.SubParams.Count],
             ParamNameWidth = q.ParamNameWidth,
             TotalWidth = q.TotalWidth,
             Url = q.Url
         };
         for (int i = 0; i < q.SubParams.Count; i++){
             b.SubParams[i] = q.SubParams[i];
         }
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is StringParamWf){
         StringParamWf q = (StringParamWf) p;
         StringParam b = new StringParam(q.Name, q.Value){
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     if (p is Ms1LabelParamWf){
         Ms1LabelParamWf q = (Ms1LabelParamWf) p;
         Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value){
             Values = q.Values,
             Multiplicity = q.Multiplicity,
             Help = q.Help,
             Visible = q.Visible,
             Default = q.Default,
             Url = q.Url
         };
         foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){
             b.ValueChanged += act;
         }
         return b;
     }
     throw new Exception("Could not convert ParamWfeter");
 }