| McNeel Wiki | |||||
| 편집 · 인쇄 · 도움말 · 모든 항목 | |||||
메뉴
언어
| 다음의 샘플 RhinoScript 4.0 코드에서는 문서의 치수 배율을 사용하여 올바르게 텍스트 개체의 크기를 조정하는 방법을 소개합니다.
Option Explicit
' Scales all text objects by the document's dimension scale
Sub DimScaleText
' Dim local variables
Dim arrObjects, strObject, arrPlane, dblScale
' Get document's dimension scale
dblScale = Rhino.DimScale
If dblScale = 1.0 Then
Rhino.Print "Dimension scale set to 1.0."
Exit Sub
End If
' Get ids of all annotation objects
arrObjects = Rhino.ObjectsByType(512)
If Not IsArray(arrObjects) Then
Rhino.Print "No text objects to scale."
Exit Sub
End If
' Turn off viewport redrawing (faster)
Rhino.EnableRedraw False
' Save current view's construction plane
arrPlane = Rhino.ViewCPlane(Rhino.CurrentView)
' Process each object
For Each strObject In arrObjects
' Verify object is a text object
If Rhino.IsText(strObject) And Rhino.IsObjectSelectable(strObject) Then
' Set the current view's construction plane to plane
' that defines the position and orientatio of the text
Rhino.ViewCPlane Rhino.CurrentView, Rhino.TextObjectPlane(strObject)
' Select the object
Rhino.SelectObject strObject
' Scale the object by the dimension scale
Rhino.Command "_-Scale 0,0,0 " & CStr(dblScale), False
' Unselect the object
Rhino.UnselectObject strObject
End If
Next
' Restore current view's construction plane
Rhino.ViewCPlane Rhino.CurrentView, arrPlane
' Turn on viewport drawing
Rhino.EnableRedraw True
End Sub
| ||||
| 이름 바꾸기 · 변경 · 히스토리 · 구독 · 찾기 · 참조 · 파일 업로드 | |||||