[Closed] Instancing/Re-Instancing of imported objects
I have started this topic: http://forums.cgsociety.org/showthread.php?t=308190
on the “autodesk 3ds max general forum”…
As I am often working with AutoCAD imported scenes I wanted to know if there is any way to re-instance identical imported objects. After diving into the Maxscript world for a while and watching Bobos DVD Maxscript for Masses I guess that an editable-poly created directly in max has some esoteric and well hidden characteristics including their history that the same looking but imported editable-poly does not have. The classical re-instancing tools dont work with imported objects: for example they dont respect the rotation of the identical objects to re-instance
Is it true (about the hidden history of the 3ds objects)? And if it is true is there any way to by-pass this history
Because if not I am afraid that there is a way to build a suitable script but including many many lines of code (too many for the beginner I am) for comparing objects sizes deducing any potential rotation etc
Oh Bobo please!!! You were on this forum today will you be here tomorrow?
Of course not only Bobo is allowed to give me some clues
Are you trying to do something like the following?
You have your objects(copy/intances) in the scene, youve made a change and want to delete the old ones, and reimport and position them the same?
Yup this is easy to do. What you will be doing is choosing one object in your scene to be the master object, selecting all of the objects that you want to turn into instances of the master object and running a maxscript to change them. Here’s the code – it assumes that the master object you want to use for the instance is called master_object
-- make an array from your selected objects
objarray = selection as array
-- loop through all of the objects, switching them to an instance of master_object
for i = 1 to objarray.count do
(
-- to change the object that everything becomes and instance of, edit the name master_object below
-- Don't forget to include the $ at the start - maxscript needs it!
objarray[i].baseobject = $master_object
)
Hope this helps
Gibbz
In fact it is much simplier…
I import my objects, I want to edit them as editable polys so I convert them to editable polys…
then I would like make instances from the “identical” objects like pillars for exemple before editing (in my case these “identical” objets are AutoCad blocks imported as separate entities)
joconnell
your script is equivalent to select the “master_object” then adding all the objects to instance to the selection and then executing:
$.baseobject = $[1].baseobject
This is working but without respecting objet orientation (for exemple all the objects are rotated not as they were before instancing but as the “master_object” is) and that is my problem…
Ah okay – i got this problem with the scale of objects not being passed on – if you select each of your objects before they get reinstanced, do they all have the same rotation in world space? for example is the world rotation of each object 0,0,0?
The only reliable thing to maybe do in that case is to get a script to select a polygon in each model and use its face normal to calculate the difference between one models orientation and the other. I’ll see if I can figure something out and get back to you.
I think that you point out the origin of my problem: the rotation of the objects in world space is what I thought being the history of the objects created directly in 3ds compared to those imported
I feel really stupid
All the imported objects have the same rotation in world space even if they were rotated in the exporting software
Knowing that I tried other methods of importing AutoCad drawings in 3ds and the strange thing is that when I import the drawing in legacy mode so the AutoCad blocks are imported as groups I can ungroup my groups or/and convert my objects to editable polys etc and even if the rotation of all my object in world space seems to be 0,0,0 , I am able to re-instance them
(The problem is that with legacy mode import I have to deal with tri-meshes so I would like to find another method
)
Perhaps the way 3ds detects a rotation between the objects to re-instance has something to do with the orientation of the bounding boxes
PS: Sorry if my explications arent clear but my English is really not one of my native languages
Okay so when you run the baseobject script, it changes the objects into instances correctly but changes the rotations of the objects to something wrong?
It’s something like that: it changes all the objects into instances in the exact “rotation state” of the “master_object”
have you checked if the object offset rotation is different for each object…
try $.objectOffsetRot on two objects and see if they’re different, if they are this is probably your solution