Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Import Models from Rhino

#1
Hi!

I am trying to import a large number of brick models from Rhino 3D into the RoboDK work station. I need each brick to have a unique name in RoboDK so that I can identify them for the attach/detach simulation events. Is it possible by using the RoboDK plugin for Rhino?

Or can you suggest other solutions?

Thank you!
#2
You should be able to rename items automatically using the API. For example, after you load one or more 3D models you can trigger a script that will take the last loaded 3D model and change the name iteratively.

The script could be something like this:

Code:
# RoboDK API开始
from robolink import *
RDK = Robolink()

# Retrieve all objects (3D models)
allparts = RDK.ItemList(ITEM_TYPE_OBJECT)

# Get the part with the non unique name
part = RDK.Item("Rhino Part", ITEM_TYPE_OBJECT)

# Keep a part ID for each object
part_id = len(allparts)

# Iterate while we find a valid part with a neutral name
while part.Valid():
part_id = part_id + 1

# Set the name of the object
part.setName("Part " + str(part_id))

# Get the new part
part = RDK.Item("Rhino Part", ITEM_TYPE_OBJECT)




Users browsing this thread:
1 Guest(s)