I have some queries regarding Rhinopython commands.
In most cases, I am able to find the Rhinopython equivalent of the Rhino commands (or option from Rhino toolbars) based on the name of the command but not in some cases.
Could someone please help me out in getting the command for these 2 cases?
Also is there any provision to set the U,V discretization of Network curve surface while calling the AddNetworkSurf command itself rather than pursuing the “Rebuild surface UV” option in Rhino?
Thanks a lot. This was exactly what I was looking for. I am dealing with rhinoscriptsyntax and trying to use that as far as possible. But Rhinocommon solutions are also workable with.
By any chance, do you know how to set the options for the RebuildSurface command?
Hmm, I’m not 100% sure about this - closest thing I can find is Loft surfaces, which I believe is what the Rhino command is doing under the hood… that is a 2-step process, first extracting the number of isocurves you specify in the U/V direction, then lofting them together with the loft type options.
I linked to that above too, but it doesn’t have any overloads corresponding to the Type = Uniform / Tight / Loose etc. options avaliable in the Rhino command.
is giving an error “Message: expected IEnumerable[Curve], got tuple”.
What is the right way to implement methods of Rhino.Geometry in Rhinopython especially I do not want to activate some arguments? I know this is more of a python question than a Rhino question but any help would be great!
Yes, I’ve added a new Surface.RebuildOneDirection method to RhinoCommon. You’ll see it in Rhino 6 SR7. See the YouTrack link for an example of it’s usage.
As with other programming languages, by default values are passed in order into a method/function.
Arguments that have an ‘=’ such as start=None are optional, if values are not passed to those they will take on the default value (what comes after the ‘=’). All required arguments have to be listed first.
which means you pass a list of curves (required) and you accept all the other default values except for rebuildpointcount, which you set to 5 instead of the default 0.
The RhinoCommon API docs for the method specify what it expects for each argument as well as what it returns.
This probably means you didn’t pass a list of curves as the first argument, you passed a tuple (of something) which it wasn’t able to interpret.
Most of the syntax stuff can be picked up from a basic python book or online learning resource (highly recommended); for RhinoCommon specific stuff, there are the guides and samples on the API doc/guide pages…
Thank you very much for the detailed explanation and pointing me to the relevant resources.
I will refer online the docs that you have provided.
Also on further search, it seems like a similar error was discussed here although I that doesn’t seem to solve my problem.
I just gave my curve list as:
curves = (Line1,Line2,Line3,Line4)
obj=Rhino.Geometry.Brep.CreateFromLoftRebuild(curves,start=None, end=None, loftType = 1, closed=True, rebuildPointCount = 1)
Here as you had mentioned, I tried avoiding the default value case and I got the error as this command takes exactly 6 inputs.
Also I tried entering in the .NET format based on one of the inputs in the discussion although I am not sure if I entered it correctly.
geomBaseList = ListLine1,Line2,Line3,Line4
obj=Rhino.Geometry.Brep.CreateFromLoftRebuild(geomBaseList,start=None, end=None, loftType = 1, closed=True, rebuildPointCount = 1)
and I still got an error which said: “expected Type, got Guid”
Does this mean that the points and lines created should be only using Rhino.Geometry Methods?
Just checking as when I tried using the curves created using Rhinoscriptsyntax, I got the error “expected Curve, got Guid”
Line1=rs.AddLine(P1,P2)
Line2=rs.AddLine(P2,P3)
Line3=rs.AddLine(P3,P4)
Line4=rs.AddLine(P4,P1)
crvs = System.ArrayRhino.Geometry.Curve
unset = Rhino.Geometry.Point3d.Unset
ltype = Rhino.Geometry.LoftType.Loose
breps = Rhino.Geometry.Brep.CreateFromLoftRebuild(crvs, unset, unset, ltype, False, 8)
if breps:
for b in breps:
scriptcontext.doc.Objects.AddBrep(b)
scriptcontext.doc.Views.Redraw()
The rhinoscryptsyntax methods are document-centric. That it, the methods work on document object - hence the error indicating a guid was expected.
If you want to work on stuff not in the document - in this case creating a lofted surface from curve you create on the fly - you will need to use RhinoCommon (e.g. the Rhino name space).