[AddOn] (wip) NP Cage Scale

Hi guys, i’ve made a small addon to help me up with my everyday tasks, and wanted to share it.

http://pasteall.org/pic/show.php?id=110742

Because i deal with architecture design and mostly cubic shapes, i thought it would be nice to have a more precise scale/strech tool, so i made an effort to make something like a cage-scale command. The basic blender scale function was a little bit too arbitrary for my needs, so this one uses a fixed point for scaling and a snap function for stretching. It works in object mode and is best with things such as boxes, beams, windows, table-tops and so on. My knowledge of python is very basic and the code is quite primitive, but it seems to work so far…

Just unzip the package, put NP_cage_scale.py to your addons_contrib folder and activate it in the UserPref.
Select one or more objects and spacetab-search for NP_cage_scale operator. In short - Select, run operator, pick mode and transform :slight_smile:
It uses some modal listeners, so it is a bit on the slow side… But so far this is the best i could do :slight_smile:

Don’t be confused when the mode cage appears all by itself, it is suppose to do that. Explore the mode options by snapping to the points of the cage. When in stretch mode, you can use snap. Addon also reacts well to orthographic views and interruption with ESC, RMB, ENTER and so on (many thanks to CoDEmanX and lukas_t).

Maybe it is best to consider this as an operator prototype, a command mockup :slight_smile: I need some help on improving it eventualy and i would like to hear what you think…

http://pasteall.org/pic/show.php?id=110743

Attachments

NP_cage_scale_016.py.zip (6.25 KB)NP_cage_scale_017.py.zip (6.82 KB)

Heh Nice! I just wrote on my todo list to find a way to enable this feature in Blender :smiley:
Great job and I agree this is just amazingly useful in arch work.

Thank you ejnaren, nice to see someone shares the affection for precision :slight_smile: Blender actualy has some pretty good snapping tools, it only seems they are not implemented to full potential.

You are wright about it’s use, this addon will probably get noticed by architects or similar engineering kind :slight_smile: Sculptors and animators don’t really have the need for such a tool. I have some more CAD style ideas, but we’ll see first how this catches on. If you have the time, you can try version 016 i just uploaded, and tell me what you think…

Anyway, the 016 version updates are:

– Simplified mode cage - no more middlepoints, usual scale function is activated by clicking anywhere outside the cage. This solves the problem of scale and stretch mode points standing too close to each other. It seems much better now.

– Abbility to work with objects with applied modifiers, the script now recognizes it’s own modifier and cleans it up.

– Saving and restoring pivot_point and transformation_orientation enabled.

– Listening operator added during mode selection, the addon can now be interrupted at any time.

Although i am a scripting beginner myself, i also wrote some overall coding explanations to the .py file, so people might find it useful for python training…

Happy blending

Thank you. I tried it with window generator addon and box object. I didn’t get the snapping right, seems like window has wrong bounding box or I dont know how to use it.
Video tutorial could be nice :slight_smile:

Attachments


@Okavango I have tested the script as you ask.
It works very well. Impressive. thank you. There has been no issues so far :slight_smile:
It is like many other great addons something one would wish was possible when using the normal scaling tool.
but it might serve as inspiration for a new mode of scaling in blender for the future.

Untill then: I do not think I could wish for a better implementation of this tool. It is really nice.
We must hope that operators like these can get a dedicated toolshelf in the coming UI discussions.

On second thought can I ask which other tools is on your todo list? Just out of curiosity.
I have my own list and while I am still very much a noob it is exciting to get some great tools for my arch workflow into blender.

Works well box types object. One proposal: continue working in the cage mode until user press enter or Esc. That way its much quicker to set all things and then return to normal mode.

@TynkaTopi:

I think i stumbled upon the same issue. Try it now and tell me if it is ok, it seems i fixed it…

Works well box types object. One proposal: continue working in the cage mode until user press enter or Esc. That way its much quicker to set all things and then return to normal mode.

I think i understand what you mean. But then the ability to interact with other objects during transformation would be lost. Wright? Or did i misunderstand you?

@ejnaren

Exactly what i am hoping for :slight_smile: People should realize the full potential of Blender as a CAD tool, with just a little adjustment… All the elements are already here, and the precision modelling userbase is immense… I don’t have to tell you how frustrated i was when i saw the power and the speed this app has, and the open road it doesn’t care for.
If all goes well, some new addons will be comming this way, without me anouncing them :slight_smile: Hope you don’t mind the suspense, i’ll try to be fast :wink:

