You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.6 KiB

4 weeks ago
function MyDynDrawLine() {
var _isGetPt1 = true;
var _pt1;
var _pt2;
// 具体的拖放操作,必须实现这个函数。
this.sampler = function () {
var inType = InType.kGetBegan;
if(!_isGetPt1)
inType = InType.kGetEnd;
var ret = this.acquirePoint(inType);
if(ret.status == DragStatus.kNormal)
{
if(_isGetPt1)
_pt1 = ret.pt;
else
_pt2 = ret.pt;
}
return ret.status;
}
// 具体的拖放操作,必须实现这个函数。
this.done = function(dragStatus)
{
if(_isGetPt1)
{
//MxJigCmdManager.Test();
// sKeyWord = _T("[回退(U)/圆弧(A)/宽度(W)]");
// sKeyWord = "U L"
//MxJigCmdManager.setKeywordList("[回退(U)/圆弧(A)/宽度(W)]")
//let retGet = MxJigCmdManager.GetCommandLineContent(0x08 | 0x02);
//MxJigCmdManager.ProcCommandRetResult(retGet.iRet ,"\n 需要点或选项关键字。 \n");
_isGetPt1 = false;
return DoneStatius.kContinueCommand;
}
else
{
var sTemp = '[{0},{1},{2},{3},"{4}"]'.format(
_pt1.x, _pt1.y,
_pt2.x, _pt2.y,MxFun.getCurrentColor()
);
MxFun.call('drawLine', sTemp, function (ret) {
console.log(ret);
});
return DoneStatius.kExitCommand;
}
}
// 具体的拖放操作,必须实现这个函数。
this.upDisplay = function () {
if(!_isGetPt1 && _pt1 != undefined && _pt2 != undefined )
{
this.drawLine(_pt1,_pt2);
}
}
}
function my2d_TestSelect() {
MyTestSelect.prototype = new McEdJigCommand();
var dynSelect = new MyTestSelect();
MxJigCmdManager.runCmd(dynSelect);
}
function MyTestSelect() {
var _pt1;
this.sampler = function () {
var inType = InType.kGetEnd;
var ret = this.acquirePoint(inType);
if(ret.status == DragStatus.kNormal)
{
_pt1 = ret.pt;
}
return ret.status;
}
// 具体的拖放操作,必须实现这个函数。
this.done = function(dragStatus)
{
let mousPos = MxFun.getCurrentMousePostion();
let interset = MxFun.getCurrentDraw().getIntersectObjects(mousPos);
console.log(interset);
return DoneStatius.kExitCommand;
}
// 具体的拖放操作,必须实现这个函数。
this.upDisplay = function () {
}
}