示例#1
0
        private void OnBlocksSelected(List <AcBlockRef> blockRefs)
        {
            using (var trans = Ac.StartTransaction())
            {
                var ln = trans.GetObject <Polyline>(this.LineId);
                if ((ln.StartPoint.Z != 0.0) || (ln.EndPoint.Z != 0.0))
                {
                    Ac.WriteLn("WARNING: Line is not on plane (Elevation != 0.0; Z != 0)");
                }

                var ln2d = ln.ConvertTo(false);
                //ln2d.Elevation = 0;
                //foreach (Vertex2d pt in ln2d)
                //{
                //    Ac.WriteLn(pt.Position.ToString());
                //}

                foreach (var bl in blockRefs)
                {
                    var blPt2d = new Point3d(bl.Position.X, bl.Position.Y, 0.0);
                    var lnPt   = ln2d.GetClosestPointTo(blPt2d, false);
                    lnPt = new Point3d(lnPt.X, lnPt.Y, 0.0);

                    AlignedDimension dim = new AlignedDimension(blPt2d, lnPt, lnPt, null, this.DimStyleId);
                    dim.LayerId = trans.CurrentLayer.Id;

                    trans.AddEntity(dim);
                }
                ln2d.Dispose();
                trans.Commit();
            }
        }
示例#2
0
        private bool GetTextHeight()
        {
            this.TextHeight = Ac.GetValue("OrthoDist.TextHeight").ToDouble();
            if (this.TextHeight <= 0.0)
            {
                this.TextHeight = 1.0;
            }

            var opts = new PromptDistanceOptions(AppServices.Strings.EnterTextHeight);

            opts.DefaultValue  = this.TextHeight;
            opts.Only2d        = true;
            opts.UseDashedLine = true;
            opts.UseBasePoint  = false;

            var res = Ac.Editor.GetDistance(opts);

            if (res.Status != PromptStatus.OK)
            {
                return(false);
            }

            this.TextHeight = res.Value;
            return(true);
        }
示例#3
0
        protected override void ExecuteCore()
        {
            InitBlockName();
            do
            {
                var ptRes = Ac.Editor.GetPoint("\r\n" + AppServices.Strings.EnterInsertionPoint);
                if (!ptRes.IsOK())
                {
                    return;
                }

                var insPnt = ptRes.Value;

                var idOpt = Ac.Editor.GetPromptStringOptions("r\n" + AppServices.Strings.EnterPointId, pointId, false, true);
                var idRes = Ac.Editor.GetString(idOpt);
                if (!idRes.IsOK())
                {
                    return;
                }

                pointId = idRes.StringResult;

                using (var trans = Ac.StartTransaction(true))
                {
                    var blockDef = trans.GetBlockDef(BlockName);
                    var blockRef = blockDef.AddBlockRef(insPnt, trans);
                    blockRef.Scale = this.BlockScale;
                    blockRef.SetIdAttribute(pointId);

                    trans.Commit();
                }

                pointId = pointId.NextPointId();
            } while (true);
        }
示例#4
0
    private void ReflashBoxList(Ac down)
    {
        this.activityBeginTime = down.beginTime;
        this.activityEndTime   = down.endTime;
        this.SetActivityTimeShow();
        int curData = down.curData;

        this.boxListInfo = down.acItemInfo;
        this.boxListInfo.Sort(new Comparison <AcItemInfo>(ConsumeRechargeManager.SortCompare));
        int count = this.boxListInfo.get_Count();

        this.rechargedNum.set_text("当前充值:" + curData.ToString());
        this.SetSliderBarValue(curData, this.boxListInfo);
        if (this.boxListInfo != null)
        {
            this.AddBoxItem(this.boxListInfo);
        }
        if (this.boxListInfo.get_Item(0).status == 2)
        {
            this.ShowRewardList(this.boxListInfo.get_Item(0).targetVal);
        }
        else
        {
            for (int i = count - 1; i >= 0; i--)
            {
                if (this.boxListInfo.get_Item(i).status != 2)
                {
                    this.ShowRewardList(this.boxListInfo.get_Item(i).targetVal);
                    break;
                }
            }
        }
    }
