Itoo Software Forum

Author Topic: Maxscript: Get existing instance positions  (Read 2771 times)

George

  • Full Member
  • ***
  • Posts: 122
Maxscript: Get existing instance positions
« on: October 01, 2012, 04:44:34 AM »
I can create new instances ($.trees.create()), I can delete them ($.trees.delete()), I can edit them ($.trees.edit()), I can get the count ($.trees.count()), but I can't get a list of pos, rot, scale for a given geomID. Could you add an accessor so I can iterate over them and check the ID, ie. $.trees[1], or is there already some way of doing this?

I'm making a script that converts (creates or appends) a selection of objects to FP, and I don't want to overwrite existing instance positions, nor do I wish to duplicate them, so I need to check what already exists and what doesn't.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 4388
    • iToo Software
Re: Maxscript: Get existing instance positions
« Reply #1 on: October 01, 2012, 09:44:15 AM »

You can use $.trees.getPosition 1. There are a set of functions to get each parameter. Please, use showinterfaces $ to see the updated list.

Anyway, there are some caveats to implement this functionality:

1) Forest modifies the order of the items (basically the instances are ordered by ID).
2) There is a bug in v.3.9.4 with the functions that return the items size. Anyway, i could send you a patched version.

Alternatively, you can create items using other objects as reference, using Tree Editor->Creation Tools. There is an option to keep the existing items (turn off "Delete existing items").

Carlos Quintero
iToo Software

George

  • Full Member
  • ***
  • Posts: 122
Re: Maxscript: Get existing instance positions
« Reply #2 on: October 01, 2012, 10:24:18 AM »
Oh great - I forgot about showinterfaces()!