How cant i insert surface Knot by rhinopython?

Hi:
I want to insert Knot to surface by rhinopython, I have already try many way to do it, but false, help me please.
Sorry for my English skill.

import rhinoscriptsyntax as rs

obj = rs.GetObject(“11”)
poi = rs.GetPointOnSurface(obj, “222”)
if VarType(strObject) == vbString:
poi1 = rs.SurfaceClosestPoint(obj, poi)
rs.Command("_InsertKnot " + " SelID " + str(obj) + " _enter ")

Looks like you’re mixing some vbscript and python…

The following should work - you may need to change the direction to V if desired. I removed any error checking, you will need to flesh out the script somewhat.

import rhinoscriptsyntax as rs
obj = rs.GetObject("Pick a surface to add knot",filter=8,preselect=True,select=True)
pt = rs.GetPointOnSurface(obj)
rs.Command("_-InsertKnot Direction=U "+str(pt))

–Mitch

Think you Helvetosaur:
It work good.
By the way, I want ask if I don’t use the function “rs.GetPointOnSurface”, I want insert Knot to surface by the parameter of U V I have already set.
For example:

  import rhinoscriptsyntax as rs
  obj = rs.GetObject("Pick a surface to add knot",filter=8,preselect=True,select=True)
  U = rs.SurfaceDomain(obj, 0)
  V = rs.SurfaceDomain(obj, 1)
  pt = [(V[0]+V[1])*0.1, (U[0]+U[1])*0.1]
  rs.Command("_-InsertKnot _D=B " + str(pt) + " _Enter")

  It worksd, but have not Knot add.
  Sorry for my English skill.

Think you.

If you don’t want to script the command, you can always use Rhino.Geometry.NurbsCurve.InsertKnot.

Think you dale:
I just know a little rhinocommon, I have do it by rhinoscript, thinks for your help, and thinks Helvetosaur to.

	domainU = Rhino.SurfaceDomain(strsur, 0)
	domainV = Rhino.SurfaceDomain(strsur, 1)
	arrpp = array(domainU(1) - 0.001, domainV(1) - 0.001)
	Rhino.InsertSurfaceKnot strsur, arrpp, 1

like this, it work good.
Sorry for my English skill.