017 updates:


– Added some on-screen instructions

– Fixed an issue with cage placement, Tynka, i hope it is that one :slight_smile:

Thank you guys, all feedback is welcome…

Yes OkavaTango, you fixed it. Now also windows snaps to correct places, bounding box is now correct :slight_smile:
I mean you usually want and need more than one side/corner to adjust, not only one, thats why staying in cage mode will be quicker way.
Now we need to press space bar 4 times when eg. window is snapped to correct size.

Edit: or user option to stay in cage mode… [x] Esc to leave

@TynkaTopi

I understand now. I am not sure how to accomplish that though, i will have to think it through… From this version on, i myself made this operator available trough a shortcut. Would that help? The finger rests upon the key and quickly clicks until the fitting is done. It is pretty fast and automatic…

Sure key shortcuts help a alot. One key press and cage is there.

@Okavango Nice too hear that! I will look forward to see what you have in mind.
I have some ideas that could use some of your approach as well. I will return with that :slight_smile:

And great with the key hints. What about showing those hints at the bottom bar though? Like when you use the knife tool.

This is seriously clever, and enormously useful. The hotkey option would make it simply essential. You have my 5* vote for what it’s worth.

@ danilius

Thank you, glad you liked it :slight_smile: The .py file i uploaded includes more detailed description of the operator and the instructions on how to assign the hotkey. You can open the .py file with Notepad++ in Windows or Kate in Linux.

@ TynkaTopi

I gave some thaught to the continous edit option you mentioned, and realised that in fact these commands usualy work that way. There is a problem of pure technical nature though - i don’t know how to accomplish that without going into concentric code loops, which would make the script heavy and slow. The listeners would humm in the background all the time and burden the computer resources. On the other hand, i know from experience that the need for continous edit appears in let’s say, 25% of the times… If i get some extra time however, i will try to make some versions with your suugestions included. If you agree with me, I think the script is in good shape for the first round, especialy if you assign some simple hotkey to it :slight_smile:

@ ejnaren

About the hints at the bottom bar, my feelings also, but i did’nt find a way to do that yet. My python is very basic, my 3dcursor is running around helping me add false snapping objects and what not :slight_smile: Also it seems the bar is occupied with operator values while in modal mode… Will see into that eventually. Thank you for your honnest feedback, i appreciate it :slight_smile: Did you see the new dimension script from cwolf3d?

I agree everything, you have made that great addon :slight_smile:
Well, it doesnt need to be continuous in that way…just back to object mode and immediately to cage mode again :slight_smile: Maybe thats possible without infinite loops.
But either way, with shortcut it is just fine and fast.

@Okavango: nice script, thank you :slight_smile:
I thought that 3D Cursor would handle this kind of tranformations.

And there is already one add-on Enhanced Cursor … that has ambitious to be the right one
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Enhanced_3D_Cursor

You can activate snapping with Ctrl and use 3Dcursor to snap to vertex, edge, surface and transform object from that point.
But since you can snap to a surface too, you are able to snap only on surfaces visible from view direction.
Also to stretch (or snap transformation) to other vertex, edge, face doesn’t seem to work in proper way for this build (if it ever snapped before).

I’m writing (about this addon) here because it seems to me more consistent to see your feature as a part of 3D cursor functions instead of separated tool.

Thanks for your response.

@vklidu
You are welcome, glad you liked it :slight_smile:

I was aware of the Enhanced Cursor addon, and i think i even took some coding tips from there :slight_smile: However, i have somewhat different view upon the 3d cursor matter. I think 3D cursor is in fact - and this is blasfemy to say here, i know - something user should never meet with. I know it is an original feature, but in my decade of dealing with computer graphics in architecture modelling and design i have never failed to complete my tasks without it. Not only that, the fastest and most intuitive 3D apps i know today, in terms of arch.visualizations finish my goals in quarter of time compared to blender, and without such a feature. Maybe this sounds harsh, but outputing up to 200 trial renders per design, i count my time in seconds, and the sooner 3Dcursor is replaced with more intuitive automated procedures, the sooner will blender take the place it deserves…

OK :slight_smile: you are right I was looking for this feature from my first day with blender … anyway after all these years (sometimes hard for me believe I still work with it) looks like I just accept the rule of this blender “game” … :slight_smile:

very cool job!

It works in blender 2.75a?