23 February 2010

RH convert annotation dots to points02

A new improvement of last code on annotation dots convertion to different kind of labels. Now you can take text as prefix from one "pilot" label, coordinates are rounded to integer approximation and labels take their name from starting annotation dots with a progressive identification number.

Here the code:

Option Explicit
'Script written by Davide del Giudice
'Script copyrighted by Co-de-iT www.co-de-it.com
'Script version Sunday, 21 February 2010 20:40:21

'run and call subroutine
Call convert_annotation_dot_to_points_copy_label_to_points()
Sub convert_annotation_dot_to_points_copy_label_to_points()

'declare variables
Dim arrDots,strDot,strobject,strText1
Dim arrPt, strText,i
Dim count,numdots
'get input
arrDots = Rhino.GetObjects("Select annotation dots", 0, True, True )
strobject=Rhino.GetObject("select object to prefix",0)
'number classification starts from 0
'testing if script have to shut down or go forward
If Not IsArray(arrDots) Then Exit Sub
'iterations loop

For Each strDot In arrDots
For i=0 To numdots

strText = Rhino.TextDotText(strDot)
strText1 = Rhino.TextDotText(strobject)

arrPt = Rhino.TextDotPoint(strDot)
Rhino.AddPoints array(arrPt)
Rhino.DeleteObject strDot

'select first o second line for addtextDot or Addtext
Rhino.AddTextdot "pt"&count&"_"& strText1 & " "& "("&strText&")" &":"&" "& Rhino.Pt2Str (arrPt, 0) , arrPt
'Rhino.AddText "pt"& count&"_"& strText1 & " "& "("&strText&")" &":"&" "& Rhino.Pt2Str (arrPt, 0) , arrPt,0.5
Msgbox "visit http://www.co-de-it.com for more stuff"
End Sub


Ooops, something goes wrong :)

0 commenti: