예제 #1
0
        public void DrawLines()
        {
            var activemodel = Program.GetActiveDgnModel();
            var levelcache  = activemodel.GetFileLevelCache();
            var levelhandle = levelcache.GetLevelByName("PileAxis");

            if (levelhandle.Status == BD.LevelCacheErrorCode.CannotFindLevel)
            {
                levelhandle = levelcache.CreateLevel("PileAxis");
            }
            levelcache.Write();
            var leveledithandle = levelhandle.GetEditHandle();

            leveledithandle.Description = "桩的轴中心线";
            BM.SettingsActivator.SetActiveLevel(levelhandle.LevelId);

            BD.ElementPropertiesSetter levelsetter = new BD.ElementPropertiesSetter();
            levelsetter.SetLevel(levelhandle.LevelId);
            levelsetter.SetColor(3);

            BG.DPoint3d top, bottom;
            var         pilelist = ExtractPileInfo();

            foreach (var pile in pilelist)
            {
                top = new BG.DPoint3d(pile.TopX, pile.TopY, pile.TopZ);
                if (pile.Skewness == 0)
                {
                    bottom = top - BG.DPoint3d.UnitZ * pile.Length;
                }
                else
                {
                    double temp = pile.Length / (Math.Sqrt(pile.Skewness * pile.Skewness + 1));
                    bottom = top + new BG.DPoint3d(Math.Cos(pile.RotationDegree * deg2rad), Math.Sin(pile.RotationDegree * deg2rad), -pile.Skewness) * temp;
                }
                BG.DSegment3d   lineseg = new BG.DSegment3d(top * 10, bottom * 10);
                BDE.LineElement line    = new BDE.LineElement(activemodel, null, lineseg);
                levelsetter.Apply(line);

                var wb = new BDE.WriteDataBlock();
                wb.WriteString(pile.PileCode);
                line.AppendLinkage((ushort)BD.ElementLinkageId.String, wb);
                line.AddToModel();
            }
        }
예제 #2
0
        public void DrawCollisionIndicator()
        {
            var newlevelhandle = AddLevelByName("Collision");
            var levelsetter    = new BD.ElementPropertiesSetter();

            levelsetter.SetLevel(newlevelhandle.LevelId);
            levelsetter.SetColor(6);
            levelsetter.SetThickness(10, true);

            var activemodel = Program.GetActiveDgnModel();

            foreach (var collision in CollisionResult)
            {
                var line = new BDE.LineElement(activemodel, null, new BG.DSegment3d(collision.PileACollisionPoint, collision.PileBCollisionPoint));
                levelsetter.Apply(line);
                line.AddToModel();
            }
            BM.SettingsActivator.SetActiveLevel(newlevelhandle.LevelId);
            System.Windows.Forms.MessageBox.Show("碰撞交线已绘制在图层[Collision]中");
        }