ScriptSpot

Script

Primitive Maker

By Garp · 2010-12-30

Version
1.1
Version requirement
max 9 and above
Date updated
2011-01-01
Votes
76
Description

Creates a new Primitive from a template object.

Additional Info

This script creates a simpleObject plugin and registers the new primitive. Works with both geometry and shape objects. In the case of shapes, the primitive is of geometry type, based on the renderable version of the template shape as defined by the settings in the Rendering rollout, even if the Enable options are off.

The script supports smoothing groups, material IDs and mapping coordinates for all map channels (except -1 and -2, respectively alpha and illum).

The only parameter for the new primitive is Size. Its value corresponds to whichever dimension of the object's bounding box is the largest.

The Original Size button resets the size to that of the original object.

The Show Location button displays the path and name of the plugin's file.

The Sub-Folder from Category option creates a new folder in the current location - if it doesn't already exist - based on the primitive's category.

The Discard Mapping Coords option ensures that no mapping coordinates are passed from the template.

The name of the plugin file is of the form name_category.ms as entered in the dialog. Edit it at your own risks!

To make the primitive permanent, choose as location one of max's startup folders, like \$max\plugins (the default).

You can easily edit the various default values (default folder, legal characters for Name and Category  and option states) in the script's file. These are set at the top of the code for easy access.

Each new primitive class is scriptable. Just replace any eventual space in its name by an underscore. If the size property is not specified, the size of the original template object is used.

In the same fashion, there is also a Helper Maker.

 

v. 1.1: fixed a few loose ends.

v. 1.2: fixed a major bug that prevented cloning correctly (thanks to gramx for finding it).

Attachments

Tags: primitive, parametric, simpleObject, plugin

Comments (45)

Primitive Maker HELP

kamran wasti · 2015-02-08

HELLO SIR.
I USE Primitive Maker.
SIR I WANT TO CREATE OBJECT WITH FULL BMP , JPG MATERIALS.

WHEN I USE OBJECT IT SHOULD SAME MATERIALS ...
PLEASE HELP ME...
REPLY SOON..

can't download file

ruthGarry · 2014-10-20

I'm having trouble downloading the file. I've check and can download other files from this site and others. When I click on the file i get taken to the script page. Please help, ruthannegarry@gmail.com

luxxeon · 2014-10-20

Right-click on the link, then pick "save link as". Save it to a location on your hard drive.

maxscript rollout handler exception 3ds max error

aarifmalik · 2014-05-26

sir plz help me how to fix this error maxscript rollout handler exception 3ds max as i dwnlded the primitive script n when i try to make a compnent with it bt it showed me this error plz tell me how to fix it i am using 3ds max 2012

some new features?

tomastnt · 2013-11-05

Hi Garp.
Thanks for the script. I am using it often time for adding few types of kitchen cabinets which we are using for kitchen design. What would be cool is getting better the process of adding new objects in to the 3ds max. What is annoying is that the script doesn't know the last path for saving new objects and also, the name for new script could be taken from the name of the object. Whole process could be simplified only for picking new objects and only for first object the user would have to select the folder to for saving them. Now is really time consuming every time select the folder to save new objects and write the name of the objects. Especially if you install a new system.
Would be cool if you would add these new features.
Thanks Tomas.

I have a quick question

joneto · 2013-10-30

Is there a limit to the amount of primitives to create? It works great, but I can only create 20. Is there anyway to customize the window preference in Max to display as many as 40 buttons?
Thanks.

lantlant · 2013-08-06

I'm more interested in how it was converted into a goal
script, scriptwriter script. Is there any function or scripted?
(In the script "cleanString" is very good ..)

---------------------------------------------------------------
case click of
(
2: size = 2 * length gridDist
)
)
)

-->

format "\t\tcase click of\n" to:thePluginFile
format "\t\t(\n" to:thePluginFile
format "\t\t\t2: size = 2 * length gridDist\n" to:thePluginFile
format "\t\t)\n" to:thePluginFile
format "\t)\n" to:thePluginFile
format ")\n" to:thePluginFile

