Пример #1
0
        protected override List <PathInfo> GetSweptPath()
        {
            AcadGeo.Point3d       center  = CalculateCenter();
            AcadGeo.Vector3d      ref_vec = AcadFuncs.GetVec(CalculateBranchPos(position, branch_positions[0], radius, angle), center);
            AcadGeo.CircularArc3d arc     = new AcadGeo.CircularArc3d(
                center, NormalVec(), ref_vec, radius,
                GetStartAngle(position, center, ref_vec, NormalVec()), GetEndAngle(position, center, ref_vec, NormalVec()));

            AcadFuncs.AddNewEnt(AcadDB.Arc.CreateFromGeCurve(arc));

            List <PathInfo> ents = new List <PathInfo>();

            AcadGeo.Point3d bp = CalculateBranchPos(position,
                                                    profile.NormalVector.GetNormal().IsParallelTo(AcadFuncs.GetVec(position, branch_positions[1])) ? branch_positions[1] : branch_positions[0],
                                                    radius, angle);

            profile.BasePoint = bp;
            ents.Add(new PathInfo(profile.GetRegions().First(), profile.GetSubRegions().First(), AcadDB.Arc.CreateFromGeCurve(arc), bp));

            //{
            //	var regs = profile.GetRegions();
            //	AcadFuncs.AddNewEnt(regs[0]);
            //}

            return(ents);
        }
Пример #2
0
        protected override List <PathInfo> GetSweptPath()
        {
            AcadGeo.Point3d       center  = CalculateCenter();
            AcadGeo.Vector3d      ref_vec = AcadFuncs.GetVec(CalculateBranchPos(position, main_branch_position, radius), center);
            AcadGeo.CircularArc3d arc     = new AcadGeo.CircularArc3d(
                center, NormalVec(), ref_vec, radius,
                GetStartAngle(position, center, ref_vec, NormalVec()), GetEndAngle(position, center, ref_vec, NormalVec()));

            //AcadFuncs.AddNewEnt(AcadDB.Arc.CreateFromGeCurve(arc));

            List <PathInfo> ents = new List <PathInfo>();

            AcadGeo.Point3d bp = CalculateBranchPos(position,
                                                    profile.NormalVector.GetNormal().IsParallelTo(ref_vec) ? branch_position : main_branch_position,
                                                    radius);

            profile.BasePoint = new AcadGeo.Point3d(bp.X, bp.Y, bp.Z);
            ents.Add(new PathInfo(profile.GetRegions().First(), profile.GetSubRegions().First(), AcadDB.Arc.CreateFromGeCurve(arc), bp));

            {
                AcadGeo.Plane         plane   = new AcadGeo.Plane(position, AcadFuncs.GetVec(position, branch_position));
                AcadGeo.CircularArc3d tmp_arc = new AcadGeo.CircularArc3d(
                    arc.Center, arc.Normal, arc.ReferenceVector, arc.Radius, arc.StartAngle, arc.EndAngle);
                tmp_arc.Mirror(plane);

                AcadGeo.Point3d tmp_bp = new AcadGeo.Point3d(bp.X, bp.Y, bp.Z);
                if (tmp_bp.IsEqualTo(CalculateBranchPos(position, branch_position, radius)))
                {
                    tmp_bp           += AcadFuncs.GetVec(position, branch_position) * radius * 2.0;
                    profile.BasePoint = tmp_bp;
                }
                //AcadFuncs.AddNewEnt(AcadDB.Arc.CreateFromGeCurve(tmp_arc));

                ents.Add(new PathInfo(profile.GetRegions().First(), profile.GetSubRegions().First(), AcadDB.Arc.CreateFromGeCurve(tmp_arc), tmp_bp));
            }

            {
                AcadGeo.Point3d tmp_pos     = CalculateBranchPos(position, branch_position, radius);
                AcadGeo.Point3d tmp_end_pos = tmp_pos + AcadFuncs.GetVec(position, branch_position) * radius * 2.0;

                AcadGeo.Point3d tmp_bp = new AcadGeo.Point3d(bp.X, bp.Y, bp.Z);
                if (tmp_bp.IsEqualTo(CalculateBranchPos(position, branch_position, radius)))
                {
                    profile.BasePoint = CalculateBranchPos(position, branch_position, radius);
                }
                else
                {
                    profile.BasePoint = new AcadGeo.Point3d(position.X, position.Y, position.Z);
                    profile.Rotate(AcadFuncs.GetVec(position, branch_position));
                    profile.BasePoint = CalculateBranchPos(position, branch_position, radius);
                }

                ents.Add(new PathInfo(profile.GetRegions().First(), profile.GetSubRegions().First(), new AcadDB.Line(tmp_pos, tmp_end_pos), tmp_bp));
            }


            return(ents);
        }