请教:如何在插入点自动打断,并使插入块与所插入直线方向一致
我想在直线上插入一个块,要求能自动打断该直线,并调整块的方向,使之与该直线方向一致,不知如何实现(VBA),请高手指点.先谢谢啦! Sub ttt45()Dim obj As AcadLine, pnt<BR> Dim objTemp As AcadLine<BR> Dim minpnt, maxpnt, cenpnt(2) As Double<BR> Dim objBlock As AcadBlockReference<BR> Dim height As Double<BR> Dim pnts(3)<BR> ThisDrawing.Utility.GetEntity obj, pnt<BR> <BR> temp = ThisDrawing.Utility.PolarPoint(pnt, obj.Angle + Atn(1) * 2, 10)<BR> Set objTemp = ThisDrawing.ModelSpace.AddLine(pnt, temp)<BR> pnt = obj.IntersectWith(objTemp, acExtendBoth)<BR> objTemp.Delete<BR> <BR> Set objBlock = ThisDrawing.ModelSpace.InsertBlock(pnt, "1", 1, 1, 1, 0)<BR> objBlock.GetBoundingBox minpnt, maxpnt<BR> cenpnt(0) = (minpnt(0) + maxpnt(0)) / 2<BR> cenpnt(1) = (minpnt(1) + maxpnt(1)) / 2<BR> height = maxpnt(1) - minpnt(1)<BR> <BR> objBlock.Move cenpnt, pnt<BR> objBlock.Rotate pnt, obj.Angle + Atn(1) * 2<BR> <BR> pnts(0) = obj.StartPoint<BR> pnts(1) = ThisDrawing.Utility.PolarPoint(pnt, obj.Angle, -height / 2)<BR> pnts(2) = ThisDrawing.Utility.PolarPoint(pnt, obj.Angle, height / 2)<BR> pnts(3) = obj.EndPoint<BR> obj.Delete<BR> ThisDrawing.ModelSpace.AddLine pnts(0), pnts(1)<BR> ThisDrawing.ModelSpace.AddLine pnts(2), pnts(3)
End Sub<BR> 成功了!非常感谢! 请问飞狐版主:如果把这里的直线改为多线该怎么实现呢,也就是说,怎么获得多线上某点所在线段(好象ACAD中多线不是由线段构成的)的座标。
先谢谢啦! 判断点在多段线上的最近点,然后再判断最近点在哪个线段里,这要用VLAX才能求得最近点。 学习了。
页:
[1]