Hello, I want to center the element in the view according to the element ID.
There is an error in the code above.
I have very little information about it.
Could you help me check where the code is wrong?
I would like to ask you what the problem is. Thank you.
private void ZoomElementView(string Id) { //get the element range DRange3d rangeElem; Element hiliteElem = GetElementByString(Id); DisplayableElement displayele = hiliteElem as DisplayableElement; displayele.CalcElementRange(out rangeElem); // double rL = rangeElem.High.X - rangeElem.Low.X, rW = rangeElem.High.Y - rangeElem.Low.Y, rH = rangeElem.High.Z - rangeElem.Low.Z; //Set the scope of the specified view based on this scope. int viewnumber; ViewGroupCollection viewcoll = dgnfile.GetViewGroups(); ViewGroup viewgroup = viewcoll.GetActive(); viewgroup.FindFirstOpenView(out viewnumber); ViewInformation viewinfo = viewgroup.GetViewInformation(viewnumber); //set view parameter DPoint3d delta = DPoint3d.FromXYZ(rL,rW,rH); DMatrix3d rotmax = viewinfo.Rotation; //set view range viewinfo.SetGeometry(rangeElem.Low,delta,rotmax); viewgroup.SetViewInformation(viewinfo, viewnumber); viewgroup.SaveChanges(); viewgroup.SynchViewDisplay(viewnumber, false, true, false); //update view Bentley.MstnPlatformNET.Session.Instance.Keyin("update view extended"); }