www.mxdraw.com
|
动态拖放时的绘制事件
[id(5)] void DynWorldDraw(DOUBLE dX, DOUBLE dY, IDispatch* pWorldDraw, IDispatch* pData, LONG* pRet);
参数 |
说明 |
DOUBLE dX |
当前鼠标位置X坐标 |
DOUBLE dY |
当前鼠标位置Y坐标 |
IDispatch* pWorldDraw |
IMxDrawWorldDraw对象,用于动态绘制 |
IDispatch* pData |
IMxDrawCustomEntity对象,动态绘制数据 |
成功返回1,失败返回0
例如:JS调用代码,动态插入一个图块
function DoInsert() { var mxOcx = document.all.item("MxDrawXCtrl1"); var getPt = mxOcx.NewComObject("IMxDrawUiPrPoint"); getPt.message ="点取插入点"; if(getPt.go() != 1) { return; } var frstPt =getPt.value(); if(frstPt == null) { return; } var getSecondPt = mxOcx.NewComObject("IMxDrawUiPrPoint"); var spDrawData =getSecondPt.InitUserDraw("TestDynDraw"); getSecondPt.message = "点取旋转角度"; getSecondPt.basePoint = frstPt; getSecondPt.setUseBasePt(true); spDrawData.SetPoint("pt1",frstPt); var sBlkName = "Tree"; var sBlkFile = mxOcx.GetOcxAppPath() + "\Blk\树.dwg"; mxOcx.InsertBlock(sBlkFile,"Tree"); spDrawData.SetString("BlkName","Tree"); if(getSecondPt.go() != 1) { return; } spDrawData.Draw(); } function DoDynWorldDrawFun(dX,dY,pWorldDraw,pData) { var mxOcx = document.all.item("MxDrawXCtrl1"); var sGuid = pData.Guid; mxOcx.SetEventRet(0); if(sGuid = "TestDynDraw") { // 动态插入图块。 var firstPt = pData.GetPoint("pt1"); if(firstPt == null) return; var sBlkName = pData.GetString("BlkName"); var secondPt = mxOcx.NewPoint(); secondPt.x = dX; secondPt.y = dY; var vec = firstPt.SumVector(secondPt); var dAng = vec.Angle(); pWorldDraw.DrawBlockReference(firstPt.x,firstPt.y,sBlkName,1.0,dAng * 180.0 / 3.14159265 + 90.0); mxOcx.SetEventRet(1); } }