User avatar
By hyltom
#284599
This is what i have posted in Rhino's newsgroup. If some of you have any ideas, you are welcome to help me.

"Hi all,

First of all i would like to know if there is any macro related to the texture
mapping. Is it possible to script the texture mapping tool?

Basically, i would like to create a script that will automatically add a
planar projection to a previously selected object. This projection should
also have its size set to X=100,Y=100,Z=100 and finally the most important,
i want the projection mapping to be positioned such as it's parallel to the
camera.

Of course as i have no idea how to do all this, it will be great if someone
could help me ;-)

Best regards,
Hyltom
"
User avatar
By Thomas An.
#284606
I don't think there are any Rhino-script commands to access texture mapping. (at least I don't remember of any)
User avatar
By hyltom
#284607
Yes, it's also what i' m thinking.

The only command i found related to the planar mapping is "_ApplyPlanarMapping". But after having enter this command, there is a whole process to setup the mapping so i'm thinking that it should be possible in some way to do what i'm looking for.
User avatar
By Thomas An.
#284611
hmm, you are talking about Rhino commands (not Rhino-script native methods). Yes, it seems possible. You don't even need a Rhinoscript for this. It can be done with a macro.

Try this in a button:
Code: Select all
'_CPlane _View _applyplanarmapping 1 _changeplane -50,-50,0 50,50,0 _single 1 1
User avatar
By hyltom
#284612
You are a genius Thomas! What can i do to thank you? Thanks sound so inappropriate :oops: .

Do you know that with one small line you are saving me hours of works?

Macro, scripting...all looks the same to me, i' m so dumb :lol:
Can i ask you how do you know the sequence of the _ApplyPlanarMapping command. I mean i understand the macro, it's very clear now but before i can't figure how to control each parameter of the planar command.

Obviously, if i m not wrong, it's not possible to change the UVW rotation as their is no macro, am i correct?
User avatar
By Thomas An.
#284647
hyltom wrote: how do you know the sequence of the _ApplyPlanarMapping command.
Well, the macro will fail if you have not pre-selected some objects (that's because the sequence is a little different without pre-selection; there's an extra step in there).

When you make a macro like this, generally, you run the command once manually until it does exactly what you want and you write down the options you followed in each step. For example in this case the first thing the command asks you is channel number, so the first parameter in the macro is "1", then you have to select a custom plane (otherwise you are being constrained to the world plane) so the next parameter is "changeplane" ... and so on
Obviously, if i m not wrong, it's not possible to change the UVW rotation as their is no macro, am i correct?
You mean to rotate the planar mapping ? ...
There are two ways.
  1. you can add a parameter "3point" after the "changeplane" and then use three points to create a rotated plane --> '_CPlane _View _applyplanarmapping 1 _changeplane _3point 0,-70.711,0 70.711,0,0 0,70.711,0 _single 1 1 <-- ... but it is difficult to control the rotation like this.
  2. you can work around it by having a modified macro like this:
    --> '_CPlane _View _CPlane _rotate 0,0,0 0,0,1 30 _applyplanarmapping 1 _changeplane -50,-50,0 50,50,0 _single 1 1 <--
    In this case the last number after the "rotate" parameter is the rotation angle. This way you get a prededermined rotation each time you press the button.
You can also have the macro to pause so that you can enter a rotation angle like this:
Code: Select all
'_CPlane _View _CPlane _rotate 0,0,0 0,0,1 pause _applyplanarmapping 1 _changeplane -50,-50,0 50,50,0 _single 1 1
... but when it asks, then you **have** to type in an angle, otherwise, if you click for a point, the rest of the macro will not work.

Of course all this can be done a little more elegantly with a script ... but ...
User avatar
By hyltom
#284681
All these are fantastic Thomas...Thank you so much to have taken the time to help me.

The result is exactly what i was looking for. Now i wonder why i never haven't asked for that macro before. Two years of crap texturing in rhino and finally i get THE tool...thank you, thank you, thank you!
User avatar
By Thomas An.
#284684
hyltom wrote:The result is exactly what i was looking for.
Cool 8)
By ricardo
#305293
Has someone came up with a version of this for v5?

TIA

EDIT: Got it
Code: Select all
_cplane _view _enter ApplyPlanarMapping 1 _center 0 0.2 0.2
Will there be a Maxwell Render 6 ?

Let's be realistic. What's left of NL is only milk[…]