Creating multiple objects of different (Specified) sizes and offsetting by 30mm
Hi guys,
I'm a beginner to all this scripting so please don't be annoyed if this is an easy question to answer.
I'm currently writing/piecing together a script (the best I can) for an easier workflow at my work regarding the creation of a unit that can have multiple arrangements.
I'll give you an example of what i would like to do...
I want to be able to have multiple selections within the Rollout to create a fully built unit. Each object needs to be offset by 30mm when finally created. I'm having a hard time trying to envisage how I would write it out when say, "I have an object 48mm wide and then I need the next object created to be offset from the edge of the 48mm object by 30mm, then so on and so on for all other created objects.
I know it's very brief and I can elaborate more if needed. What I currently have within the script is so basic its laughable. I've managed to map 3 buttons to 3 different objects so far, 2 of these buttons create a box of a specific size and adds a uvw map with box mapping attached. The other button is a button to merge a specific max file within my scene... (These are only test objects for the script might I add)
Obviously I'm not expecting someone to come and write my script and I'm sorry if it comes across that way, seen as the script I have at the moment is so simple compared to what I'm wanting to achieve. Just looking for some helpful nudges in the right direction and such.
Many thanks,
Jon.
Here is my current script if you want to laugh at it :)....
Obviously the attached bitmaps and .max file wont work within your scene but hopefully you'll get the jist.
rollout NebrakTemplateTool "Nebrak Template Tool" ( button Merchant6 "Merchant6" button BevMax "BevMax" button Venta "Venta" on Merchant6 pressed do ( Box name:"Merchant6" length:800 width:1080 height:1830 select $Merchant6 macros.run "Modifiers" "Uvwmap" $.modifiers[#UVW_Map].maptype = 4 meditMaterials[1] = VRayMtl () meditMaterials[1].texmap_diffuse = Bitmaptexture fileName:"I:\NEBRAK\Vending\Vending Machine Images\Crane\merchant6.jpg" meditMaterials[1].texmap_diffuse.alphaSource = 2 $.material = meditMaterials[1] ) on BevMax pressed do ( Box name:"BevMax" length:800 width:1181 height:1830 select $BevMax macros.run "Modifiers" "Uvwmap" $.modifiers[#UVW_Map].maptype = 4 meditMaterials[1] = VRayMtl () meditMaterials[1].texmap_diffuse = Bitmaptexture fileName:"I:\NEBRAK\Vending\Vending Machine Images\Autobar Branded\BevMax 4_Black_Plain.jpg" meditMaterials[1].texmap_diffuse.alphaSource = 2 $.material = meditMaterials[1] ) on Venta pressed do ( mergeMAXFile "I:\NEBRAK\MODELS\Max_Models\Jonnie Models\Panini_Machine.max" ) ) createdialog NebrakTemplateTool
Comments
...
First we need to simplyfy code a bit
U be able to use this only if your filenames exist eider you will recive error
So this is the code
Now what I suggest before continue with offset method:
Create "Browse" button to be able to pick different files for maps and file for merging. See this topic from mxs help document
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil...
I will use in this case also:
- one button for box creation
- tree spinners for length, width and height of box
- one edittext control (ei.textbox) for naming
bga
Many thanks barigazy, I had a
Many thanks barigazy,
I had a try with your updated script and it work well to a point, It seems that if I wanted to create more than 1 of the same object it would pass the uvw modifier to the first object created and not onto the new object.
Many thanks,
Jon