示例#5
0
        public void Save()
        {
            //Ac.InitProgress("Saving block data...", SelectedBlock.BlockCount);

            using (var docLock = Ac.Doc.LockDocument())
                using (var trans = Ac.StartTransaction())
                {
                    var blockDef = trans.GetBlockDef(SelectedBlock.Name);
                    foreach (var attr in blockDef.Attributes)
                    {
                        // Update BlockDef from 'editable' property value
                        var attrPresenter = SelectedBlock.GetAttribute(attr.Tag);
                        attr.Invisible = !attrPresenter.AttrVisiblePresenter;
                    }

                    var blockRefs = blockDef.GetBlocks(trans);
                    foreach (var blockRef in blockRefs)
                    {
                        blockRef.ResetBlock();
                        blockRef.Scale = SelectedBlockScale;

                        foreach (var attr in blockRef.Attributes)
                        {
                            var attrPresenter = SelectedBlock.GetAttribute(attr.Tag);
                            attr.Invisible = !attrPresenter.AttrVisiblePresenter;
                        }

                        Ac.ProgressStep();
                    }
                    trans.SetSavedBlockScale(SelectedBlock.Name, SelectedBlockScale);
                    trans.Commit();
                }

            Ac.ClearProgress();
        }
示例#6
0
        protected override void ExecuteCore()
        {
            var lastPolarMode = (Int16)Ac.GetSystemVariable("POLARMODE");
            var lastAutoSnap = (Int16)Ac.GetSystemVariable("AUTOSNAP");
            var angDir = Ac.GetSystemVariable("ANGDIR");
            var angBase = Ac.GetSystemVariable("ANGBASE");

            try
            {
                // Gdy jest ustawiony CLOCKWISE AC uważa, że 100g=>300g, więc ustaw wartości zerowe
                Ac.SetSystemVariable("ANGDIR", Convert.ToInt16(0));
                Ac.SetSystemVariable("ANGBASE", 0.0);

                Ac.SetSystemVariable("POLARANG", OrtoAngle); // Set polar angle value
                Ac.SetSystemVariable("POLARMODE", lastPolarMode | 1); //Turns on relative tracking
                Ac.SetSystemVariable("AUTOSNAP", 8 | lastAutoSnap); //Turns on polar tracking
            }
            finally 
            {
                // A potem wróć do wartości poprzednich
                Ac.SetSystemVariable("ANGDIR", angDir);
                Ac.SetSystemVariable("ANGBASE", angBase);
            }

            Ac.ExecuteCommand("_pline ");
        }
示例#7
0
 public BlockSelectPresenter(System.Windows.Window wnd, BlockRefsAction action)
 {
     _window    = wnd;
     _action    = action;
     BlockNames = Ac.GetBlockNames(true, true).ToList(); // WinForms BindingSource accepts only IList or IListSource
     BlockName  = BlockNames.FirstOrDefault();
 }
示例#8
0
        protected override void ExecuteCore()
        {
            this.DisplayErrormMessageBox = false;

            if (!GetBaseLine())
            {
                return;
            }
            if (!GetTextHeight())
            {
                return;
            }
            if (!GetTextPos())
            {
                return;
            }

            Ac.WriteLn("Ortho Text: " + Ac.ToString(this.TextHeight) + ", " + this.TextPos.ToString());

            do
            {
                if (!AddOrthoDist())
                {
                    return;
                }
            } while (true);
        }
示例#9
0
文件: Geo7App.cs 项目: 15831944/Geo7
 private void AddPalettes()
 {
     try
     {
         AppServices.Log.Add("AddPalettes()...");
         if (ToolsPalettes == null)
         {
             // use constructor with Guid so that we can save/load user data
             ToolsPalettes             = new PaletteSet(AppName);
             ToolsPalettes.MinimumSize = new System.Drawing.Size(300, 300);
             //ToolsPalettes.Size = new System.Drawing.Size(300, 500);
             //ToolsPalettes.Style = PaletteSetStyles.ShowTabForSingle | PaletteSetStyles.ShowAutoHideButton | PaletteSetStyles.ShowCloseButton;
             ToolsPalettes.Visible = true;
             //ToolsPalettes.KeepFocus = true;
             //ToolsPalettes.Add("Tools", new ToolsPallete());
             //AddPalette(new ToolPalettes.BlocksPalette());
             //AddPalette(new ToolPalettes.PolygonsPalette());
             //AddPalette(new ToolPalettes.InfoPalette()); // Tą zawsze wczytaj, żeby można było wczytać licencje
         }
         AppServices.Log.Add("AddPalettes():Done.");
     }
     catch (System.Exception ex)
     {
         Ac.WriteLn("Geo7: Error showing Tools Palette");
         Ac.WriteError(ex, this.GetType().Name + ".AddPalettes()", null);
     }
 }
