protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions("\nNext point: "); opts.BasePoint = (Entity as Line).StartPoint; opts.UseBasePoint = true; opts.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.AnyBlankTerminatesInput | UserInputControls.GovernedByOrthoMode | UserInputControls.GovernedByUCSDetect | UserInputControls.UseBasePointElevation | UserInputControls.InitialBlankTerminatesInput | UserInputControls.NullResponseAccepted; PromptPointResult res = prompts.AcquirePoint(opts); if (res.Status == PromptStatus.Cancel) { return(SamplerStatus.Cancel); } if (res.Value.Equals(_mTempPoint)) { return(SamplerStatus.NoChange); } else { _mTempPoint = res.Value; return(SamplerStatus.OK); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jppo = new JigPromptPointOptions("\nУкажите точку: "); jppo.UseBasePoint = true; jppo.BasePoint = _position; _jigPoint = prompts.AcquirePoint(jppo).Value; if (_jigPoint.IsEqualTo(_jigBasePoint)) { return(SamplerStatus.NoChange); } else { //Matrix3d mat = Matrix3d.Displacement(_jigBasePoint.GetVectorTo(_jigPoint)); //Entity.TransformBy(mat); _transformProcessor(_jigPoint); _br.Position = _jigPoint; _br.RecordGraphicsModified(true); _jigBasePoint = _jigPoint; return(SamplerStatus.OK); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jppo = new JigPromptPointOptions(this._message) { Cursor = CursorType.EntitySelect, BasePoint = _center, UseBasePoint = true, UserInputControls = UserInputControls.NullResponseAccepted }; jppo.Keywords.Add(""); // mod 20140527 var end = prompts.AcquirePoint(jppo).Value; if (end.IsNull()) { return(SamplerStatus.Cancel); } else if (end != _end) { this._end = end; return(SamplerStatus.OK); } return(SamplerStatus.NoChange); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigPointOpts = new JigPromptPointOptions("\nSpecify other corner point"); jigPointOpts.UseBasePoint = true; jigPointOpts.BasePoint = corner1; jigPointOpts.UserInputControls = (UserInputControls.Accept3dCoordinates) | UserInputControls.NullResponseAccepted; pres = prompts.AcquirePoint(jigPointOpts); Point3d endPointTemp = pres.Value; if (endPointTemp != corner2) { corner2 = endPointTemp; } else { return(SamplerStatus.NoChange); } if (pres.Status == PromptStatus.Cancel) { return(SamplerStatus.Cancel); } else { return(SamplerStatus.OK); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jigPromptPointOptions = new JigPromptPointOptions( $"\n{Language.GetItem(PlinesEditFunction.LangItem, "k22")}:") { UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NoNegativeResponseAccepted | UserInputControls.NullResponseAccepted, BasePoint = _sPoint, UseBasePoint = true, Cursor = CursorType.RubberBand }; var ppr = prompts.AcquirePoint(jigPromptPointOptions); if (ppr.Status != PromptStatus.OK) { return(SamplerStatus.Cancel); } if (ppr.Status == PromptStatus.OK) { _currPoint = ppr.Value; if (CursorHasMoved()) { _prevPoint = _currPoint; return(SamplerStatus.OK); } return(SamplerStatus.NoChange); } return(SamplerStatus.NoChange); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions prPntOpts = new JigPromptPointOptions("\nPick Corner 2: "); prPntOpts.UseBasePoint = false; PromptPointResult prResult = prompts.AcquirePoint(prPntOpts); if (prResult.Status == PromptStatus.Cancel || prResult.Status == PromptStatus.Error) { return(SamplerStatus.Cancel); } Point3d pnt3dTmp = prResult.Value; pnt3dTmp = Db.wcsToUcs(pnt3dTmp); //.TransformBy(UCS.Inverse()); //Point3d pnt3dTmp = prResult.Value; if (!pnt3dRes.IsEqualTo(pnt3dTmp, new Tolerance(1E-09, 1E-09))) { pnt3dRes = pnt3dTmp; return(SamplerStatus.OK); } else { return(SamplerStatus.NoChange); } }
/// <inheritdoc/> protected override SamplerStatus Sampler(JigPrompts prompts) { try { switch (JigState) { case JigState.PromptInsertPoint: return(_insertionPoint.Acquire(prompts, $"\n{PromptForInsertionPoint}", value => { _smartEntity.InsertionPoint = value; })); case JigState.PromptNextPoint: { var basePoint = _insertionPoint.Value; if (PreviousPoint != null) { basePoint = PreviousPoint.Value; } return(_nextPoint.Acquire(prompts, $"\n{PromptForNextPoint}", basePoint, value => { _smartEntity.EndPoint = value; })); } default: return(SamplerStatus.NoChange); } } catch { return(SamplerStatus.NoChange); } }
protected override SamplerStatus Sampler(JigPrompts Prompts) { PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:") { Cursor = 3, BasePoint = this.point3d_0, UseBasePoint = true }); Point3d value = promptPointResult.Value; SamplerStatus result; if (value != this.point3d_1) { Point3d point3d = this.point3d_0; Point3d point3d2 = value; if (point3d.X > point3d2.X) { Point3d point3d3 = point3d; point3d = point3d2; point3d2 = point3d3; } else if (point3d.X == point3d2.X & point3d.Y > point3d2.Y) { Point3d point3d4 = point3d; point3d = point3d2; point3d2 = point3d4; } double num = CAD.P2P_Angle(point3d, point3d2); Point3d pointAngle = CAD.GetPointAngle(point3d, 200.0 * this.double_0, num * 180.0 / 3.1415926535897931 + 45.0); Point3d pointAngle2 = CAD.GetPointAngle(point3d2, 200.0 * this.double_0, num * 180.0 / 3.1415926535897931 + 135.0); Polyline polyline = new Polyline(); polyline.SetDatabaseDefaults(); Polyline polyline2 = polyline; int num2 = 0; Point2d point2d; point2d..ctor(pointAngle.get_Coordinate(0), pointAngle.get_Coordinate(1)); polyline2.AddVertexAt(num2, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0); Polyline polyline3 = polyline; int num3 = 1; point2d..ctor(point3d.get_Coordinate(0), point3d.get_Coordinate(1)); polyline3.AddVertexAt(num3, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0); Polyline polyline4 = polyline; int num4 = 2; point2d..ctor(point3d2.get_Coordinate(0), point3d2.get_Coordinate(1)); polyline4.AddVertexAt(num4, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0); Polyline polyline5 = polyline; int num5 = 3; point2d..ctor(pointAngle2.get_Coordinate(0), pointAngle2.get_Coordinate(1)); polyline5.AddVertexAt(num5, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0); polyline.Layer = "正筋"; this.entity_0[0] = polyline; this.point3d_1 = value; result = 0; } else { result = 1; } return(result); }
protected override SamplerStatus Sampler(JigPrompts prompts) { SamplerStatus state = SamplerStatus.NoChange; JigPromptPointOptions prOpt = new JigPromptPointOptions("\nУкажите точку"); prOpt.BasePoint = _ptFirst; prOpt.UseBasePoint = true; PromptPointResult prRes = prompts.AcquirePoint(prOpt); if (prRes.Status == PromptStatus.Error || prRes.Status == PromptStatus.Cancel) { state = SamplerStatus.Cancel; } else { var ptNew = prRes.Value.TransformBy(UCS); if (_ptLast.DistanceTo(ptNew) <= _equalPoint) { state = SamplerStatus.NoChange; } else { _ptLast = ptNew; state = SamplerStatus.OK; } } return state; }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions prPntOpts = new JigPromptPointOptions("\nSelect new Basepoint: "); prPntOpts.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted; prPntOpts.BasePoint = pnt3dBase; prPntOpts.UseBasePoint = true; PromptPointResult prResult = prompts.AcquirePoint(prPntOpts); pnt3dRes = prResult.Value; if (prResult.Status == PromptStatus.Cancel || prResult.Status == PromptStatus.Error) { return(SamplerStatus.Cancel); } if (pnt3dRes == pnt3dBase) { return(SamplerStatus.NoChange); } if (prResult.Status == PromptStatus.OK) { return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts Prompts) { PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:") { Cursor = 6, BasePoint = this.point3d_0, UseBasePoint = true }); Point3d value = promptPointResult.Value; SamplerStatus result; if (value != this.point3d_1) { double num = CAD.P2P_Angle(this.point3d_0, value); Point3d pointAngle = CAD.GetPointAngle(this.point3d_0, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 + 90.0); Point3d pointAngle2 = CAD.GetPointAngle(value, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 + 90.0); this.entity_0[0] = new Line(pointAngle, pointAngle2); pointAngle = CAD.GetPointAngle(this.point3d_0, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 + 90.0); pointAngle2 = CAD.GetPointAngle(value, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 + 90.0); this.entity_0[1] = new Line(pointAngle, pointAngle2); pointAngle = CAD.GetPointAngle(this.point3d_0, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 - 90.0); pointAngle2 = CAD.GetPointAngle(value, this.double_0 / 2.0, num * 180.0 / 3.1415926535897931 - 90.0); this.entity_0[2] = new Line(pointAngle, pointAngle2); pointAngle = CAD.GetPointAngle(this.point3d_0, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 - 90.0); pointAngle2 = CAD.GetPointAngle(value, this.double_0 / 6.0, num * 180.0 / 3.1415926535897931 - 90.0); this.entity_0[3] = new Line(pointAngle, pointAngle2); this.point3d_1 = value; result = 0; } else { result = 1; } return(result); }
// Update position of the block. protected override SamplerStatus Sampler(JigPrompts prompts) { var options = new JigPromptPointOptions() { UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted) }; options.Message = "Select a point:"; PromptPointResult result = prompts.AcquirePoint(options); Point3d currentPoint = result.Value; if (currentPoint == point) { return(SamplerStatus.NoChange); } point = currentPoint; if (result.Status == PromptStatus.OK) { return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { var status = base.Sampler(prompts); if (status == SamplerStatus.OK) { _endPoint = base.NormalPoint; _endPointComplete = true; /*_endPoint = base.NormalPoint; * var slopeLines = Calculate(_slopeMode); * lock (_entitiesInMemory) * { * if (slopeLines.Count > 0) * { * foreach (var ent in _entitiesInMemory) * if (!ent.IsDisposed) * ent.Dispose(); * _entitiesInMemory.Clear(); * _entitiesInMemory = new List<Entity>(); * _entitiesInMemory.AddRange(slopeLines); * } * }*/ } return(status); }
protected override SamplerStatus Sampler(JigPrompts prompts) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Matrix3d mt = ed.CurrentUserCoordinateSystem; JigPromptPointOptions optJigPoint = new JigPromptPointOptions(message); optJigPoint.Cursor = CursorType.Crosshair; optJigPoint.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.NullResponseAccepted; optJigPoint.BasePoint = basePoint.TransformBy(mt);//将wcs 转为ucs坐标 optJigPoint.UseBasePoint = true; PromptPointResult result = prompts.AcquirePoint(optJigPoint); Point3d tempPt = result.Value; if (result.Status == PromptStatus.Cancel) { return(SamplerStatus.Cancel); } Point3d temp = result.Value; temp = temp.TransformBy(mt.Inverse()); // 将选择点 转化为当前的用户坐标 if (basePoint != result.Value) // 如果坐标发生了变化 重新绘制当前的图形 { list = mOption.Invoke(temp.TransformBy(mt)); //basePoint = temp; return(SamplerStatus.OK); } else { return(SamplerStatus.NoChange); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jpo = new JigPromptPointOptions { BasePoint = FirstPoint, UseBasePoint = true, UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.GovernedByUCSDetect, Message = $"\n{Language.GetItem(LangItem, "msg8")}" }; var res = prompts.AcquirePoint(jpo); _secondPoint = res.Value; if (res.Status != PromptStatus.OK) { return(SamplerStatus.Cancel); } if (CursorHasMoved()) { _prevPoint = _secondPoint; return(SamplerStatus.OK); } return(SamplerStatus.NoChange); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions prOpt = new JigPromptPointOptions("\nУкажите точку"); prOpt.Keywords.Add("Плитка" + Options.LenTile); prOpt.Keywords.Add("Шов" + Options.LenSeam); prOpt.UserInputControls = UserInputControls.AcceptOtherInputString; if (_allVertex.Count>0) { prOpt.BasePoint = _allVertex[_allVertex.Count - 1]; prOpt.UseBasePoint = true; } PromptPointResult prRes = prompts.AcquirePoint(prOpt); if (prRes.Status == PromptStatus.Error || prRes.Status == PromptStatus.Cancel) { return SamplerStatus.Cancel; } else if (prRes.Status == PromptStatus.Keyword) { if (prRes.StringResult.StartsWith("Tile")) Options.LenTile = GetLenPrompt(prRes.StringResult, Options.LenTile); else if (prRes.StringResult.StartsWith("Seam")) Options.LenSeam = GetLenPrompt(prRes.StringResult, Options.LenSeam); } else { _lastVertex = prRes.Value.TransformBy(UCS.Inverse()); } return SamplerStatus.OK; }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions ppo = new JigPromptPointOptions("\nУкажите точку определяющую положение"); ppo.UseBasePoint = true; ppo.BasePoint = _insertPointUcs.TransformBy(_ucs); ppo.UserInputControls = UserInputControls.NoZeroResponseAccepted; PromptPointResult ppr = prompts.AcquirePoint(ppo); if (ppr.Status != PromptStatus.OK) { return(SamplerStatus.Cancel); } //Tools.GetAcadEditor().DrawVector(ppo.BasePoint, ppr.Value, 1, true); /*if (_position == ppr.Value) * return SamplerStatus.NoChange;*/ _jigPoint = ppr.Value.TransformBy(_ucs.Inverse()); return(SamplerStatus.OK); }
// Need to override this method. // Updating the current position of the block. //-------------------------------------------------------------- protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigOpts = new JigPromptPointOptions(); jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted); jigOpts.Message = "Select a point:"; PromptPointResult jigRes = prompts.AcquirePoint(jigOpts); Point3d pt = jigRes.Value; if (pt == _point) { return(SamplerStatus.NoChange); } _point = pt; if (jigRes.Status == PromptStatus.OK) { return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions ppo = new JigPromptPointOptions("\nSelect WeekJackPanel:"); PromptPointResult ppr = prompts.AcquirePoint(ppo); if (ppr.Status == PromptStatus.OK) { if (ppr.Value == CenterPoint) { return(SamplerStatus.NoChange); } else { if (Atend.Global.Acad.UAcad.IsInsideCurve((Curve)ContainerEntity, ppr.Value) == true) { CenterPoint = ppr.Value; return(SamplerStatus.OK); } else { return(SamplerStatus.NoChange); } } } else { return(SamplerStatus.Cancel); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jppintOp = new JigPromptPointOptions(); jppintOp.UserInputControls = UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.NullResponseAccepted ; if (Arc.NumberOfVertices == 0) { jppintOp.Message = "\n指定圆弧的起点"; } else if (Arc.NumberOfVertices == 1) { jppintOp.Message = "\n指定圆弧的第二个点"; } else { jppintOp.Message = "\n指定圆弧的端点"; } PromptPointResult pntres = prompts.AcquirePoint(jppintOp); if (pntres.Status == PromptStatus.OK) { TempPoint = pntres.Value.ToPoint2d(); return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { PromptPointResult promptSignPosition = GetJigPosition(prompts); if(promptSignPosition.Status == PromptStatus.Keyword) { switch(promptSignPosition.StringResult) { case "Vertical": { angle = Math.PI / 2; break; } case "Horizontal": { angle = 0; break; } case "KEnd": { stopStatus.Stop(); break; } } return SamplerStatus.OK; } else if(promptSignPosition.Status== PromptStatus.OK) { if (signPosition.DistanceTo(promptSignPosition.Value) < Tolerance.Global.EqualPoint) return SamplerStatus.NoChange; signPosition = promptSignPosition.Value; return SamplerStatus.OK; } return SamplerStatus.NoChange; }
protected override SamplerStatus Sampler(JigPrompts prompts) { switch (mCurJigFactorNumber) { case 1: JigPromptDistanceOptions opts = new JigPromptDistanceOptions("\nAdjust Elevation"); opts.BasePoint = Entity.Location; opts.UseBasePoint = true; PromptDoubleResult pdr = prompts.AcquireDistance(opts); if (pdr.Status == PromptStatus.Cancel) { return(SamplerStatus.Cancel); } if (pdr.Value.Equals(mElevAdj)) { return(SamplerStatus.NoChange); } else { mElevAdj = pdr.Value; return(SamplerStatus.OK); } default: break; } return(SamplerStatus.OK); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions optJig = new JigPromptPointOptions("\n请指定等边三角形的一个顶点") { Cursor = CursorType.RubberBand, UserInputControls = UserInputControls.Accept3dCoordinates, BasePoint = m_CenterPt.TransformBy(m_mt), UseBasePoint = true }; PromptPointResult resJig = prompts.AcquirePoint(optJig); Point3d curPt = resJig.Value; if (resJig.Status == PromptStatus.Cancel) { return(SamplerStatus.Cancel); } if (m_peakPt != curPt) { m_peakPt = curPt; Point2d cenPt = new Point2d(m_CenterPt.X, m_CenterPt.Y); m_pts[0] = new Point2d(m_CenterPt.TransformBy(m_mt.Inverse()).X, m_peakPt.TransformBy(m_mt.Inverse()).Y); double dis = m_pts[0].GetDistanceTo(cenPt); Vector2d vec = m_pts[0] - cenPt; double ang = vec.Angle; m_pts[1] = PolarPoint(cenPt, ang + Rad2Ang(120.0), dis); m_pts[2] = PolarPoint(cenPt, ang + Rad2Ang(240.0), dis); return(SamplerStatus.OK); } else { return(SamplerStatus.NoChange); } }
protected override SamplerStatus Sampler(JigPrompts _prompts) { JigPromptPointOptions jigOpt = new JigPromptPointOptions("Wskaż punkt wstawienia:") { UserInputControls = UserInputControls.Accept3dCoordinates, }; jigOpt.BasePoint = basePoint; jigOpt.UseBasePoint = true; PromptPointResult res = _prompts.AcquirePoint(jigOpt); switch (res.Status) { case PromptStatus.OK: currentPoint = res.Value; return(SamplerStatus.OK); case PromptStatus.Cancel: throw new OperationCanceledException(); default: throw new Exception("Nie rozpoznany PromptPoint ResultStatus"); } }
// Sampler函数用于检测用户的输入. protected override SamplerStatus Sampler(JigPrompts prompts) { Database db = HostApplicationServices.WorkingDatabase; // 定义一个点拖动交互类. JigPromptPointOptions optJigPoint = new JigPromptPointOptions("\n请指定五角星的一个角点:"); // 设置拖拽光标类型. optJigPoint.Cursor = CursorType.RubberBand; // 设置拖动光标基点. optJigPoint.BasePoint = mCenterPt; optJigPoint.UseBasePoint = true; // 用AcquirePoint函数得到用户输入的点. PromptPointResult resJigPoint1 = prompts.AcquirePoint(optJigPoint); Point3d curPt = resJigPoint1.Value; if (curPt != peakPt) { // 重新设置椭圆参数--------------------------------------------. // 五角星的中心. Point2d p0 = new Point2d(mCenterPt.X, mCenterPt.Y); // 计算五角星的第一个顶点坐标. Point2d p1 = new Point2d(curPt[0], curPt[1]); // 为计算其他9个顶点的坐标进行准备. double d1 = p1.GetDistanceTo(p0); double d2 = d1 * Math.Sin(Rad2Ang(18)) / Math.Sin(Rad2Ang(54)); Vector2d vec = p1 - p0; double ang = vec.Angle; // 计算五角星另外9个顶点的坐标. Point2d p2 = PolarPoint(p0, ang + Rad2Ang(36), d2); Point2d p3 = PolarPoint(p0, ang + Rad2Ang(72), d1); Point2d p4 = PolarPoint(p0, ang + Rad2Ang(108), d2); Point2d p5 = PolarPoint(p0, ang + Rad2Ang(144), d1); Point2d p6 = PolarPoint(p0, ang + Rad2Ang(180), d2); Point2d p7 = PolarPoint(p0, ang + Rad2Ang(216), d1); Point2d p8 = PolarPoint(p0, ang + Rad2Ang(252), d2); Point2d p9 = PolarPoint(p0, ang + Rad2Ang(288), d1); Point2d p10 = PolarPoint(p0, ang + Rad2Ang(324), d2); // 更新五角星各个顶点的坐标. ent.SetPointAt(0, p1); ent.SetPointAt(1, p2); ent.SetPointAt(2, p3); ent.SetPointAt(3, p4); ent.SetPointAt(4, p5); ent.SetPointAt(5, p6); ent.SetPointAt(6, p7); ent.SetPointAt(7, p8); ent.SetPointAt(8, p9); ent.SetPointAt(9, p10); peakPt = curPt; return(SamplerStatus.OK); } else { return(SamplerStatus.NoChange); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jppo = new JigPromptPointOptions("\n指定位置"); jppo.Keywords.Add(""); // mod 20140527 jppo.Cursor = CursorType.EntitySelect; jppo.UseBasePoint = false; jppo.UserInputControls = UserInputControls.NullResponseAccepted; Point3d pos = prompts.AcquirePoint(jppo).Value; if (pos.IsNull()) { return(SamplerStatus.Cancel); } else if (pos != _pos) { _move = pos - _pos; _pos = pos; return(SamplerStatus.OK); } else { _move = pos - _pos; return(SamplerStatus.NoChange); } }
public SamplerStatus Acquire(JigPrompts prompts, JigPromptPointOptions options, Action <Point3d> updater) { PromptPointResult promptPointResult = prompts.AcquirePoint(options); if (promptPointResult.Status != PromptStatus.OK) { if (promptPointResult.Status == PromptStatus.Other) { return(SamplerStatus.OK); } return(SamplerStatus.Cancel); } if (Value.IsEqualTo(promptPointResult.Value, Tolerance)) { return(SamplerStatus.NoChange); } var value = promptPointResult.Value; var point3D = value; Value = value; updater(point3D); return(SamplerStatus.OK); }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jppintOp = new JigPromptPointOptions(); jppintOp.UserInputControls = UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.NullResponseAccepted ; //jppintOp.UseBasePoint = false; //jppintOp.DefaultValue = new Point3d(); jppintOp.Keywords.Add("U", "U", "放弃(U)"); if (NumberOfVertices == 0) { jppintOp.Message = "\n选择起点"; } else { jppintOp.Message = "\n选择下一点"; } if (NumberOfVertices > 2) { jppintOp.Keywords.Add("C", "C", "闭合(C)"); } PromptPointResult pntres = prompts.AcquirePoint(jppintOp); PromptStatus ss = pntres.Status; if (pntres.Status == PromptStatus.OK) { TemPoint2d = pntres.Value.ToPoint2d(); return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
/// <summary> /// Samplers the specified prompts. /// </summary> /// <param name="prompts">The prompts.</param> /// <returns></returns> protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigOpts = new JigPromptPointOptions(); jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.NoNegativeResponseAccepted); if (pnts3d.Count == 0) { jigOpts.Message = "\nPick start point of polyline: "; } else if (pnts3d.Count > 0) { jigOpts.BasePoint = pnts3d.lastPoint(); jigOpts.UseBasePoint = true; jigOpts.Message = "\nPick next vertex: "; } else { return(SamplerStatus.Cancel); } PromptPointResult res = prompts.AcquirePoint(jigOpts); if (pnt3dTmp == res.Value) { return(SamplerStatus.NoChange); } else if (res.Status == PromptStatus.OK) { pnt3dTmp = res.Value; return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { //throw new System.Exception("The method or operation is not implemented."); JigPromptPointOptions ppo = new JigPromptPointOptions("\nCell Position:"); PromptPointResult ppr = prompts.AcquirePoint(ppo); if (ppr.Status == PromptStatus.OK) { if (ppr.Value == CenterPoint) { return(SamplerStatus.NoChange); } else { CenterPoint = ppr.Value; return(SamplerStatus.OK); } } else { return(SamplerStatus.Cancel); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jppo = new JigPromptPointOptions(this._message) { Cursor = CursorType.EntitySelect, UseBasePoint = false, UserInputControls = UserInputControls.NullResponseAccepted }; jppo.Keywords.Add(""); // mod 20140527 var pos = prompts.AcquirePoint(jppo).Value; if (pos.IsNull()) { return(SamplerStatus.Cancel); } else if (pos != _pos) { _move = pos - _pos; _pos = pos; return(SamplerStatus.OK); } return(SamplerStatus.NoChange); }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jppo = new JigPromptPointOptions("\n" + Language.GetItem(LangItem, "msg4")) { BasePoint = _line.StartPoint, UseBasePoint = true, UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.AcceptOtherInputString | UserInputControls.NoNegativeResponseAccepted }; var rs = prompts.AcquirePoint(jppo); _currentPoint = rs.Value; if (rs.Status != PromptStatus.OK) { return(SamplerStatus.Cancel); } if (CursorHasMoved()) { _prevPoint = _currentPoint; return(SamplerStatus.OK); } return(SamplerStatus.NoChange); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions("\nTarget Point Location (XY): (ESC to exit) "); Point3d pnt3dStartPoint = gc.calcBasePnt3d(_mTempPoint, p3d, vtx); opts.BasePoint = pnt3dStartPoint; opts.UseBasePoint = true; opts.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.AnyBlankTerminatesInput | UserInputControls.GovernedByOrthoMode | UserInputControls.GovernedByUCSDetect | UserInputControls.UseBasePointElevation | UserInputControls.InitialBlankTerminatesInput | UserInputControls.NullResponseAccepted; PromptPointResult res = prompts.AcquirePoint(opts); if (res.Status == PromptStatus.Cancel) { return(SamplerStatus.Cancel); } if (res.Value.Equals(_mTempPoint)) { return(SamplerStatus.NoChange); } else { _mTempPoint = res.Value; return(SamplerStatus.OK); } }
protected override SamplerStatus Sampler(JigPrompts prompts) { // We don't really need a point, but we do need some // user input event to allow us to loop, processing // for the Kinect input PromptPointResult ppr = prompts.AcquirePoint("\nClick to finish: "); if (ppr.Status == PromptStatus.OK) { // Let's move the mouse slightly to avoid having // to do it manually to keep the input coming System.Drawing.Point pt = System.Windows.Forms.Cursor.Position; System.Windows.Forms.Cursor.Position = new System.Drawing.Point( pt.X, pt.Y + _offset ); _offset = -_offset; return SamplerStatus.OK; } return SamplerStatus.Cancel; }
private PromptPointResult GetJigPosition(JigPrompts prompts) { JigPromptPointOptions jigPositionOptions = new JigPromptPointOptions(); jigPositionOptions.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.GovernedByOrthoMode); jigPositionOptions.SetMessageAndKeywords(Environment.NewLine + "Upuść znak lub obróc [Vertical/Horizontal/KEnd]", "Vertical Horizontal KEnd"); jigPositionOptions.Keywords.Default = (angle == 0) ? "Vertical" : "Horizontal"; PromptPointResult jigPositionPromptResult = prompts.AcquirePoint(jigPositionOptions); return jigPositionPromptResult; }
protected override SamplerStatus Sampler(JigPrompts prompts) { var res = prompts.AcquirePoint("\nТочка вставки:"); if (res.Status != PromptStatus.OK) throw new Exception(General.CanceledByUser); SamplerStatus status = SamplerStatus.NoChange; if (!Position.IsEqualTo(res.Value, Tolerance.Global)) { status = SamplerStatus.OK; } Position = res.Value; //TransformBy(ed.CurrentUserCoordinateSystem); return status; }
protected override SamplerStatus Sampler(JigPrompts prompts) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Matrix3d mt = ed.CurrentUserCoordinateSystem; JigPromptPointOptions optJigPoint = new JigPromptPointOptions ("\n请指定矩形的另一角点"); optJigPoint.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted; optJigPoint.BasePoint = m_Pt1.TransformBy(mt); optJigPoint.UseBasePoint = true; PromptPointResult resJigPoint = prompts.AcquirePoint(optJigPoint); Point3d tempPt = resJigPoint.Value; if (resJigPoint.Status == PromptStatus.Cancel) { return SamplerStatus.Cancel; } if (m_Pt2 != tempPt) { m_Pt2 = tempPt; Point3d ucsPt2 = m_Pt2.TransformBy(mt.Inverse()); try { m_PolyLine2.Normal = Vector3d.ZAxis; m_PolyLine2.Elevation = 0; m_PolyLine2.SetPointAt(0, new Point2d(m_Pt1.X, m_Pt1.Y)); m_PolyLine2.SetPointAt(1, new Point2d(ucsPt2.X, m_Pt1.Y)); m_PolyLine2.SetPointAt(2, new Point2d(ucsPt2.X, ucsPt2.Y)); m_PolyLine2.SetPointAt(3, new Point2d(m_Pt1.X, ucsPt2.Y)); m_PolyLine2.TransformBy(mt); } catch { } return SamplerStatus.OK; } else { return SamplerStatus.NoChange; } }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jigOpts = new JigPromptPointOptions(); jigOpts.Message = "\n" + _msg; var res = prompts.AcquirePoint(jigOpts); if (res.Status == PromptStatus.OK) { Point3d curPoint = res.Value; if (_position.DistanceTo(curPoint) > 1.0e-2) _position = curPoint; else return SamplerStatus.NoChange; } if (res.Status == PromptStatus.Cancel) return SamplerStatus.Cancel; else return SamplerStatus.OK; }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions(); // Not all options accept null response opts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoNegativeResponseAccepted ); // Get the first point if (m_pts.Count == 0) { opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.Message = "\nStart point of multileader: "; opts.UseBasePoint = false; } // And the second else if (m_pts.Count == 1) { opts.BasePoint = m_pts[m_pts.Count - 1]; opts.UseBasePoint = true; opts.Message = "\nSpecify multileader vertex: "; } // And subsequent points else if (m_pts.Count > 1) { opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.BasePoint = m_pts[m_pts.Count - 1]; opts.UseBasePoint = true; opts.SetMessageAndKeywords( "\nSpecify multileader vertex or [End]: ", "End" ); } else // Should never happen return SamplerStatus.Cancel; PromptPointResult res = prompts.AcquirePoint(opts); if (res.Status == PromptStatus.Keyword) { if (res.StringResult == "End") { return SamplerStatus.Cancel; } } if (m_tempPoint == res.Value) { return SamplerStatus.NoChange; } else if (res.Status == PromptStatus.OK) { m_tempPoint = res.Value; return SamplerStatus.OK; } return SamplerStatus.Cancel; }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigOpts = new JigPromptPointOptions(); jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted); if(mPromptCounter == 0) { jigOpts.Message = "\nEllipse Major axis:"; PromptPointResult dres = prompts.AcquirePoint(jigOpts); Point3d axisPointTemp = dres.Value; if(axisPointTemp != mAxisPt) { mAxisPt = axisPointTemp; } else return SamplerStatus.NoChange; if(dres.Status == PromptStatus.Cancel) return SamplerStatus.Cancel; else return SamplerStatus.OK; } else if (mPromptCounter == 1) { jigOpts.BasePoint = mCenterPt; jigOpts.UseBasePoint = true; jigOpts.Message = "\nEllipse Minor axis:"; double radiusRatioTemp = -1; PromptPointResult res = prompts.AcquirePoint(jigOpts); acquiredPoint = res.Value; radiusRatioTemp = mCenterPt.DistanceTo(acquiredPoint); // Ensure the radiusRatio is kept within the expected range. if (radiusRatioTemp > 1.0) radiusRatioTemp = 1.0; if (radiusRatioTemp != mRadiusRatio) mRadiusRatio = radiusRatioTemp; else return SamplerStatus.NoChange; if(res.Status == PromptStatus.Cancel) return SamplerStatus.Cancel; else return SamplerStatus.OK; } else { return SamplerStatus.NoChange; } }
protected override SamplerStatus Sampler(JigPrompts prompts) { if (!String.IsNullOrEmpty(_word)) { Document doc = Application.DocumentManager.MdiActiveDocument; if (doc != null) { doc.Editor.WriteMessage("\nWord recognised: {0}", _word); _word = ""; } } // We don't really need a point, but we do need some // user input event to allow us to loop, processing // for the Kinect input PromptPointResult ppr = prompts.AcquirePoint("\nClick to capture: "); if (ppr.Status == PromptStatus.OK) { if (_finished) { CancelJig(); return SamplerStatus.Cancel; } if (_tilt != 0) { int elev = _kinect.ElevationAngle + (_tilt * 5); if ( elev <= _kinect.MaxElevationAngle && elev >= _kinect.MinElevationAngle) { _kinect.ElevationAngle = elev; _tilt = 0; } } return SamplerData(); } return SamplerStatus.Cancel; }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions("\nSelect insertion point:"); opts.BasePoint = new Point3d(0, 0, 0); opts.UserInputControls = UserInputControls.NoZeroResponseAccepted; PromptPointResult ppr = prompts.AcquirePoint(opts); if (_pos == ppr.Value) { return SamplerStatus.NoChange; } _pos = ppr.Value; return SamplerStatus.OK; }
protected override SamplerStatus Sampler(JigPrompts prompts) { // We don't really need a point, but we do need some // user input event to allow us to loop, processing // for the Kinect input PromptPointResult ppr = prompts.AcquirePoint("\nClick to capture: "); if (ppr.Status == PromptStatus.OK) { if (Finished) { CancelJig(); return SamplerStatus.Cancel; } // Generate a point cloud try { // Use a user-defined sampling the points for the jig _vecs = GeneratePointCloud(Sampling); // Extract the points for display in the jig _points.Clear(); foreach (ColoredPoint3d vec in _vecs) { _points.Add( new Point3d(vec.X, vec.Y, vec.Z) ); } ForceMessage(); } catch { } return SamplerStatus.OK; } return SamplerStatus.Cancel; }