Hello All,
I am interested in automating some of the drawings that i need to use in my other work related software.
That s why i would like to get a hold of the syntax of some operations that i can use in excel VBA.
The simplest type of a drawing that i can do in Rhino is by simply connecting the dots and create lines.
The Code Below is using the Line Command to draw simple lines to create a prismatic element. If you put this in excel vba macro and run it then you will get a prismatic element in Rhino.
Rather than using Lines , i would like to know the Syntax of Command to create a surface created by 4 dots. By creating 6 surface i can still make up a prismatic member.
If there is anyone out there who can help me on this , I would appreciate it.
All i want to know is the Syntax of Command that creates a surface in Rhinoscript that i can insert like seen in the example below within Excel VBA.
I also include another code that I figured out in Python that can create surface but that syntax will not work for VBA.
Thanks
Celal Kirandag
==> Excel VBA Code to Draw a prismatic element in Rhino
Dim Rhino As Object
Dim objRhinoScript
On Error Resume Next
’ Set Rhino to Running Rhino
'****************************
Set Rhino = CreateObject(“Rhino.Interface.7”) ’ Set Rhino = CreateObject(“Rhino.Application”)
If VBA.IsNull(“False”) Then Exit Sub
’
’
Rhino.Visible = True
’
’
’ Try getting RhinoScript object
'*********************************
Set objRhinoScript = Rhino.GetScriptObject
’
Dim pt0
’
objRhinoScript.Command “_Line w10.0,-10.0,0.0 w10.0,10.0,0.0”
objRhinoScript.Command “_Line w10.0,10.0,0.0 w-10.0,10.0,0.0”
objRhinoScript.Command “_Line w-10.0,10.0,0.0 w-10.0,-10.0,0.0”
objRhinoScript.Command “_Line w-10.0,-10.0,0.0 w10.0,-10.0,0.0”
’
objRhinoScript.Command “_Line w10.0,-10.0,10.0 w10.0,10.0,10.0”
objRhinoScript.Command “_Line w10.0,10.0,10.0 w-10.0,10.0,10.0”
objRhinoScript.Command “_Line w-10.0,10.0,10.0 w-10.0,-10.0,10.0”
objRhinoScript.Command “_Line w-10.0,-10.0,10.0 w10.0,-10.0,10.0”
’
’
objRhinoScript.Command “_Line w10.0,-10.0,0.0 w10.0,-10.0,10.0”
objRhinoScript.Command “_Line w10.0,10.0,0.0 w10.0,10.0,10.0”
objRhinoScript.Command “_Line w-10.0,10.0,0.0 w-10.0,10.0,10.0”
objRhinoScript.Command “_Line w-10.0,-10.0,0.0 w-10.0,-10.0,10.0”
If Err.Number <> 0 Then
’
VBA.MsgBox “Failed to create Rhino object.”
Exit Sub
’
End If
VBA.MsgBox “Rhino object created.”
End Sub
==>Python Code to Draw a prismatic element in Rhino
from Rhino.Geometry import NurbsSurface, Point3d
from scriptcontext import doc
surface1 = NurbsSurface.CreateFromCorners(
Point3d(100, -100, 0),
Point3d(100, 100, 0),
Point3d(-100, 100, 0),
Point3d(-100, -100, 0));
doc.Objects.AddSurface(surface1);
surface2 = NurbsSurface.CreateFromCorners(
Point3d(100, -100, 100),
Point3d(100, 100, 100),
Point3d(-100, 100, 100),
Point3d(-100, -100, 100));
doc.Objects.AddSurface(surface2);
surface3 = NurbsSurface.CreateFromCorners(
Point3d(100, -100, 0),
Point3d(100, 100, 0),
Point3d(100, 100, 100),
Point3d(100, -100, 100));
doc.Objects.AddSurface(surface3);
surface4 = NurbsSurface.CreateFromCorners(
Point3d(-100, -100, 0),
Point3d(-100, 100, 0),
Point3d(-100, 100, 100),
Point3d(-100, -100, 100));
doc.Objects.AddSurface(surface4);
surface5 = NurbsSurface.CreateFromCorners(
Point3d(-100, -100, 0),
Point3d( 100, -100, 0),
Point3d( 100, -100, 100),
Point3d(-100, -100, 100));
doc.Objects.AddSurface(surface5);
surface6 = NurbsSurface.CreateFromCorners(
Point3d(-100, 100, 0),
Point3d( 100, 100, 0),
Point3d( 100, 100, 100),
Point3d(-100, 100, 100));
doc.Objects.AddSurface(surface6);