示例#10
0
        private bool GetTextPos()
        {
            this.TextPos = TextToPos(Ac.GetValue("OrthoDist.TextPos"));

            // http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-DF40DD82-FD27-43C5-B7D2-E75646B2E47E
            var opts = new PromptKeywordOptions(AppServices.Strings.EnterTextPosition);

            opts.Keywords.Add("Left");
            opts.Keywords.Add("Right");
            //opts.Keywords.Default = this.TextPos.ToString();
            opts.AppendKeywordsToMessage = true;
            //opts.AllowNone = true;
            //opts.AllowArbitraryInput = true;

            //var optsStr = opts.Keywords.GetDisplayString(false);
            var res = Ac.Editor.GetKeywords(opts);

            if (res.Status != PromptStatus.OK)
            {
                return(false);
            }

            this.TextPos = TextToPos(res.StringResult);
            return(true);
        }
示例#11
0
        protected override void ExecuteCore()
        {
            var dlg     = AppServices.SaveFileDialog;
            var storage = dlg.ShowTextLinesWritersDialog(Ac.GetLastFileName("points"));

            if (storage == null)
            {
                return;
            }


            using (storage)
            {
                Ac.SetLastFileName("points", dlg.FilePath);
                using (var lTrans = Ac.StartTransaction())
                {
                    var allTexts = lTrans.GetAllEntities <DBText>().Where(ent => ent.Visible).Where(ent => !ent.TextString.IsEmpty());

                    Ac.InitProgress(AppServices.Strings.Saving, allTexts.Count());
                    foreach (var textEnt in allTexts)
                    {
                        if (lTrans.IsDisplayed(textEnt))
                        {
                            var x = textEnt.Position.X.ToString(XYCoordinate.DefaultPrecision);
                            var y = textEnt.Position.Y.ToString(XYCoordinate.DefaultPrecision);
                            var z = textEnt.Position.Z.ToString(XYCoordinate.DefaultPrecision);
                            storage.WriteFields(textEnt.TextString, x, y, z);
                        }
                        Ac.ProgressStep();
                    }
                    Ac.WriteLn(AppServices.Strings.XPointsSaved, storage.LinesWritten);
                }
            }
        }
示例#12
0
        private void AddPointsToDrawing(ICollection <XyzPoint> points)
        {
            AcDwgDb.ImportMissedBlockDef(this.BlockName, Geo7App.Geo7Dwg);

            using (var docLock = Ac.Doc.LockDocument())
            {
                using (var trans = Ac.StartTransaction())
                {
                    var blockScale = trans.GetSavedBlockScale(BlockName);
                    var blockDef   = trans.GetBlockDef(this.BlockName);
                    Ac.InitProgress(AppServices.Strings.LoadingPoints, points.Count);

                    foreach (var pt in points)
                    {
                        // Do not change X,Y coordinates - it was already done through this.ReadPoints(this.Storage, points);
                        var blockPos = pt.ToPoint3d(this.IgnoreThirdCoordinate);
                        var blockRef = blockDef.AddBlockRef(blockPos, trans);
                        blockRef.Scale = blockScale;

                        if (blockRef.Attributes.Count > 0)
                        {
                            SetAttributes(blockRef, pt);
                        }

                        //blockRef.Dispose();
                        Ac.ProgressStep();
                    }
                    Ac.ClearProgress();
                    //blockDef.Dispose();
                    trans.Commit();
                }
                //Debug.WriteLine(docLock);
            }
        }
示例#13
0
        public BlocksSettingsPresenter()
        {
            using (var trans = Ac.StartTransaction())
            {
                BlockList = trans.BlockDefs.Where(b => (b.HasAttributes) && (b.HasReferences)).ToList();
            }

            SelectedBlock = BlockList.FirstOrDefault();
        }
示例#14
0
文件: Geo7App.cs 项目: 15831944/Geo7
        public void PrintInfo()
        {
            Ac.WriteLn(Geo7App.AppName);
            Ac.WriteLn("Version: " + Ac.AssemblyVersion.ToString());
            Ac.WriteLn("Geo7 binary path: " + Ac.AssemblyPath);
            Ac.WriteLn("Geo7 log file:    " + AppServices.Log.LogFilePath);

            ShowRibbon();
        }
