Notifications
Clear all

[Closed] Multi-Mesher Object Generation

I have been teaching myself MAXScript over the past few days, but seem to be spinning my wheels on achieving the following, and would really value some assistance.

To automate tasks in converting architectural elements into Mesher objects via a rollout the following script needs to do the following.

  1. ID a master building element – called MS (named before running script)
  2. User selects “Highlight Source OBJ” button to read MS object data into rollout.
  3. User clicks a spinnner to set ‘Time Offset’ of last mesher element, eg. 8th mesher-to-be object from selected objects.

User then selects a group of objects in the viewport to become mesher objects.

This I have done, now here is what I cannot achieve…

  1. User clicks on “Convert to Mesher” button that works through an array of the objects and creates new mesher objects modelled on the source object MS. Each object has its ‘Time Offset’ assigned incrementally within the loop to a fraction of the spinner (8th object) divided by the $.count ‘number of objects’.

  2. Selected group of objects (non mesher) are then copied to a separate layer to remove these from the visible layer. (I have this scripted already).

rollout myRol “Mesher Tools” width:160 height:345

(
 label lab1 "Set up Mesher Series" --Label at top of rollout
 
 -- set up text areas to display MS obj details
 edittext edit_text_item "Selected:" text:"" width:100 align:#center
 
 label label_item "No Value" pos:[13,70]
 spinner spinner_item "Time Offset" pos:[13, 110]
 
 button myButton "Highlight Source OBJ" pos:[13,40] width:125 height:25
 on myButton pressed do (
 
 obj = getnodebyname "MS" -- select object with name "MS"
 if obj != undefined then select obj
 
 theValue = obj
 
 edit_text_item.text = theValue as string -- display MS
 label_item.text = theValue as string -- display MS
 
 ) 
 
 
 button myButton2 "Convert to Mesher" pos:[13,150] width:125 height:25
 on myButton2 pressed do (
 
 dataAr=#()
 for  i = 1 to dataAr.count do -- $.count returns number of selected objects
 (
 
 
 -- not sure how to do this
 --Mesher radius:67.5215 pos:[226.999,69.7593,0] isSelected:on renderTimeOnly:off???
 
 --$.pick = $MS
 
 --$[1] would be the first object in the selection
 --$[i] is first object in array loop
 
 -- make mesher [i].pos ????????
 )
 
 
 )
 )
 
 try (destroydialog myRol) catch()
 createdialog myRol
 ------

I have clicked around the ‘net for days to try to learn how to finish my task so any light that anyone can shine on this problem (please) would be really, really appreciated. 🙂