How to Resize a Multitude of Similar Objects?
 1-20  21-35

Next
 From:  YHWH_777
5243.1 
I created an object and then used Array to duplicate the object 100s of times. I would now like to resize the individual objects themselves. Is there a script that will loop through all of the objects and resize them one at a time?

For example, say you create a cube that is 1x1x1 in size. Then you create an array that is 10x10x1 with a spacing of 1x1. You will now have 100 cubes in a 10x10 array. What if I wanted to change the size of the cubes from 1x1x1 to 1.5x1.5x1.5?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
5243.2 In reply to 5243.1 
You have something for rotate a multitude of Objects on their own point pivot ;)
Rotateobjects by Michael
http://moi3d.com/forum/messages.php?webtag=MOI&msg=4339.1
(scroll for the updated script)

No doubt that Michael can easily adapt it for Scale ;) (no need see follow! ;)

You have also ExplodeMove who can move objects inside the prog itself !

In fact you have ScaleArray ! ;)
http://kyticka.webzdarma.cz/3d/moi/#ScaleArray

I have made a little video (sorry in French but very visual :)
The point will be the pivot! So put it at the gavity center on your case!
Just take the same Scale Start and End ;)
http://piloumaison.weebly.com/le-scale-array.html

Don't think for the moment how put a point to each object of a selection multiple of objects ...
So you must remake your array of cube + point (or use the Array for the point if you have not move your cubes before ;)

The inside Command BoundingBoxCenter put a point inside a boxSelection but alas just one point of a general selection!

But Michael has made this ;) http://moi3d.com/forum/index.php?webtag=MOI&msg=3974.1

script: /* Place a point at each selected object's bounding center */ var objs = moi.geometryDatabase.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); var pt = obj.getBoundingBox().center; var ptfactory = moi.command.createFactory( 'point' ); ptfactory.setInput( 0, pt ); ptfactory.commit(); }

So select all your cubes, launch the script and you will have a point at each center of gravity ;)
And now you can launch the ScaleArray ;)

Curious the ScaleArray works not in this last case!!! Maybe because it's not a "copy" of Points?
So wait Michael for this new little obstacle! :)

EDITED: 6 Jul 2012 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.3 In reply to 5243.2 
Hi Pilou,

> Curious the ScaleArray works not in this last case!!! Maybe because it's not a "copy" of Points?
> So wait Michael for this new little obstacle! :)

ScaleArray expects for the point to be copied along with the objects so that their records in the geometry database are all clumped together - when you copy the points separately it does not know how to associate all the points with the objects. In order for ScaleArray to work you need to copy the point along with the objects at the same time the array is created.

See here for the instructions on how to use ScaleArray:
http://moi3d.com/forum/index.php?webtag=MOI&msg=275.109

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
5243.4 In reply to 5243.3 
So the ScaleArray can't work as "PostProduction" on the subject asked! :)
All must be thought from the start!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.5 In reply to 5243.1 
Hi YHWH_777,

> For example, say you create a cube that is 1x1x1 in size. Then you create an array that is
> 10x10x1 with a spacing of 1x1. You will now have 100 cubes in a 10x10 array. What if I
> wanted to change the size of the cubes from 1x1x1 to 1.5x1.5x1.5?

In the case you're describing here just selecting everything and running the Scale command and use a scale factor of 1.5 and the end result of that will have cubes of size 1.5x1.5x1.5 .

That will also increase the spacing between items to be 1.5 units as well.

There is not currently any automatic method that you would use for increasing the size of the cubes while also maintaining the same 1 unit separation between them. Just sizing each one "in place" would not work for that either - since the objects would increase in size the space between them would actually decrease. You would need to both size and move each item in order for the space between them to remain a constant distance.

I'd recommend just deleting all the cubes and making a new array if you needed that level of control over the sized result.

If you need to do this kind of thing a lot you might want to look into using a parametric CAD program for that part of the modeling rather than MoI - in a parametric CAD program you would probably be able to set up some system of spacing constraints that would allow for the kind of adjustments that you are talking about. Check out Alibre or Solidworks for that kind of stuff.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  YHWH_777
5243.6 In reply to 5243.5 
Michael:

Thanks for the reply.

I'm not concerned about keeping the spacing between the objects the same.

As you stated, scaling all of the objects together would increase the spacing between the objects as well. I don't want the scaling to increase. In other words, I don't want the objects to change their position in the x,y,z axis.

I only want to increase the size of the objects alone (which in turn would decrease the spacing between the objects).

Thanks.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.7 In reply to 5243.6 
Hi YHWH_777, the easiest way is to just delete all the objects except for the one in the corner and to scale that one, then make a new array.

Is there any reason that would not work for you?

In the future I want to have an "instancing" mechanism that would allow similar objects to be based off of a single base definition and then changing the base definition would update all the objects in place like you're describing. MoI does not yet have that mechanism though.

So probably the most simple method right now is to just remake the array.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  YHWH_777
5243.8 In reply to 5243.6 
Here is a visual example:

I would like to go from something like in the first attachment to something like in the second attachment.

The objects stay in their respective positions, but they change in scale.

Is there any way to do this? Is it possible to script the scale function to automatically loop through an array of objects?
Image Attachments:
Size: 32.1 KB, Downloaded: 18 times, Dimensions: 718x784px
Size: 33.5 KB, Downloaded: 14 times, Dimensions: 679x738px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.9 In reply to 5243.8 
Hi YHWH_777,

> Is there any way to do this?

The easiest way is to delete all the objects except the one in the lower-left corner, then remake the array using the same spacing you used for the first one.

That will produce the result you are looking for, you don't really need any fancy script for that, just making a new array will do it and the work involved is minimal.

There are ways you could script it - see Pilou's reply above for some links to some scripts like "ScaleArray" that do apply a scale factor to objects separately in a loop. It's focused on modifying the scale factor to produce a kind of tapered scale effect, not quite the same as what you look here but it has the basic template that you would follow if you wanted to make a new script.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  YHWH_777
5243.10 In reply to 5243.7 
<< Hi YHWH_777, the easiest way is to just delete all the objects except for the one in the corner and to scale that one, then make a new array.

Is there any reason that would not work for you?>>

Yes, that wouldn't really work very well for me.

First off, I have lots of objects. After they were arrayed, I offset them slightly from their position.

In addition, I have named the objects, styled/colored the objects, exported the objects from MoI (to OBJ/MTL), imported the objects into a renderer, setup the objects in the other renderer, and rendered the scene.

Starting from scratch would mean that I would have to redo all of those steps (which would take many, many hours).

I can make modifications to the scene and reimport everything as long as the linkages are the same (which is based off of the style names in the OBJ/MTL files). So I am trying to modify the scene slightly (by resizing the objects) and then reimport. Hence the question.

Is there any way to script this by selecting the objects and then having each object call the scale function?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.11 In reply to 5243.10 
Hi YHWH_777,

> Is there any way to script this by selecting the objects and
> then having each object call the scale function?

Yes, that's possible, see the ScaleArray script that Pilou mentioned above for a starting point.

It's also possible though by just using Scale and Move in combination with one another - apply the scale to all objects using a scale factor of 1.5 like I described above, and then to counter-act the spacing increasing you can select a row of objects and move them by 0.5 units over, add the next row and move by 0.5, etc... after doing that to all rows and columns you will have adjusted their spacing back to what you need, without recreating the whole array.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
5243.12 
So as soon as you make some copy of something just thing to put a point on the pivot
for future multiple scaling! :)
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.13 In reply to 5243.10 
Hi YHWH_777, here is a plug-in that will do what you are asking about.

Unzip it and copy it into the \commands sub-folder inside of MoI's main installation folder. That will then make a new command named ScaleIndividual. To trigger it set up a shortcut key with ScaleIndividual as the command name part of the shortcut.

When you run it, it will ask you for objects to scale, and then a scale factor and when you push Done it will scale each object by that scale factor using the center of the object's bounding box as the scale origin.

- Michael
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
5243.14 
Bravo!
Works like a charm!



PS What is the pivot Point ? the BoundingCenterBox of the individual object?

PSs A circular selection is inside the pipeline ?

EDITED: 12 Feb 2021 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.15 In reply to 5243.14 
Hi Pilou,

> PS What is the pivot Point ? the BoundingCenterBox of the individual object?

Yup!


> PSs A circular selection is inside the pipeline ?

It's on the wishlist - I'm not sure right now exactly when it will happen.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
5243.16 In reply to 5243.15 
Cool!

there is something who makes difference in the commands folder between native commands and commands added like IndividualMove?
For example i don't remember if ExplodeMove is now a native command ?

Because i make some texts in numerous forum and of course people ask me where they can find this or these commands :)

(of course I will put them on my site but from there... :)

EDITED: 6 Jul 2012 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.17 In reply to 5243.16 
Hi Pilou,

> there is something who makes difference in the commands folder between native
> commands and commands added like IndividualMove?

Often times plug-in commands are more narrowly focused on just one person's particular problem, the "native commands" tend to be more more refined for more general purpose use.

But they are all just script files, there is no special marker on them for Windows Explorer to display bundled commands separately from ones that you have installed. To find the list of what you have installed yourself you could install a fresh copy of MoI to a new directory and compare the commands folders.


> For example i don't remember if ExplodeMove is now a native command ?

ExplodeMove is part of the standard installation now.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  YHWH_777
5243.18 In reply to 5243.13 
Michael:

Thanks for the script. I took a look at the other scripts, but without a reference/manual or guidance, I was lost.

<< ... here is a plug-in that will do what you are asking about...>>

I tried to execute the script, but it doesn't seem to be functioning properly.

The upper right hand corner of the screen doesn't seem to be drawing properly. I can't enter the scaling factor.

See attachment...

FYI: I'm running Win7 64-bit.
Image Attachments:
Size: 14.7 KB, Downloaded: 32 times, Dimensions: 222x102px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  YHWH_777
5243.19 In reply to 5243.18 
Michael:

OK, I think I figured it out.

The script looks like it might be specific to the V3 Beta. I downloaded the V3 Beta and it seems to work properly.

Once again, thanks for all of your help.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5243.20 In reply to 5243.18 
Hi YHWH_777, looks like you might be using it with MoI v2? Try using it with the current v3 beta and it should work fine.

- Michael

EDIT: looks like you figured that out already.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-20  21-35