示例#15
0
文件: Geo7App.cs 项目: 15831944/Geo7
        public void InfoDialog()
        {
            string s = Geo7App.AppName;

            s += "\r\nVersion: " + Ac.AssemblyVersion;
            s += "\r\n\r\n" + Geo7App.WebSite;

            Ac.ShowMsg(s);
        }
示例#16
0
 private void SelectBlocks()
 {
     using (var docLock = Ac.Doc.LockDocument())
         using (var ui = Ac.StartUserInteraction(_window))
         {
             var selectedBlocks = Ac.Editor.GetBlocks(BlockName);
             AddSelectedIds(selectedBlocks);
             ui.End();
         }
 }
示例#17
0
    public void RefreshUI()
    {
        Ac aC = ConsumeRechargeManager.Instance.GetAC(Ac.AcType.Type.Recharge);

        if (aC == null)
        {
            return;
        }
        this.ReflashBoxList(aC);
    }
示例#18
0
        protected override void ExecuteCore()
        {
            if (Ac.GetBlockNames(true, true).Count < 1)
            {
                throw new System.Exception(AppServices.Strings.BlocksNotFond);
            }

            var selWnd = new BlockSelectWindow(OnBlocksSelected);

            Ac.ShowModal(selWnd);
        }
示例#19
0
        public void SyncByFailRecord(List <FailRecord> failRecords)
        {
            var kuList = Dkc.KqUsers.ToList();

            failRecords.ForEach(p =>
            {
                if (!p.IsSucess)
                {
                    var u = kuList.FirstOrDefault(k => k.DdId == p.DDid);
                    if (u == null)
                    {
                        p.Note += "|" + DateTime.Now + "_未同步到考勤系统";
                    }
                    else if (u.AttUserId == 0)
                    {
                        p.Note += "|" + DateTime.Now + "_考勤系统中未找到该员工";
                    }
                    else
                    {
                        var ar = GetCheckInOutRecord(new List <string>()
                        {
                            p.DDid
                        }, p.BegingDate, p.EndDate);
                        List <CHECKINOUT> cios = new List <CHECKINOUT>();
                        ar.ForEach(aritem =>
                        {
                            if (aritem.TimeResult != "NotSigned")
                            {
                                int c = Ac.CHECKINOUT.Count(ci => ci.USERID == u.AttUserId && ci.CHECKTIME == aritem.CheckTime);
                                if (c == 0)
                                {
                                    cios.Add(new CHECKINOUT
                                    {
                                        USERID     = u.AttUserId,
                                        CHECKTYPE  = "I",
                                        CHECKTIME  = aritem.CheckTime,
                                        VERIFYCODE = 1,
                                        SENSORID   = "3",
                                        sn         = "0246361160468",
                                    });
                                }
                            }
                        });
                        var list = cios.Distinct(new CheckInoutComparer()).ToList();
                        Ac.CHECKINOUT.AddRange(list);
                        p.IsSucess = true;
                        p.Note    += "|" + DateTime.Now + "_同步成功";
                    }

                    Dkc.SaveChanges();
                    Ac.SaveChanges();
                }
            });
        }
示例#20
0
 public TrailerAc(Ac p_ac, KaitaiStream p__io, MifareClassic.Trailer.AccessConditions p__parent = null, MifareClassic p__root = null) : base(p__io)
 {
     m_parent             = p__parent;
     m_root               = p__root;
     _ac                  = p_ac;
     f_canReadKeyB        = false;
     f_canWriteKeys       = false;
     f_canWriteAccessBits = false;
     f_keyBControlsWrite  = false;
     _read();
 }
示例#21
0
    public void RefreshUI()
    {
        Ac aC = ConsumeRechargeManager.Instance.GetAC(Ac.AcType.Type.Cost);

        if (aC == null)
        {
            Debug.LogError("本地取到的数据为空,请检查!");
            return;
        }
        this.ReflashBoxList(aC);
    }
示例#22
0
 public bool ContainsSprite(string s)
 {
     foreach (string Ac in Actions)
     {
         if (Ac.Contains(s))
         {
             return(true);
         }
     }
     return(false);
 }
示例#23
0
文件: Geo7App.cs 项目: 15831944/Geo7
        public static void WhichLanguage()
        {
            var cId  = SystemObjects.DynamicLinker.ProductLcid;
            var cId2 = Ac.LocaleId;
            var cult = new CultureInfo(cId2);
            var ed   = Ac.Editor;
            var ver  = Ac.Version;

            Ac.WriteLn("\nLanguage of your AutoCAD product is {0}.", cult.EnglishName);
            Ac.WriteLn(Thread.CurrentThread.CurrentCulture.EnglishName);
            Ac.WriteLn(Thread.CurrentThread.CurrentUICulture.EnglishName);
        }
 private void UpdateAC(Ac ac)
 {
     for (int i = 0; i < this.m_aclist.get_Count(); i++)
     {
         if (this.m_aclist.get_Item(i).typeId == ac.typeId)
         {
             this.m_aclist.set_Item(i, ac);
             return;
         }
     }
     this.m_aclist.Add(ac);
 }
示例#25
0
 public DataAc(Ac p_ac, KaitaiStream p__io, MifareClassic.Trailer.AccessConditions p__parent = null, MifareClassic p__root = null) : base(p__io)
 {
     m_parent             = p__parent;
     m_root               = p__root;
     _ac                  = p_ac;
     f_readKeyARequired   = false;
     f_writeKeyBRequired  = false;
     f_writeKeyARequired  = false;
     f_readKeyBRequired   = false;
     f_decrementAvailable = false;
     f_incrementAvailable = false;
     _read();
 }
示例#26
0
文件: Geo7App.cs 项目: 15831944/Geo7
        public void StartupCheck()
        {
            AppServices.Log.NewSection();
            AppServices.Log.Add("Starting application: {0}, Version {1}...", Geo7App.AppName, Ac.AssemblyVersion.ToString());
            AppServices.Log.Add("CAD App Version: " + Ac.Version);
            AppServices.Log.Add("Geo7 binary path: " + Ac.AssemblyPath);
            AppServices.Log.AddLn();

            if (!System.IO.File.Exists(Geo7App.Geo7Dwg))
            {
                Ac.WriteError(SysUtils.Strings.FileNotFound, Geo7App.Geo7Dwg);
            }
        }
示例#27
0
        protected override void ExecuteCore()
        {
            this.DisplayErrormMessageBox = false;
            this.DimStyleId = AcDwgDb.ImportMissedDimStyle("G7-Diff", Geo7App.Geo7Dwg);

            LineId = Ac.Editor.GetPolyline("\r\n" + AppServices.Strings.SelectLine + ": ");

            if (LineId.IsValid)
            {
                Ac.WriteLn(AppServices.Strings.SelectBlock);
                var selWnd = new BlockSelectWindow(OnBlocksSelected);
                Ac.ShowModal(selWnd);
            }
        }
    public bool GetConsumeGiftPoint()
    {
        bool result = false;
        Ac   aC     = this.GetAC(Ac.AcType.Type.Cost);

        if (aC == null || aC.acItemInfo == null)
        {
            return(result);
        }
        List <AcItemInfo> acItemInfo = aC.acItemInfo;

        acItemInfo.Sort(new Comparison <AcItemInfo>(ConsumeRechargeManager.SortCompare));
        int num   = -1;
        int count = acItemInfo.get_Count();

        if (acItemInfo.get_Item(0).status == 2)
        {
            num = acItemInfo.get_Item(0).targetVal;
        }
        else
        {
            for (int i = count - 1; i >= 0; i--)
            {
                if (acItemInfo.get_Item(i).status != 2)
                {
                    num = acItemInfo.get_Item(i).targetVal;
                    break;
                }
            }
        }
        if (num == -1)
        {
            return(result);
        }
        AcItemInfo acItemInfo2 = null;

        for (int j = 0; j < acItemInfo.get_Count(); j++)
        {
            if (acItemInfo.get_Item(j).targetVal == num)
            {
                acItemInfo2 = acItemInfo.get_Item(j);
                break;
            }
        }
        if (acItemInfo2.status == 1)
        {
            result = true;
        }
        return(result);
    }
示例#29
0
        protected override void ExecuteCore()
        {
            var presenter = new BlocksSettingsPresenter();

            if (presenter.BlockList.Count < 1)
            {
                throw new System.Exception(AppServices.Strings.BlocksNotFond);
            }

            var wnd = new BlockSettingsWindow();

            wnd.DataContext = presenter;
            Ac.ShowModal(wnd);
        }
示例#30
0
 static void Application_SystemVariableChanged(object sender, SystemVariableChangedEventArgs e)
 {
     if (e.Name.ToLower() == "wscurrent")
     {
         try
         {
             InitGeo7Ribbon();
         }
         catch (System.Exception ex)
         {
             Ac.WriteError(ex, "RibbonUtils.Application_SystemVariableChanged()", null);
         }
     }
 }