misc.documentation

Option Explicit
‘Script written by
‘Script copyrighted by
‘Script version Sunday, September 28, 2008 12:18:06 AM

Call Main()
Sub Main()
Dim objects, folder, name, arrResults, arrDrawings
objects = Rhino.GetObjects(“Select Objects”)
If isNull(objects) Then Exit Sub

arrDrawings = Rhino.GetBoolean(“DrawingTypes”, array(“orthoElev”,”no”,”yes”,”auxElev”,”no”,”yes”,”auxTop”,”no”,”yes”,”auxBottom”,”no”,”yes”,”isoTop”,”no”,”yes”,”isoBottom”,”no”,”yes”),array(True,False,False,False,False,True))

arrResults = Rhino.GetBoolean(“Output Options”, array(“drawings”,”no”,”yes”,”renders”,”no”,”yes”),array(True,False))

If arrResults(1) = True Then
name=Rhino.GetString(“Enter prefix for jpeg file naming”)
folder = Rhino.BrowseForFolder(“testFolder”,”SelectFolder”,”RenderFolder”)
If IsNull(folder) Then Exit Sub
End If

Call multiIso(objects,array(0,0,0),folder,name,arrResults, arrDrawings)
End Sub
Function multiIso(arrObjects, origin,folder,name, arrBool, arrMode)
multiIso = Null

Dim strView
Dim k: k=0
Dim count
Dim arrPoint(),arrTitle()
ReDim arrPoint(k),arrTitle(k)
If arrMode(0) = True Then
ReDim Preserve arrPoint(k+5),arrTitle(k+5),arrSwitch(k+5)
‘plans and elevations
arrTitle(k) = “Top”
arrPoint(k) = Array(0,0,1)
arrTitle(k+1) = “Bottom”
arrPoint(k+1) = Array(0,0,-1)
arrTitle(k+2) = “Front”
arrPoint(k+2) = Array(0,-1,0)
arrTitle(k+3) = “Back”
arrPoint(k+3) = Array( 0,1,0)
arrTitle(k+4) = “Left”
arrPoint(k+4) = Array(-1,0,0)
arrTitle(k+5) = “Right”
arrPoint(k+5) = Array(1,0,0)
k=k+5
End If
If arrMode(1) = True Then
ReDim Preserve arrPoint(k+4),arrTitle(k+4),arrSwitch(k+4)
‘auxilary orthographic elevation
arrSwitch(k) = True
arrTitle(k) = “FrontLeft”
arrPoint(k) = Array(-1,-1,0)
arrTitle(k+1) = “FrontRight”
arrPoint(k+1) = Array( 1,-1,0)
arrTitle(k+2) = “BackLeft”
arrPoint(k+2) = Array(-1, 1,0)
arrTitle(k+3) = “BackRight”
arrPoint(k+3) = Array( 1, 1,0)
k=k+4
End If

If arrMode(2) = True Then
ReDim Preserve arrPoint(k+4),arrTitle(k+4),arrSwitch(k+4)
‘auxilary orthographic top
arrSwitch(k) = True
arrTitle(k) = “TopFront”
arrPoint(k) = Array(0,-1,1)
arrTitle(k+1) = “TopBack”
arrPoint(k+1) = Array( 0,1,1)
arrTitle(k+2) = “TopLeft”
arrPoint(k+2) = Array(-1,0,1)
arrTitle(k+3) = “TopRight”
arrPoint(k+3) = Array( 1,0,1)
k=k+4
End If
If arrMode(3) = True Then
ReDim Preserve arrPoint(k+4),arrTitle(k+4),arrSwitch(k+4)
‘auxilary orthographic bottom
arrSwitch(k) = True
arrTitle(k) = “BottomFront”
arrPoint(k) = Array(0,-1,-1)
arrTitle(k+1) = “BottomBack”
arrPoint(k+1) = Array( 0,1,-1)
arrTitle(k+2) = “BottomLeft”
arrPoint(k+2) = Array(-1,0,-1)
arrTitle(k+3) = “BottomRight”
arrPoint(k+3) = Array( 1,0,-1)
k=k+4
End If
If arrMode(4) = True Then
ReDim Preserve arrPoint(k+4),arrTitle(k+4),arrSwitch(k+4)
‘axonometric isometric top
arrSwitch(k) = True
arrTitle(k) = “TopFrontLeft”
arrPoint(k) = Array(-1,-1,1)
arrTitle(k+1) = “TopFrontRight”
arrPoint(k+1) = Array( 1,-1,1)
arrTitle(k+2) = “TopBackLeft”
arrPoint(k+2) = Array(-1, 1,1)
arrTitle(k+3) = “TopBackRight”
arrPoint(k+3) = Array( 1, 1,1)
k=k+4
End If
If arrMode(5) = True Then
ReDim Preserve arrPoint(k+4),arrTitle(k+4),arrSwitch(k+4)
‘axonometric isometric bottom
arrSwitch(k) = True
arrTitle(k) = “BottomFrontLeft”
arrPoint(k) = Array(-1,-1,-1)
arrTitle(k+1) = “BottomFrontRight”
arrPoint(k+1) = Array( 1,-1,-1)
arrTitle(k+2) = “BottomBackLeft”
arrPoint(k+2) = Array(-1, 1,-1)
arrTitle(k+3) = “BottomBackRight”
arrPoint(k+3) = Array( 1, 1,-1)
k=k+4
End If

