Suppress Zero Decimal Value in Dimension


#1

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


Extend with join=no
#2

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


#3

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.


#4

Hi Kristen
you must create a new button like the attached picture , and add in the Python Editor : Tools OPtions add a new search path like the picture attached.
Ciao Vittorio