Example of adding a SubD via RC

Hi @piac, @dalelear,

Is it possible to provide a short RC example of creating of SubD and display it in NURBS form in RC?
So far I have those lines, just wondering what is missing.
Dim icropt As SubD.InteriorCreaseOption = SubD.InteriorCreaseOption.AtMeshCrease
Dim mysub As SubD = Subd.CreateFromMesh(m, icropt)
mysub.SetSubDType(Subd.SubDType.QuadCatmullClark)
How to select SubD to be displayed in NURBS form?

Thanks,
Dmitriy

At this moment you cannot get the SubD Nurbs patches via RhinoCommon.
When the first .NET wrapping pass was performed, this functionality wasn’t ready, yet.

I’ve added it to the wish list.
https://mcneel.myjetbrains.com/youtrack/issue/RH-40118

mesh-subd.gh (5 KB)

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Thanks, Giulio!

I know that SubD is not a priority for now but I would like to keep exploring this subject.
Therefore, when do you think NURBS functionality can be added to RC?

Thanks,
Dmitriy

Sorry, I have no available time plan. When this will be available, I will make sure to let you know.

Thanks!

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Hi Dmitriy,
This week’s V7 WIP now has access to SubD in RhinoCommon. Let me know if you have any questions.
-Steve

2 Likes

Thanks, going to test it. :slight_smile:

Hi Giulio,

Working in Rhino 6, I get 'SubD is not accessible in this context because it is a ''Friend".

Has the implementation changed since you posted this example? And if so, can you post an updated example?

Or does it only work in the rhino7 WIP?

Jack

Yes.

@stevebaer - Are remember seeing an example Sub-D Rhinocommon .gh file shared on the forum. Do you know where I can locate this? As I recall, the .gh file contained a Python component with sample code for implementing the SubD class via Rhinocommon. - Ronnie

Hey Ronnie,
I can’t find a sample at the moment, but in the simplest form you should be able to create a SubD from a mesh by calling
Rhino.Geometry.SubD.CreateFromMesh(mesh)
https://developer.rhino3d.com/wip/api/RhinoCommon/html/Methods_T_Rhino_Geometry_SubD.htm

Thanks for the assistance with this. I was able to implement a few SubD methods and am looking forward to diving deeper into the API.

1 Like

Hello All, I am trying to use RC and RS for subdividing the SUBD using python. I used the method rg. SubD and it return bool. How do I bake the newly subdivided SuBD in the Rhino Document? Any help would be appreciated!

This is the code -
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg

#Get the geometry
a0 = rs.GetObject(‘Select the SubD geometry’)
#Get the geometry out of the GUID
a1 = rs.coercegeometry(a0)
a2 = rg.SubDEdge.GetType(a1)
print(type(a1))
int = rs.GetInteger(‘Specify the number of division’,2 )
a3 = rg.SubD.Subdivide(a1,int)

Best
Abhishek S Shinde


{EXD}-{AS}

import scriptcontext

subdivided = rg.SubD.Subdivide ( a1 , int )
print subdivided
if subdivided:
    scriptcontext.doc.Objects.AddSubD ( a1 )
    scriptcontext.doc.Views.Redraw()

Although, I’d like to see someone who actually knows what they’re doing offer a solution too. This should give you a subdivided copy on top.

1 Like

Thanks a lot Jonathan. I am trying to see how subdivision and mesh can exhibit relationship with Physics engine and how I can get new topologies.