Do you mean you want to call a function that does something similar to what GH orient component does?
If so, this is not possible. Inside a VB node, you'll have to create your own definition.
If I understand you correctly its actually not too hard. The orient function implements what's referred to as a Change Basis transformation (it actually says this if you hover over it), which basically maps one plane onto another. This transformation is supported by the OnXform class, so if you have the two planes then it can work exactly the same. Attached is a recreation of the Orient component with VB.NET. As you'll see its next to nothing to recreate. The only gotcha is remembering which plane to supply to the function first...
...actually, on further review, I'm having a hard time getting this to work correctly when I apply different planes than ones oriented at the world origin. The orient component does the trick just fine, but the script component as written gets wacky. Is there something wrong with my code that I can quickly fix?
As I said "the only gotcha is remembering which plane to supply to the function first". It appears that I got that mixed up in the original definition that I posted, and it looks like that's what's going on in your image as well. Switching the planes should have them map correctly.
I'm sure I'm just not getting it...I've tried switching the inputs back and forth, to no avail...but thanks for getting back. I've been able to implement Morten's function below, so I'm all set...
Function Orient(ByVal ref_pt_01 As On3dPoint, ByVal ref_vec As On3dVector, ByVal srf_normal As On3dVector, ByVal obj As OnBrep, ByVal srf_pt As On3dPoint) As OnBrep
Dim x_coor As New Double
x_coor = srf_pt.x - ref_pt_01.x
Dim y_coor As New Double
y_coor = srf_pt.y - ref_pt_01.y
Dim z_coor As New Double
z_coor = srf_pt.z - ref_pt_01.z
Dim xform_move As New OnXform
xform_move.Translation(x_coor, y_coor, z_coor)
Dim xform_rotate As New OnXform
xform_rotate.Rotation(ref_vec, srf_normal, srf_pt)
Dim orient_obj As New OnBrep(obj)
orient_obj.Transform(xform_move)
orient_obj.Transform(xform_rotate)
After first applying it by checking a cone, I noticed that the function only oriented the objects on one axis, so I've added a second transformation that rotates the moved brep once more. This allows you to reorient orthogonal elements with edges more precisely to one another:
Function Orient(ByVal ref_pt_01 As On3dPoint, ByVal ref_pt_02 As on3dPoint, ByVal ref_vec As On3dVector, ByVal srf_normal As On3dVector, ByVal obj As OnBrep, ByVal srf_pt As On3dPoint, ByVal srf_pt_02 As On3dPoint) As OnBrep
Dim x_coor As New Double
x_coor = srf_pt.x - ref_pt_01.x
Dim y_coor As New Double
y_coor = srf_pt.y - ref_pt_01.y
Dim z_coor As New Double
z_coor = srf_pt.z - ref_pt_01.z
Dim xform_move As New OnXform
xform_move.Translation(x_coor, y_coor, z_coor)
Dim xform_rotate As New OnXform
xform_rotate.Rotation(ref_vec, srf_normal, srf_pt)
Dim orient_obj As New OnBrep(obj)
orient_obj.Transform(xform_move)
orient_obj.Transform(xform_rotate)
Dim dir_1 As New On3dVector(move_pt.x - srf_pt.x, move_pt.y - srf_pt.y, move_pt.z - srf_pt.z)
Dim dir_2 As New On3dVector(srf_pt_02.x - srf_pt.x, srf_pt_02.y - srf_pt.y, srf_pt_02.z - srf_pt.z)
Dim xform_rotate_2 As New OnXform
xform_rotate_2.Rotation(dir_1, dir_2, srf_pt)
orient_obj.Transform(xform_rotate_2)