count = k-1
Dim arrOrigin, vect
arrOrigin = Array(0,0,0)

Call Rhino.Command(“-_SetView c t “, False)
strView = Rhino.CurrentView()
Dim j,m,n,u
u=0
Dim obox: obox = Rhino.BoundingBox(arrObjects)
Dim i,r,s,t
Dim arrLabel
Dim invSel
Dim arrDrawings(),bbox(), dblLength(), dblHeight(), dblDist
ReDim arrDrawings(count),bbox(count), dblLength(count), dblHeight(count)
Call Rhino.EnableRedraw (False)

If arrBool(0) = True Then
If j = 0 And m = 0 And n = 0 Then
Call Rhino.SelectObjects(arrObjects)
Call Rhino.Command(“-_Make2d ” ,False)
Call Rhino.DeleteObjects(Rhino.SelectedObjects())
Else
Call Rhino.Command(“-_SetView c t “, False)
End If

Call Rhino.ViewProjection(strView,1)
For i = 0 To count Step 1
Call Rhino.ViewCameraTarget (strView, arrPoint(i), arrOrigin)
Call Rhino.UnselectAllObjects()
Call Rhino.SelectObjects(arrObjects)
Call Rhino.ZoomSelected()
Call Rhino.Command(“-_Make2d d c _Enter” ,False)
arrDrawings(i) = Rhino.SelectedObjects()
bbox(i) = Rhino.BoundingBox(arrDrawings(i))
dblLength(i) = Rhino.Distance(bbox(i)(0),bbox(i)(1))
dblHeight(i) = Rhino.Distance(bbox(i)(0),bbox(i)(3))
Call Rhino.UnselectAllObjects()

Next
r = 0
s = 0
t = 0
For i = 0 To count Step 1
ReDim Preserve arrHeight(s)
arrHeight(s) = dblHeight(i)
s=s+1
If arrSwitch(i) = True Then
t = t+Rhino.max(arrHeight)+3
ReDim arrHeight(0)
s = 0
r = 0
End If
If r > 0 Then
r = dblLength(i)*0.5+dblLength(i-1)*0.5+r
End If
Call Rhino.MoveObjects(arrDrawings(i),origin,array(r,u+t,0))
Call Rhino.AddText(CStr(arrTitle(i)),array(r,u+t-dblHeight(i)*0.2,0),dblHeight(i)*0.1)
r=r+3
If i = count Then
t = t+dblHeight(i)*1.5
End If
Next
End If

If arrBool(1) = True Then
If isArray(arrObjects) Then
Call Rhino.SelectObjects(arrObjects)
Else
Call Rhino.SelectObject(arrObjects)
End If
invSel = Rhino.InvertSelectedObjects()
If isNull(invSel) Then
Else
Call Rhino.HideObjects(invSel)
End If
Call Rhino.UnselectAllObjects()

Call Rhino.Command(“-_SetView c t “, False)
For i = 0 To count Step 1
Call Rhino.ViewCameraTarget (strView, arrPoint(i), arrOrigin)
Call Rhino.SelectObjects(arrObjects)
Call Rhino.ZoomSelected()
Call Rhino.Command(“_-Render”,False)
Call Rhino.Command(“_-SaveRenderWindowAs ” & GetRenderFileName(name,folder, CStr(arrTitle(i)), “png”),False)
Call Rhino.Command(“_-CloseRenderWindow”,False)
Call Rhino.UnselectAllObjects()
Next
End If
Call Rhino.EnableRedraw (True)
Call Rhino.Command(“-_SetView c t”, False)
Call Rhino.Command(“-_Show _Enter”,False)
Call Rhino.ZoomExtents()
End Function
Function GetRenderFileName(name,folder, view, ext)
Dim doc, file, temp
doc = Rhino.DocumentName
temp = “_”& name &”_”& view & “.” & ext
file = LCase(Replace(doc, “.3dm”, temp, 1, -1, 1))
GetRenderFileName = Chr(34) & folder & file & Chr(34)
End Function

Advertisements

There are no comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: