Пример #1
0
        public void getForm()
        {
            int  offsetY = 30, offsetX = 10;
            Form f = new Form();

            f.Height       = 150; f.Width = 400; f.WindowState = FormWindowState.Normal; f.Text = "Смещение"; f.StartPosition = FormStartPosition.CenterScreen;
            f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; f.AutoSize = true;
            System.Drawing.Point insPt = new System.Drawing.Point(5, 5);
            InterfaceDll.Lbl     lbs   = new Lbl(offsetX, offsetY, 100, 15, insPt, f, "Дистанция");
            InterfaceDll.CB      cbs   = new CB(offsetX, offsetY, 200, 15, insPt, f);
            cbs.position(lbs.last(), true);
            //cbs.last().Items.AddRange(new[] { "2.65", "2.8", "3", "4.5", "6" });
            ComponentOccurrence occ = ss[1] as ComponentOccurrence;

            if (occ == null)
            {
                return;
            }
            ins = occ.Constraints[1] as InsertConstraint;
            if (ins == null)
            {
                return;
            }


            cbs.last().Text       = last(ins.Distance);
            InterfaceDll.Btn btns = new Btn(offsetX, offsetY, 100, 20, insPt, f, click, "Добавить");
            btns.center(cbs.last(), offsetY + 5);
            f.Show();
        }
Пример #2
0
        private void recoverAssembly()
        {
            compDef = (AssemblyComponentDefinition)m_AsmDoc.ComponentDefinition;

            for (int i = 1; i < compDef.Constraints.Count; i++)
            {
                if (compDef.Constraints[i].Type != ObjectTypeEnum.kInsertConstraintObject)
                {
                    continue;
                }
                insConstr = (InsertConstraint)compDef.Constraints[i];
                if (insConstr.HealthStatus == HealthStatusEnum.kDriverLostHealth)
                {
                    ao           = insConstr.AxesOpposed;
                    offsetDouble = (double)insConstr.Distance.Value;
                    e1           = (EdgeProxy)insConstr.EntityOne;
                    pt           = e1.PointOnEdge;
                    min          = 0.03;
                    max          = 0.15;
                    do
                    {
                        objs = compDef.FindUsingPoint(pt, ref sel, min);
                        min  = objs.Count > 2 ? min - delta : min + delta;
                    }while (objs.Count != 2 || objs.Count < max);

                    if (objs.Count == 2)
                    {
                        e2 = (EdgeProxy)objs[1];
                        insConstr.Delete();
                        insConstr = e1.ContainingOccurrence.Name == e2.ContainingOccurrence.Name ? compDef.Constraints.AddInsertConstraint(e1, (EdgeProxy)objs[2], ao, offsetDouble)
                            : compDef.Constraints.AddInsertConstraint(e1, (EdgeProxy)objs[1], ao, offsetDouble);
                    }
                }
            }
        }
Пример #3
0
 public void offset(ComponentOccurrence occ, double d = 20)
 {
     ins = occ.Constraints[1] as InsertConstraint;
     if (ins == null)
     {
         return;
     }
     str(ins.Distance, d);
 }