Well, in order to create “intermediate” construction geometry like curves and surfaces without actually adding them to the document and having to delete them later requires going a level deeper than rhinoscriptsyntax - you have to use some RhinoCommon.
Most rhinoscriptsyntax methods - which are in fact routines written RhinoCommon - take inputs of object id’s of objects that already exist in the document and they output new object ids after having written these to the document as well. This is simply how it is designed to work.
Since you said you’re a beginner, I would suggest you continue to work with with rhinoscriptsyntax until you are more familiar with it. RhinoCommon is quite a bit more complicated and the help/api guides are designed for someone who understands object oriented programming.
As per your code above, I’m not quite sure what you want the result to be, but there are some improvements you can make. First, to post code here, you can make it more readable/usable with the proper code formatting:
```python (three backticks)
<paste your entire code in here>
```
That way it will be formatted correctly with indents, etc. and thus be more readable plus being able to be copied/pasted elsewhere to test.
It seems like you want to have the planar surface between the two offset curves as a result - if not please reply with a correction. If that is the case, your code could look like this:
import rhinoscriptsyntax as rs
wt = 15
pts = rs.GetPoints(True, True, "start point", "next point")
rs.EnableRedraw(False)
pl = rs.AddPolyline(pts)
plE = rs.OffsetCurve(pl,[0,0,0],(wt/2),None, 1)
plI = rs.OffsetCurve(pl,[0,0,0],(-wt/2),None, 1)
#both of the above might be more than one curve, output is a list.
#Assuming that it is only one curve, you can use plE[0] and plI[0]
base=rs.AddLoftSrf([plE[0],plI[0]],loft_type=2)
#Use rs.DuplicateSurfaceBorder to get loft borders
bords=rs.DuplicateSurfaceBorder(base,0)
#simply add the planar surface using the list of borders
srf = rs.AddPlanarSrf(bords)
#delete the construction objects
rs.DeleteObjects([pl,plE,plI,base])
rs.DeleteObjects(bords)
You do not need to code the rs.EnableRedraw(True) at the end in a python script, it is automatically executed when the script ends.
Now, if you wanted to try to do this without adding the polyline or the offset curves to the document and deleting them later, it gets quite a bit more complex:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
#scriptcontext is the bridge between RhinoCommon virtual geometry and document
#Rhino represents the whole of RhinoCommmon
wt = 15
pts = rs.GetPoints(True, True, "start point", "next point")
#for many methods, you need to supply a tolerance
tol=rs.UnitAbsoluteTolerance()
#create a 'virtual' polyline curve
pl=Rhino.Geometry.PolylineCurve(pts)
#try to get the curve plane for the offset
rc,plane=pl.TryGetPlane(tol)
#or, get the active construction plane:
plane=rs.ViewCPlane()
#you need to supply a cornerstyle for Offset
cs=Rhino.Geometry.CurveOffsetCornerStyle.Sharp
#create the offsets
offsetsE=pl.Offset(plane,wt/2,tol,cs)
offsetsI=pl.Offset(plane,-wt/2,tol,cs)
#both of the above might be more than one curve, output is a list.
#Assuming that it is only one curve, you can try this:
plE=offsetsE[0]
plI=offsetsI[0]
#Loft without end points needs this:
us_pt=Rhino.Geometry.Point3d.Unset
#Plus a loft type
lt=Rhino.Geometry.LoftType.Straight
#create loft surface
loft_list=Rhino.Geometry.Brep.CreateFromLoft([plE,plI],us_pt,us_pt,lt,False)
#assuming it is one polysurface, use loft_list[0], get edges:
edges=loft_list[0].DuplicateNakedEdgeCurves(True,True)
#join the edges
joined=Rhino.Geometry.Curve.JoinCurves(edges)
#this will be a list of joined edge curves
#finally, create your planar surface
breps=Rhino.Geometry.Brep.CreatePlanarBreps(joined,tol)
#the result could be several surfaces, so output is a list
#add them to the document in a loop
for brep in breps: sc.doc.Objects.AddBrep(brep)
#redraw the scene (this is not automatic)
sc.doc.Views.Redraw()
In all of the above, I have not done any error checking or anything like that. This is also important so that the script doesn’t fail with an error message if the input cannot be used to make what you want.