--------------------------------------------------------------
thx

OrganMasher · 2013-07-30

Hello, thanks for the great script. Very handy indeed.
The only problem I had with it was that when I had finished and
closed the script, then re-opened it to add further prims it created
a new folder with a new Geometry dropdown entry that I cant seem to
find a way to revert.I deleted the new folder entry inside of max's
root directory, but for some reason it's still available inside of max. Is there a way around this. Thanks

I got runtime error, Filestream cannot create the plugin

lucky7456969 · 2013-06-09

I picked the object I loaded in, then pressed create, then a runtime error popped up saying that "FileStream cannot create 'my plugin.ms'"

Also, How can I create a shortcut on the toolbar, I dragged the .ms file into max, ran the script, then went to customize, created a new tool bar, but could not found the item under main ui group and all command category. Although I can make it permanent, problem is the dialog pops up right away when max starts up, it is blocking my sight :(

Thirdly, How can I pick a group of primitives? It seems when I picked a grouped object, one of the "planes" or "boxes" was selected.

Much appreciated about your effort!
Thanks
Jack

error

appius · 2012-12-07

"argument count error: classOf wanted 1, got 3"
wtf?

name problem

appius · 2013-01-07

I found the error comes from the object name.
it seems I get this error when I write a name starting with a number. names has to start with a letter...

Thanks

leonwgc · 2012-10-24

Really nice script very functional, thank you very much

yener · 2012-10-18

thanks, its perfect, very nice working with 2013 -64.. can i -- noMapCoordsChecked = true ?

question

roosterMAP · 2012-10-17

I have a bunch of new primitives and I would like to transfer them to a new computer. The problem is that max doesn't seem to register primitives created in another computer. (the primitive create button doesn't show up)

help me!

Help

gomitas · 2012-07-21

Hi, i'm new in 3d max, and i found this grate page, but i need to install this script but i don't now by the moment how to do this, smebody can help me? sorry for my bad english, my e-mail gerardofs2000@yahoo.com.mx

Thanks

asymptote · 2012-06-27

Fantastic script, great tools for scene making, one problem I have is each time I make a primitive, I have to manually navigate to the output folder to save it.
Can this be made to remember the last used folder easily ?
I don't know maxscript btw.
I'd love to see this developed to automatically support UV's and textures. it would be great for game level design.

Yeah

kimarotta · 2012-05-25

Very good script

Thanks man.

Good script!

Yusuf_ES · 2012-05-25

Hi garp
Very good script. Thanks.

Script cover primitive object vertex deformation and local animation, maybe very very helpful :)

Yuji and ginger3D

Garp · 2012-04-29

@Yuji:
A face cannot not have a material ID. Also, things like material IDs and smoothing groups are not particularly relevant to this script, they are rather part of the general modeling process.
Just set the IDs as you need them on your template object before using it to generate the primitive plugin.

@ginger3D:
If you've set the primitive plugin(s) in one of the startup folders (so they show up automatically as primitives), it adds to max's loading time. If you have lots of them and/or high polycounts, it can take some siginificant time to load.
Typically, you'd use this script to generate simple geometry. As the complete mesh definition is included within the plugin's code, a high resolution model can make quite a large file.

Discard Material ID's?

Yuji · 2012-04-29

Very nice script! Just wondering is there any way you can add a discard Material ID checkbox? Thanks for contributing!!

Question about your amazing script! Im 2011 user 64 bits version

ginger3d · 2012-02-29

Hi!
I love your MaxScript!
Thanks for sharing something so useful like this!
I have a question, i created one object, and now when i open my max, it takes more time that common (long time).
Its that right?

3dsMax 2012 x64 - Works Fine!

S-ed · 2011-12-19

Actually, i've been frustrated when have read about problems in 2012. But it works! =)

fajar · 2011-12-15

There will be good idea if someone can make website that contain geometry script that maded by this script

NikkoN · 2011-12-14

Thanks for the script! A very good thing

thx

lantlant · 2011-12-13

Perfect script! :)

kyle108 · 2011-07-06

