Addtext rhinoscript

hi, i’ve got a script, that since V6, addtext doesn’t work well, see the picture:


it write the two first and last letters of string of caracters…

Hi @onlyforpeace,

Can you post the portion of your code that isn’t working, so we can run it here?

– Dale

that is a code to generate GCODE for foamcuting with CNC Hot WIRE

    Call Main()
Sub Main()
	Dim strtraj1,strtraj2
	Dim arrpt1,arrpt2,strpt1
	Dim plane1,plane2
	
	'------------------------------------------------------------
	Dim fso,f
	'Create file system object (FSO) to be able to work with file system
	Set fso = CreateObject("Scripting.FileSystemObject")
	'definition du chemin du dossier d'enregistrement
	Dim chemo,chem,nomfichier,nprog,pos,seq,newchem,chemprog,chemprogtemp
	chemo = Rhino.documentPath
	If  Not isnull(chemo) Then
		'definition du nom de programme
		nprog = rhino.GetString("nom de programme")	
		If isnull(nprog) Then Exit Sub
	End If
	
	pos = instr(chemo, "ETUDE")
	If pos = 0 Then pos = instr(chemo, "Etude")
	seq = Split(chemo, "\")
	newchem = left(chemo, pos - 1)
	chemprogtemp = newchem & "USINAGE" 
	If Not fso.FolderExists(chemprogtemp) Then
		fso.CreateFolder chemprogtemp
	End If
	chemprog = chemprogtemp & "\" & "PROGPSE"
	If Not fso.FolderExists(chemprog) Then
		fso.CreateFolder chemprog
	End If
	nomfichier = chemprog & "\" & nprog & ".iso"
	
	
	'------------------------------------------------------------
	
	
	plane1 = rhino.GetObject("selectionne le plan")
	plane2 = rhino.GetObject("selectionne le plan")
	Dim box1,box2
	box1 = rhino.BoundingBox(plane1)
	box2 = rhino.BoundingBox(plane2)
	
	Dim strplane1,strplane2
	strplane1 = Rhino.PlaneFromPoints(box1(0), box1(1), box1(3))
	strplane2 = Rhino.PlaneFromPoints(box2(0), box2(1), box2(3))
	
	strtraj1 = rhino.Getobject("selectionne le parcours 01", 4)
	strtraj2 = rhino.GetObject("selectionne le parcours 02", 4)
	
	arrpt1 = rhino.curvepoints(strtraj1)
	arrpt2 = rhino.curvepoints(strtraj2)
	

	
	If ubound(arrpt1) <> ubound(arrpt2) Then
		rhino.print "pas les même nombre de noeud"
		Exit Sub
	End If
	Dim inter1,inter2,i,line,ox1,oy1,ox2,oy2
	i = 0
	'création du fichier texte
	
	Const ForReading = 1, ForWriting = 2, ForAppending = 8

	'entête de programme----------------------------------------
	Set f = fso.OpenTextFile(nomfichier, ForAppending, True)
	f.write("//NOME= DUEASSI")
	f.write(chr(13) & chr(10) & "//DIMX=500")
	f.write(chr(13) & chr(10) & "//DIMY=500")
	f.write(chr(13) & chr(10) & "F13" & chr(13) & chr(10) & "HM10" & chr(13) & chr(10) & "G92" & chr(13) & chr(10) & "G60" & chr(13) & chr(10) & "G63" & chr(13) & chr(10) & "G99")
	'------------------------------------------------------------
	For i=0 To ubound(arrpt1)
		
		line = array(arrpt1(i), arrpt2(i))
		inter1 = Rhino.LinePlaneIntersection(line, strplane1)
		inter2 = Rhino.LinePlaneIntersection(line, strplane2)
		If i = 0 Then
			ox1 = inter1(0)
			oy1 = inter1(1)
			ox2 = inter2(0)
			oy2 = inter2(1)
		End If
		rhino.addline inter1, inter2
		f.write(chr(13) & chr(10) & "G01" & " X" & round(inter1(0) - ox1, 3) & " Y" & round(inter1(1) - oy1, 3) & " Z" & round(inter2(0) - ox2, 3) & " A" & round(inter2(1) - oy2, 3))
		
	Next
	Dim note,entreplan,epbloc
	entreplan = abs(box2(0)(2) - box1(0)(2))
	epbloc = abs(arrpt2(0)(2) - arrpt1(0)(2))
	note = nomfichier & chr(13) & chr(10) & "longueur fil=" & entreplan & chr(13) & chr(10) & "épaisseur bloc=" & epbloc
	rhino.AddText note, array(arrpt1(0)(0) + 500, arrpt1(0)(1) - 500, 0), 50
	'rhino.print nomfichier
End Sub

for runing you have to save it in a folder named “ETUDE”
and use a file like this onetest.3dm (61.0 KB)

you have to:
choose name,
select one plane
select the second plane
select one curve
and the other,
normaly the script generate folder “USINAGE” near the Folder “ETUDE” with a gcode… with all point of curve.

Thanks @onlyforpeace, I’ve logged the bug.

https://mcneel.myjetbrains.com/youtrack/issue/RH-50611

– Dale