示例#1
0
        private void InitBlockName()
        {
            if (!string.IsNullOrEmpty(BlockName))
            {
                return;
            }

            var bnOpt = Ac.Editor.GetPromptStringOptions("\r\n" + AppServices.Strings.EnterBlockName, LastBlockName, false, true);
            var bnRes = Ac.Editor.GetString(bnOpt);

            if (!bnRes.IsOK())
            {
                return;
            }

            var blockName = bnRes.StringResult;

            if (string.IsNullOrEmpty(blockName))
            {
                //InitBlockName();
                return;
            }

            AcDwgDb.ImportMissedBlockDef(blockName, Geo7App.Geo7Dwg);
            this.BlockName = blockName;
        }
示例#2
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);
            }
        }