i am curious to know if there's a way to modify this script so it allows you to place custom primitive buttons in a custom toolbar as opposed to the create geometry tab. unfortunately i dont know enough about maxscript to do it myself. any help would be greatly appreciated! :)

jpscouting · 2011-05-03

Oh man this was so useful. But it doesn't work in 2012, I'm so bummed. um...pls fix, pretty please.

Marius Silaghi · 2011-04-14

in 3ds max 2012 the script/plugin has been created the filein function gives me an error saying that it cannot open the file

Great :(

Garp · 2011-04-15

Looks like they're breaking the backward compatibility.
There's nothing I can do about it.

I would like to hire you!

fraggle · 2011-04-05

Incredble, I was looking for something like this to build my own library since 5 years now.
I would like to hire you to customized your script for my own use bu I have no idea how to contact you!

In case I do have the right, here is my contact : lololamoto1@yahoo.fr.

Thanks to keep in toutch.

z0mbie · 2011-03-09

cool

Howdy!

Garp · 2011-01-24

Hi Michele!
Thanks. I'm glad you like it.

Michele71 · 2011-01-23

Nice Plug!! :) One point to you Garp :) :)

It si possible but...

Garp · 2011-01-22

... not a good idea.
If you save a scene with a custom primitive in it and in the meantime the corresponding material - or one of its maps - is moved, this might cause problems when trying to reopen the scene.
Also these tools are meant to be as generic as possible.

My advice would be to store your materials in a library and have a small script do the work of applying them. Something like:

for obj in objects do  -- or the next line
--for obj in selection do
    if obj.material == undefined do
        obj.material = case classOf obj
        (
            plate: plateMtl
            bowl: bowlMtl
            ashtray: ashtrayMtl
            bottle: bottleMtl
        )

where the various materials can be in the material editor, in a material library or already defined in the scene.

Note that the mapping applied to the template is passed to the primitive objects.

omid3098 · 2011-01-22

you're right, I will save my material library in the same path as primitiv scripts. thank you very much :)

Save materials and textures with primitive?

omid3098 · 2011-01-22

Hi.
thank you very much for this great script.
I want to know is there any way to save materials and textures with each primitive?
I know that normal primitives do not have textures or materials. but if there is any possibility to save them with our primitives would be great.
if this is not possible can you suggest a way to make it easier to access materials and textures? should we just put them into material library?

Garp · 2011-01-03

Set the viewport background to the same color than the background here.
Then capture. Then in photoshop import > video frames to layers, edit and save for web and devices as gif.

gramx · 2011-01-03

Great tool Garp! Thanks

Just one question how did you create the animated demo image? Its very cool!

g

Garp · 2011-01-02

You're welcome :)

Garp · 2011-01-02

Download and save the PrimitiveMaker.ms file somewhere on your hard drive.
From max, go to the maxscript menu, choose 'run' and browse to where you stored the script.
When it's running, enter a name and category for the new primitive, pick an object you've already modeled (and eventually mapped) and hit the 'make primitive plugin' button. Then choose a folder for the plugin's file.
If everything goes well, you can see the new category in the drop-down list of the command panel (when set to 'geometry'). Choose it and you now have a button for the new primitive.

Thanks!

dan_cole · 2011-01-02

Thanks for the fast reply Garp,

At first I was getting a run time error but worked out it was because my plugin folder on C: wasn't writeable too, because I don't often remember to run Max as an Admin.

Made a new folder else where and it all works great. This is really good, thanks so much for sharing. Telling all my classmates about this when I get off term break.

Thanks again!

Max Script

dan_cole · 2011-01-02

Hey,

I came across this by total accident while Googling, what a great piece of code.

Unfortunately I am a complete and utter beginer when it comes to maxscript, other than press F11 within Max I can't do anything.

Can some one please kindly take me through the steps to create this plugin with the ms file please?

Hope you all had a good new year and thanks in advance

Dan

Joe007 · 2011-01-01

Very handy Garp. Thanks!!

Garp · 2011-01-01

Hey, I'd recognize that boxy car anywhere!
Glad you like it, Joey. Nice to see you here ;)