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

Rhino Python: "Custom stonemap tool", measure block instances (gemstones)

$
0
0

@Maxx wrote:

Hello everyone,

I am writing a custom python script to write up a stone map for me.
Currently I iterate over all the block instances in the scene and assign them bounding boxes.
The only problem is the orientation of the gym interferes with the bounding box measurements. If the gem is rotated 90+ degress it will measure its depth as width. I have been looking for a way to measure the gems. Any help would be much appreciated.
Here is a sample of the code:

def measureGems(gems):
gemDict = {}
for gem in range(0, len(gems)):
box = rs.BoundingBox(gems[gem])
if box:
for i in range(0,len(box)):
width = round(rs.Distance(box[0], box[1]),1)
length = round(rs.Distance(box[0], box[3]),1)
height = round(rs.Distance(box[0], box[4]),1)
gemDict[ gems[gem] ] = (length, width)
return gemDict

Posts: 6

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles