Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Rhino common API - LinetypeScale

$
0
0

Hello,

I am new to Rhino and particularly enjoy creating new commands with Rhino scripts. Could you please explain why this code doesn’t work to change the linetypeScale with the Rhino common API?

Thank you in advance for your help.

Best regards,

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs

def change_linetype_scale(curve_id, scale):
    curve = rs.coercecurve(curve_id)
    if curve:
        obj = sc.doc.Objects.Find(curve_id)
        if obj:
            obj.Attributes.LinetypeScale = scale
            obj.CommitChanges()
            sc.doc.Views.Redraw()
            print(f"L'échelle du type de ligne de la courbe {curve_id} a été changée en {scale}.")
        else:
            print("Impossible de trouver l'objet dans le document.")
    else:
        print("L'objet sélectionné n'est pas une courbe.")

# Sélectionner la courbe
curve_id = rs.GetObject("Sélectionnez une courbe", rs.filter.curve)
if curve_id:
    change_linetype_scale(curve_id, 5)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles