Script: Sculpt Trim Curves Utility

Hey guys!
Today I am going to announce a new script I have been working on, this python script is the sculpt trim curves utility and works like the clip curves brush in z-brush.
Now this is a public beta, so there is some bugs, in fact I have little time to work on it so for any devs out there I have made sure this is well commented and even included a short header doc pointing to the main bug ;)

So enjoy the script and here is a video showing how it works:

Originally I was going to make this a premium script or something, but instead I decided to only charge the price of a tweet/facebook share (Free).
Now that is much more awesome isn’t it

Tagged , , , , , . Bookmark the permalink.
  • Piotr Adamowicz

    Your script looks neat. Are you using booleans to do the trimming?

    • alextelford

      Yep that is booleans, I have contemplated adding in a shrinkwrap option for non-destructive topology, but perhaps for a later day.

      • Piotr Adamowicz

        There’s no license in the file. I’d like to use some of your code in my sculpt tools script (gpl) that also deals with booleans for dyntopo sculpting, etc, but I can’t do that as long as the license is unclear. Would you mind adding one?

        • alextelford

          Updated with a standard gpl license, I forgot about that, feel free to use how you see fit.
          -Alex

          • Piotr Adamowicz

            Thank you kindly! :-)

  • http://www.facebook.com/ekswathi Swathi Kumar

    i didnot get the procidure. can u explain (i already shared it in my facebook then what?

    • alextelford

      When you share you get re-directed to a python script which you need to save as a python file, and you can then install that addon into blender.

      • alextelford

        Ok I updated it to download a zip that contains instructions

  • alextelford

    Now available for download from CG Cookie Script Bakery:
    https://github.com/CGCookie/script-bakery/blob/master/scripts/addons/sculpttrimCurve.py
    -Alex

  • Spirou4D

    “Traceback (most recent call last):
    File “C:Program FilesBlender FoundationBlender2.65scriptsaddons_externsculpttrimCurve.py”, line 313, in execute
    distVecCam = world2local(Ci,Co,-extrusionDepth)
    File “C:Program FilesBlender FoundationBlender2.65scriptsaddons_externsculpttrimCurve.py”, line 460, in world2local
    thetaA = atan( (a.z-b.z)/( sqrt( pow(a.x-b.x,2) + pow(a.y-b.y,2) ) ) )
    ZeroDivisionError: float division by zero

    With this Add-on release 0.7: error on Blender 2.66 win32 vista!

    • alextelford

      Ah darn I forgot about that, it won’t work on cursor mode if the cursor is at the center, which it shouldn’t be anyways. I’m a little busy to edit the script, to fix you need to add + 0.0001 to the lower part of the divide function so it should not equal 0

      • Marc Stewart

        Let me introduce you to my Rule 1 of Programming with Trigonometry: Never use atan. Use atan2 instead.

        atan (y/x) is doomed to the division-by-zero error, but atan2 (y, x) will return the correct result.

        This is much better than a hack which might seem to fix the problem but actually just moves it. Whereas before divide by zero occured when x1 – x2 = 0, your suggestion only moves it to instances of x1 – x2 = -0.0001.

        I hope this helps your super-useful script.

        • Marc Stewart

          The other great thing about atan2 is that it is quadrant-aware, in that it can tell the difference between (y, x) and (-y, -x), which atan (y/x) is incapable of doing, and return the appropriate angle.

          Having glanced at your source and seen the bug note discussing directionality from the camera for the extrusion, and noticed that world2local is called with values calculated around line 290, I thought I should mention it is at it _may_ just help out in that regard too.

          • http://www.facebook.com/kvothe.traspie Kvothe Traspie

            Im not a coder so I did quite got what you wrote, so could you tells us what to change and in which lines from the .py so we can fix the addon and use it on 2.66? i mean what do we need to write to avoid the division by zero (I’m not looking for explanation) just a: write this line of code or delete this line of code type of thing.
            This addon could be one of the best things in blender if it fine tuned, so thanks for starting the work, and thanks to any other programmer that can help fix any issues that arise.

          • http://www.facebook.com/kvothe.traspie Kvothe Traspie

            message repeated because I tried to fix a typo: change (did to didn’t) then i tried to fix a problem with the spacing of the paragraphs, and to do both discuss or this page gave me hell, I’m not trying to spam or anything.

          • Guest

            Im not a coder so I didn’t quite got what you wrote, so could you tells us
            what to change and in which lines from the .py so we can fix the addon
            and use it on 2.66? i mean what do we need to write to avoid the
            division by zero (I’m not looking for explanation) just a: write this
            line of code or delete this line of code type of thing.
            This addon
            could be one of the best things in blender if it fine tuned, so thanks
            for starting the work, and thanks to any other programmer that can help
            fix any issues that arise.

          • Marc Stewart

            Even if that one change alone fixed everything (it won’t), I would never encourage anyone to change a script without understanding for themselves what the code will do. That kind of thing is a potential recipe for disaster (search for rm rf).
            Adding to the difficulties, Alex has not written particularly maintainable code. Trying to figure out what it’s trying to achieve and why, then giving it some structure such that tracking down the problems isn’t like looking for a needle in a haystack, is a time-consuming process.
            I am working on it though. A few mistakes have been corrected, and things are shaping up. With luck it’ll be ready for a pull request quite soon; then, if my changes are accepted, you’ll be able to download the update from the github address Alex has already given.

  • Spirou4D

    This add-on don’t run with Blender 2.66! A correction is needed, please.

  • Javier

    Hi, I’m having a problem with your utility “Curve Trim”; It drops me this error:

    “Traceback (most recent call last): File “C:UsersW7AAppDataRoamingBlender FoundationBlender2.68scriptsaddonssculpttrimCurve.py”, line 313, in execute distVecCam = world2local(Ci,Co,-extrusionDepth) File “C:UsersW7AAppDataRoamingBlender FoundationBlender2.68scriptsaddonssculpttrimCurve.py”, line 461, in world2local thetaB = atan( (a.y-b.y)/(a.x-b.x) ) ZeroDivisionError: float division by zero location: :-1 ”

    I’m using the version 2.68 as you can see. Does it has something to do?

  • DJ ThunderElbows

    I tweeted but the window closed and I got no download.

  • Jim Esposito

    Thanks so much for this!

  • VarikRus

    “dropbox file is not found” please help

  • Sing Song

    File not found !