How to add rectangle in point select?

I use text dot is with of rectangle and height don’t chang. Point i select with mouse. I can’t add rectangle in point chose (cannot be converted to a Plane). Why not? and how can fix it.

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
    
def DoSomething(text):
    gp = Rhino.Input.Custom.GetPoint()
    gp.SetCommandPrompt("Pick a point")
    get_rc = gp.Get()
    if gp.CommandResult() != Rhino.Commands.Result.Success:
        return
    print gp.Point()
    pointadd=gp.Point()
    wi=int(text)
    h=2400
    pt = rs.coerce3dpoint(pointadd)
    rs.AddRectangle(pt,wi,h)
if __name__=="__main__":
    dot=rs.GetObject("Lay cot",8192)
    textdot=rs.TextDotText(dot)
    text=textdot[1:]
    print text
    DoSomething(text)
#DoSomething()

rs.AddRectangle wants a plane, not a point - as the Help topic indicates.

image

You will therefore need to supply it with a plane. If it’s to be on the XY plane you can write:

plane=Rhino.Geometry.Plane.WorldXY
plane.Origin=pt
rs.AddRectangle(plane,wi,h)
1 Like

Thank you @Helvetosaur . Please check messenger!