Hi guys.
Is there a way to suppress the zero decimal values in a dimension?
It can cause a bit of confusion once the fabricators have covered my once beautiful clean drawings in grease and slag spots.
Cheers,
Kristen
Hi guys.
Is there a way to suppress the zero decimal values in a dimension?
It can cause a bit of confusion once the fabricators have covered my once beautiful clean drawings in grease and slag spots.
Cheers,
Kristen
Hi Kristen
Try the below script in Python . At the end launches the script and all dimensions will be OK:
#-*- encoding: utf-8 -*-
# write by Vittorio carlottovittorio@gmail.com
import rhinoscriptsyntax as rs
def ToglieZeri(string):
if "." in string: # se c'è il punto nella stringa la processo altrimenti no
k=0 # flag per ciclo while
while k==0:
a=string[-1] #ritorna l'ultimo elemento della stringa
if a=="0" or a==".":
string=string[:-1] #elimina ultimo elemento della stringa se è 0 o .
if a==".":break #se il carattere è un punto blocco il ciclo
else:
k=1
return string
def selezionaquote():
rs.UnselectAllObjects()
rs.EnableRedraw(False)
rs.Command("_seldim",False)
arrdim=rs.SelectedObjects()
rs.UnselectAllObjects()
for dim in arrdim:
testo=rs.DimensionText(dim)
newtesto=ToglieZeri(testo)
rs.DimensionUserText(dim,newtesto)
rs.EnableRedraw(True)
selezionaquote()
Ciao Vittorio
Hi Vittorio
Thanks for your reply.
I typed RunPythonScript into the command line, and selected the .py file and ran it.
It worked perfectly.
Now I just need to work out how to attach the script to a button.
Thanks, Kristen.