[Plugin] Click2flip v1.0 20110928
-
You might find it useful to set the back face color to something more easily discernible. I use a green I'd never use in the model as a color/texture.
-
@dave r said:
You might find it useful to set the back face color to something more easily discernible. I use a green I'd never use in the model as a color/texture.
Yes - that's a generally good idea but since sometimes you have materials on the back side you need to go monochrome and back too see whats going on.. anyway since this plugin already exist - adding a label option will add great usability if possible..
-
great and simple tool, would be super-fab if able to flip curved faces as well!
...i thought combining the 2 bits of code above might do the trick:
1, click2flip
2, flip selectionthe idea being that if i click on a curved face, i'm also selecting it and therefore running the 2nd script might reverse the whole curved face, say a cylinder. (ideally i thought it could be toggled by pressing an accelerator key) a fair bit beyond my christmas powers... surely possible though..?
class TIG;;Click2flip @@BEEP=false def initialize() @ip = nil @ip1 = nil end def activate() @ip = Sketchup;;InputPoint.new @ip1 = Sketchup;;InputPoint.new @msg="Click back of face to flip it..." self.reset() end def deactivate(view) view.invalidate end def onCancel(flag, view) view.invalidate Sketchup.send_action("selectSelectionTool;") return nil end def resume(view) Sketchup;;set_status_text(@msg, SB_PROMPT) end def reset() Sketchup;;set_status_text(@msg, SB_PROMPT) end def onMouseMove(flags, x, y, view) @ip.pick(view, x, y) if @ip != @ip1 view.invalidate if @ip.display? or @ip1.display? @ip1.copy!(@ip) view.tooltip = @ip1.tooltip end end def onLButtonDown(flags, x, y, view) if @ip1.valid? @pt=@ip1.position ph = view.pick_helper ph.do_pick(x,y) @face = ph.picked_face self.flipper() if @face end end def flipper() normal=@face.normal vector=@pt.vector_to(Sketchup.active_model.active_view.camera.eye) angle=normal.angle_between(vector) if angle > 90.degrees @face.reverse! UI.beep if @@BEEP end#if end end#class
def self.flipBacks() model=Sketchup.active_model eye=model.active_view.camera.eye faces=[] Sketchup.active_model.selection.each{|e|faces << e if e.class==Sketchup;;Face} return nil unless faces[0] model.start_operation("Flip Selected Back Faces...") faces.each{|face| normal=face.normal vector=face.bounds.center.vector_to(eye) angle=normal.angle_between(vector) face.reverse! if angle > 90.degrees } model.commit_operation end
EDIT: actually just noticed the second script only flips half a cylinder (the side to the screen), the back remains undone.
Advertisement