[Plugin] TIG-Cut_to_plane v1.1 20130107

[Plugin] TIG-Cut_to_plane v1.1 20130107

Postby TIG » Sun Oct 07, 2012 4:29 pm

TIG (c) 2013
###
TIG-Cut_to_plane.rb
###
Installation: Place this file in the Plugins folder and restart Sketchup.
Usage: Plugins menu > 'TIG-Cut_to_plane'
or with a suitable selection use the context-menu 'TIG-Cut_to_plane'
Note for Pro >=v.8 only...
Preselect a 'solid' object [group or component_instance].
Activate the tool.
Follow the prompts and pick 3 points to define a plane.
Picking these points CWS cuts to leave the part ABOVE the plane.
Picking these points CCWS cuts to leave the part BELOW the plane.
If you press <Enter> instead of picking point 3 then the plane is defined
'vertically', the direction of the 'line' between the first 2 points will
determine what will be left behind, i.e. the part to the 'LEFT' of the 'line'.
If the points 1 and 2 are vertically aligned then no vertical plane can be
defined, there is a warning message and you need to pick point 3, OR abort,
say by pressing <Spacebar>.
The selected object will then be cut to the defined plane.
The new cut group made from the 'cut' operation retains the original object's
locked/hidden-state, shadow-casting/receiving-behavior, name*, material, layer
and any attribute-dictionaries attached to it.
*If the original was a group the 'cut' group takes its name, if it was a
component-instance the 'cut' group takes its definition name, but if that
instance also had a name then this is appended to the new name inside [].
The 'cutting' is one step undo-able.
Donations: PayPal.com info @ revitrev.org
Version:
1.0 20121007 First issue.
1.1 20130107 Now at Point 3 an alternative <Enter> press cuts vertically,
keeping left-side parts. Context-menu if selection suitable.
9
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

Postby jorge2011 » Sun Oct 07, 2012 5:01 pm

tig excellent, very good tool.
a question.
you can think of a tool that splits into two parts to a group or component solid?
1

jorge2011 
 

Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

Postby TIG » Sun Oct 07, 2012 5:19 pm

jorge2011 wrote:tig excellent, very good tool.
a question.
you can think of a tool that splits into two parts to a group or component solid?
Another tool could first duplicate the selected object and run the 'subtract' cut twice the second time reversing the direction; thus the selected object would be split into two parts...
I'll think about it... :roll:
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

Postby jorge2011 » Sun Oct 07, 2012 5:37 pm

thank you very much.

one question. how the tool works in the code, creates another solid and subtract?
0

jorge2011 
 

Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

Postby TIG » Sun Oct 07, 2012 5:39 pm

This tool 'Cut_to_plane' now has a sibling - 'Split_to_plane' - available here - viewtopic.php?p=433732#p433732
It's very similar in operation BUT it leaves both 'split' parts [A and B] in place, rather than keeping just the one...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

Postby TIG » Sun Oct 07, 2012 5:46 pm

