如何偏移曲线?
C#开发|冯美娟|2018-07-24 15:04
-
回答:
private void OffsetCurves() { MxDrawUtility mxUtility = new MxDrawUtility(); MxDrawPoint getPt; MxDrawEntity ent = mxUtility.GetEntity(out getPt,"选择编移的曲线:"); if (ent == null) return; MxDrawCurve curve; if(ent is MxDrawCurve) { curve = (MxDrawCurve)ent; } else { MessageBox.Show("实体类型不对"); return; } MxDrawPoint getPt1 = (MxDrawPoint)(mxUtility.GetPoint(null, "点取偏移位置:")); if (getPt1 == null) { MessageBox.Show("用户取消.."); return; } MxDrawPoint getPt2 = (MxDrawPoint)(mxUtility.GetPoint(getPt1, "点取偏移距离:")); if (getPt2 == null) { MessageBox.Show("用户取消.."); return; } Double dis = (getPt1.x - getPt2.x) * (getPt1.x - getPt2.x) + (getPt1.y - getPt2.y) * (getPt1.y - getPt2.y); dis = Math.Sqrt(dis); MxDrawResbuf objId; if(curve.OffsetCurves(dis, getPt1, out objId) ) { MxDrawResbuf rbId = (MxDrawResbuf)objId; MessageBox.Show("偏移生成的曲线个数:" + rbId.Count); } }