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

Shorter syntax

$
0
0

@bermu wrote:

Hi all,
Could someone tell me how to make this python code shorter and more professionnal?
Thank you in advance…

import rhinoscriptsyntax as rs
import ghpythonlib.components as ghcomp

if brep == None and weightSetted == 0 :
metalWeight = 0

if weightSetted > 0 :
metalWeight = weightSetted

if brep != None:
metalWeight = ghcomp.Volume(brep)
volume = ghcomp.ListItem (metalWeight,[0],True)
metalWeight = (volume * density)/1000

metalWeight = weightSetted + metalWeight

print metalWeight

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5752

Trending Articles