怎么得到pl线的坐标信息?
MxDraw网页开发|黄洪辉|2018-05-08 11:36
-
回答:
function GetPolyline() { var ent = mxOcx.GetEntity("选择pl线:"); if (ent == null) { return; } if (ent.ObjectName != "McDbPolyline") { return; } var param = mxOcx.NewResbuf(); param.AddObjectId(ent.ObjectID); var ret = mxOcx.CallEx('Mx_Explode', param); var jj = 1; for(;jj < ret.Count;jj++) { var tmp = ret.AtObject(jj); if (tmp.ObjectName == "McDbLine") { // 是个直线。 得到直线的开始点坐标,和结束点坐标。 var spt = tmp.StartPoint; var ept = tmp.EndPoint; alert(spt.x); alert(spt.y); alert(ept.x); alert(ept.y); } else if (tmp.ObjectName == "McDbArc") { // 是个圆弧 var cen = tmp.Center; var sAng = tmp.StartAngle; var eAng = tmp.EndAngle; var r = tmp.Radius; alert(r); } tmp.Erase(); } }