# Combine multiple operation into one

**URL:** <https://forums.sketchup.com/t/combine-multiple-operation-into-one/224287>\
**Category:** Ruby API\
**Created:** [March 21, 2023, 12:17pm UTC](https://forums.sketchup.com/t/combine-multiple-operation-into-one/224287 "2023-03-21T12:17:21Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![dezmo](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/dezmo/32/51058_2.png) [@dezmo](https://forums.sketchup.com/u/dezmo)\
**Post date:** [March 22, 2023, 7:15am UTC](https://forums.sketchup.com/t/combine-multiple-operation-into-one/224287/10 "2023-03-22T07:15:35Z")

</div>

Perhaps you can follow this logic:

```ruby
module Dezmo
module DezmoTest

class DezmoTestTool

  def initialize
    @in_transform = false
    @myselection = nil
  end
  
  def onCancel(reason, view)
    view.model.abort_operation if @in_transform
    @in_transform = false
  end
  
  def onLButtonDown( flags, x, y, view )
    if @in_transform
      commit_transform(view)
    else
      if @myselection
        start_transform( view, "My Rotation" )
      else
        # code for select the entities to rotate
        # and set @myselection
      end
    end
  end
  
  def onMouseMove(flags, x, y, view)
    if @in_transform && @myselection
      # code for trasnform (rotate) the entities (@myselection)
    else
      # code for select the entities to rotate
      # and set @myselection
    end
  end

  def start_transform( view, undo_text )
    @in_transform = true
    #view.model.start_operation(undo_text, true)
    # edited:
    view.model.start_operation(undo_text)
  end
  
  def commit_transform( view )
    @in_transform = false
    view.model.commit_operation
  end

end #tool

end #extension
end #namespace

```

---

_[View the full topic](https://forums.sketchup.com/t/combine-multiple-operation-into-one/224287)._