jorge2011 wrote:...one question. how the tool works in the code, creates another solid and subtract?
Yes you define the plane, a large new group containing a circular face is made centered on the first point you picked [its size based on that point and its distance from the selected object's bound center], the face's normal vector is set from the cross of the vectors to the other two points you picked. The face is then pushpulled into a large 3d solid and then that group is subtracted from the original selected object. The new group is given the properties of the original. In the 'split' version the selected object is duplicated in place and the pushpull reversed for the second 'cut' on the duplicate - leaving the original selected object appearing to have been split along the selected plane...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

Postby Dan Rathbun » Sun Oct 07, 2012 7:24 pm

Nice job!
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby erikB » Mon Oct 08, 2012 9:03 am

    thanks TIG, very handy!
    erikB
    0
    User avatar
    erikB 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby veerlexyz » Sun Oct 14, 2012 8:16 pm

    Thanks! Almost perfect...
    Can you make it work with a combination of groups or/and components instead of ONE solid group?
    0

    veerlexyz 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby smicha » Tue Oct 16, 2012 6:43 am

    You are the man, TIG. This is amazing as all of your works. I found a link to the video presentation to your plugins.


    http://www.youtube.com/watch?v=QFv4cnX4l3E

    It is on p. 20 of CatchUp Edition 15 - SketchUcation 2.0

    http://issuu.com/rclub24/docs/catchup_14
    0

    smicha 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby kingsi » Tue Oct 16, 2012 11:41 am

    Many Thanks TIG
    0
    Noobtastic
    User avatar
    kingsi 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby dermotcoll » Wed Oct 24, 2012 12:19 am

    Thanks TIG. Looks like a very useful tool for woodworking and machining worksurfaces with a CNC.
    0
    When you burn your arse - you gotta sit on the blisters!!
    User avatar
    dermotcoll 
    Premium Member
    Premium Member
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby penumbra » Sun Nov 11, 2012 4:02 am

    Many thanks TIG. Is there a way to make this work on a non solid group? Or nested groups? zorro does something like what i need but is view dependent, you have to view your group from an orthogonal view if you want a "straight" cut.
    0

    penumbra 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby TIG » Sun Nov 11, 2012 11:48 am

    No.
    This tool works on solids only.
    Zorro2 will work by slicing along a Section Plane.
    Place one where you want and use that Zorro2 option.
    I haven't tried nesting the plane inside the group/instance so that the cur only applies to the active entities - try it and report back...
    0
    TIG
    User avatar
    TIG 
    Global Moderator
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby penumbra » Mon Nov 12, 2012 6:38 pm

    @TIG

    Yes indeed, Zorro2 will cut through nested entities. There is a bit of clean up needed afterwards as some surfaces may need to be healed depending on how the section cut cuts through the objects.
    0

    penumbra 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby shri » Fri Nov 23, 2012 7:19 am

    great addition to the plugins list..thanks alot..can't wait playing with it
    :bounce: :bounce: :bounce:
    0

    shri 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby rv1974 » Mon Nov 26, 2012 2:19 pm

    Thank you TIG!
    I wish this tool could:
    1. work with non-solids (I won't miss section faces anyway)
    2. I guess the fourth click to manually choose the side to be cut off would be even more user-friendly. No pop-ups, just a hint in status bar.
    0

    rv1974 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby penumbra » Mon Nov 26, 2012 2:47 pm

    @ rv1974

    For your #1 above you could use section tool in combination with zorro2.
    0

    penumbra 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby rv1974 » Mon Nov 26, 2012 3:09 pm

    @penumbra
    Maybe the things got better, but Zorro was kinda minefield- too much crashes,- I stopped using it. And besides, 3 clicks to define the cutting plane is the nicest way to cut.
    0

    rv1974 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby bmike » Mon Nov 26, 2012 3:18 pm

    Wonderful TIG!!!!


    :ecstatic:
    0
    User avatar
    bmike 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby bmike » Mon Nov 26, 2012 3:25 pm

    how does one get this into the right click menu? would love to see it right under 'solid solver'...



    and, is there a way to customize my rubies so i can better order my right click menu?
    0
    User avatar
    bmike 
     

    Re: [Plugin] TIG-Cut_to_plane v1.0 20121007

    Postby TIG » Mon Nov 26, 2012 4:12 pm

    This is the code that adds 'SolidSolver' to the menu AND the context-menu.
    Code: Select all
    unless file_loaded?(__FILE__)
      cmd=UI::Command.new("SolidSolver"){self.solidsolver()}
      UI.menu("Tools").add_item(cmd)
      UI.add_context_menu_handler{|menu|
        if self.solidsolver_unsolid?()
          menu.add_item(cmd)
        end
      }   
    end
    file_loaded(__FILE__)
    The basis here is to make a command, and then add that to the the context-menu. Because this code is within the TIG module it says self.solidsolver(); however, TIG.solidsolver() would work otherwise... It also uses the built-in test self.solidsolver_unsolid?() [aka TIG.solidsolver_unsolid?()] which checks if the selected object is solid, otherwise there is no context-menu entry - try it with a selected line and the menu item is not added.
    To add any tool to the context-menu you simply make a command of it and add it, perhaps testing that some 'case' is met in a selection etc before adding the item.
    This example adds 'TIG-Cut_to_plane' to the context-menu... add this new code instead of the menu making code in ~line#259
    Code: Select all
    UI.menu("Plugins").add_item("TIG-Cut_to_plane"){Sketchup.active_model.select_tool(TIG::Cut_to_plane.new())}
    becomes
    Code: Select all
    cmd=UI::Command.new("TIG-Cut_to_plane"){Sketchup.active_model.select_tool(TIG::Cut_to_plane.new())}
    UI.menu("Plugins").add_item(cmd)
    UI.add_context_menu_handler{|menu|
        ss=Sketchup.active_model.selection[0]
        if ss and (ss.is_a?(Sketchup::Group) || ss.is_a?(Sketchup::ComponentInstance)) and ss.manifold?
          menu.add_item(cmd)
        end
      }   
    Change 'Plugins' to 'Tools' etc as desired...
    To do the same for its sibling tool 'TIG-Split_to_plane' add this new code instead of the menu making code in ~line#298
    Code: Select all
    UI.menu("Plugins").add_item("TIG-Split_to_plane"){Sketchup.active_model.select_tool(TIG::Split_to_plane.new())}
    becomes
    Code: Select all
    cmd=UI::Command.new("TIG-Split_to_plane"){Sketchup.active_model.select_tool(TIG::Split_to_plane.new())}
    UI.menu("Plugins").add_item(cmd)
    UI.add_context_menu_handler{|menu|
        ss=Sketchup.active_model.selection[0]
        if ss and (ss.is_a?(Sketchup::Group) || ss.is_a?(Sketchup::ComponentInstance)) and ss.manifold?
          menu.add_item(cmd)
        end
      }   
    To do it to other tools you need to read and understand how they run and how to make a command from their code...

    Be aware that adding too many 'commands' to SketchUp can cause the gray-out issue in the context-menu - this has bee 'fixed' by allowing you to have a lot more before it happens, but go bonkers adding them and items will spontaneously disable themselves and 'gray-out',
    0
    TIG
    User avatar
    TIG 
    Global Moderator
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby TIG » Mon Jan 07, 2013 5:50 pm

    Here's v1.1 viewtopic.php?p=433723#p433723
    Now at Point 3 an alternative <Enter> press cuts vertically, keeping left-side parts.
    Also Context-menu if selection suitable.
    0
    TIG
    User avatar
    TIG 
    Global Moderator
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby Ben Ritter » Mon Jan 07, 2013 8:14 pm

    Thank you TIG.
    0

    Ben Ritter 
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby rainboworiver » Tue Feb 04, 2014 9:45 pm

    does it work on sketch 2013 (freeware) ? only on pro?
    0

    rainboworiver 
    Premium Member
    Premium Member
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby Rich O Brien » Tue Feb 04, 2014 9:50 pm

    rainboworiver wrote:does it work on sketch 2013 (freeware) ? only on pro?


    Note for Pro >=v.8 only...
    0
    There's a frontroom and a backroom....reverse faces
    User avatar
    Rich O Brien 
    Administrator
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby designerbursa » Tue Mar 10, 2015 12:26 pm

    to select the portion to be cut
    0
    User avatar
    designerbursa 
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby TIG » Tue Mar 10, 2015 4:07 pm

    designerbursa wrote:to select the portion to be cut
    Was that a question ?
    The direction of the 3 points defining the plane determine what is kept.
    Try clockwise/counterclockwise and see the results...
    Please read the usage notes...
    1
    TIG
    User avatar
    TIG 
    Global Moderator
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby Alain » Thu Aug 16, 2018 2:38 pm

    Thank alot TIG, it's a fantastic Plugin! It fullfits my needs :-D
    1

    Alain 
     

    Re: [Plugin] TIG-Cut_to_plane v1.1 20130107

    Postby kumudugayashan » Mon Aug 20, 2018 9:12 am

    Awesome!
    0

    kumudugayashan 
     

    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago



    Ad Machine 
    Robot
     



     

    Return to Plugins

    Who is online

    Users browsing this forum: Bing [Bot], Kevin Cucumber and 11 guests

    Visit our sponsors: