Hi:
In this script, why Rhino.Display.DrawLine() and Rhino.Display.Draw2dText() no work?
import Rhino
import rhinoscriptsyntax as rs
import System.Drawing
import scriptcontext
def GetDrawStringPoint():
poi = rs.GetPoint(“get st poi”)
c = rs.AddCircle(poi,0.5)
line_color_1 = System.Drawing.Color.FromArgb(255,0,0)
line_color_2 = System.Drawing.Color.FromArgb(0,0,255)
def GetPointDynamicDrawFunc( sender, args ):
ci0 = rs.coerceguid©
current_point = args.CurrentPoint
ci = Rhino.Geometry.Circle(current_point, 0.5)
ci1 = Rhino.Geometry.ArcCurve(ci)
args.Display.DrawCircle(ci,System.Drawing.Color.Red)
t, t1, t2, t3 = ci0.ClosestPoints(ci,0.0)
vec = rs.VectorCreate(t2,t1)
md_p = rs.PointAdd(poi,rs.VectorScale(vec,0.4))
ds = t1.DistanceTo(t2)
msg = str(’%.2f’ % (ds))
view = rs.CurrentView()
pt2 = rs.XformWorldToScreen(md_p, view)
args.Display.DrawLine(t1,t2,line_color_2,2)
args.Display.Draw2dText(msg, line_color_1, pt2,False,25)
gp = Rhino.Input.Custom.GetPoint()
gp.DynamicDraw += GetPointDynamicDrawFunc
gp.Get()
if( gp.CommandResult() == Rhino.Commands.Result.Success ):
pt = gp.Point()
rs.AddCircle(pt,0.5)
if name == “main”:
GetDrawStringPoint()
Sorry for my English skill.