Exemple #1
0
        private IEnumerable<Handle> CreateOffsetLines()
        {
            List<Handle> handles = new List<Handle>();
            Point3d pointOnLine = firstBarLine.GetClosestPointTo(spanPoint.Value, true);
            if (pointOnLine.DistanceTo(spanPoint.Value) == 0)
            {
                Handle handle = DrawBarLine(new Line(firstBarLine.StartPoint, firstBarLine.EndPoint));
                handles.Add(handle);
                return handles;
            }

            Line perpendincularLine = new Line(pointOnLine, spanPoint.Value);
            int barLinesAmount = (int)(perpendincularLine.Length / spanStep.Value);
            Transaction trans = db.TransactionManager.StartTransaction();
            using (trans)
            {
                BlockTableRecord btr = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
                for (int i = 0; i <= barLinesAmount; i++)
                {
                    lastBarLine = CreateFirstBarLine();
                    Point3d additionalPoint = perpendincularLine.GetPointAtDist(spanStep.Value * i);
                    Vector3d offsetVector = pointOnLine.GetVectorTo(additionalPoint);
                    btr.AppendEntity(lastBarLine);
                    lastBarLine.TransformBy(Matrix3d.Displacement(offsetVector));
                    handles.Add(lastBarLine.Handle);
                    trans.AddNewlyCreatedDBObject(lastBarLine, true);
                }
                trans.Commit();
            }
            return handles;
        }
Exemple #2
0
 private Line GetTrimmedDescriptionLine()
 {
     Line constructionLine = new Line(spanPoint1, descriptionSignPoint);
     double descriptionCircleRadius = 0.2 * scale;
     Point3d constructionPoint = constructionLine.GetPointAtDist(constructionLine.Length - descriptionCircleRadius);
     Line trimmedLine = new Line(constructionPoint, spanPoint1);
     return trimmedLine;
 }
Exemple #3
0
 private Point3d GetTextOrigin(Line l3)
 {
     return l3.GetPointAtDist(l3.Length / 2);
 }