Prod.: Engine, ver.: 6, ID: 60001266, HowTo : I would like a method to select multiple continues entities by clicking only one

HowTo : I would like a method to select multiple continues entities by clicking only one

Article60001266
TypeHowTo
ProductEngine
Version6
Date Added11/23/2010
Submitted byShannon Davenport
Keywords

Subject

I would like a method to select multiple continues entities by clicking only one

Summary

I would like a method to select multiple continues entities by clicking only one

Solution

As the entities in the drawing are not fully continue each other and in some of them there is a small "gap" then you need to use like this below:

                vdFigure fig;
                gPoint pt;
                doc.Prompt("select a curve");
                doc.ActionUtility.getUserEntity(out fig,out pt);
                doc.Prompt(null);
                vdCurve curve = fig as vdCurve;
                if(curve == null) return;
               
                gPoint sp = curve.getStartPoint();
                gPoint ep = curve.getEndPoint();

               

                vdSelection set = new vdSelection();
                set.SetUnRegisterDocument(doc);
                set.AddItem(curve, true, vdSelection.AddItemCheck.RemoveInVisibleEntities);

                double equality = 0.01;
                int pos = 0;
                while (pos < set.Count && sp != null && ep != null)
                {

                    gPoints pts = new gPoints();
                    pts.Add((sp - new gPoint(equality, equality)));
                    pts.Add((sp + new gPoint(equality, equality)));
                    set.Select(RenderSelect.SelectingMode.CrossingWindowRectangle, pts);

                    pts = new gPoints();
                    pts.Add((ep - new gPoint(equality, equality)));
                    pts.Add((ep + new gPoint(equality, equality)));
                    set.Select(RenderSelect.SelectingMode.CrossingWindowRectangle, pts);
                    pos++;
                    sp = null;
                    ep = null;
                    for (int i = pos; i < set.Count; i++)
                    {
                       
                        curve = set[i] as vdCurve;
                        if (curve != null)
                        {
                            sp = curve.getStartPoint();
                            ep = curve.getEndPoint();
                            break;
                        }
                        pos++;
                    }

                }
                doc.UndoHistory.StoreUndoGroup(true);
                foreach (vdFigure ent in set)
                {
                    ent.PenColor = new vdColor(Color.Blue);
                    ent.LineWeight = VectorDraw.Professional.Constants.VdConstLineWeight.LW_120;
                }
                doc.UndoHistory.StoreUndoGroup(false);
                set.Invalidate();