Always face center-line/ Magnetic tool
-
@flippie123 said:
... but it only works for Sketchup7. And it is not easy to use.
That's wrong...
http://sketchucation.com/pluginstore?pln=SketchyPhysics -
.
here's a dynamic component which does the thing in the original post..
to use it:
โข double-click the outer component (main) to enter it.. (there are two more components inside: box & attractor)
โข Move the attractor component with the move tool
โข exit the main component then right-click on it --> Dynamic Components-> Redraw. -
@jeff
that's really good... -
-
.
1024 boxes, a 12-pack, and change the shape of the box component
-
-
@flippie123 said:
I just made this and gave it a twist.
yeah, it's something to do with replacing the box component with one on a different axis.. haven't quite figured out how to control it properly.. i made it this far:
-
sweet!
(i'm not sure how to use the code but the gif looks cool ) -
@jeff hammond said:
...i'm not sure how to use the code ...
just paste into 'Ruby Console' hit return, will run till end of session...
it's only active when inside the DC so you can do other modelling...I can put it in a rbz with the DC if you want...
john
-
@driven said:
@jeff hammond said:
...i'm not sure how to use the code ...
just paste into 'Ruby Console' hit return, will run till end of session...
it's only active when inside the DC so you can do other modelling...I can put it in a rbz with the DC if you want...
john
oh nice. i see now.
it works along with the dynamic component i posted.. i didn't realize things like that were possible.but yeah, that's a lot better than manually triggering the redraw
-
@jeff hammond said:
... i didn't realize things like that were possible.
nor did I...
I improved the script to only do one redraw after the move [was trigging twice]...
there are probably other ways to do this, but it seams to work...
john
-
updated working version...
class JcB_MoveToolObserver < Sketchup;;ToolsObserver def onToolStateChanged(tools, tool_name, tool_id, tool_state) attractor = Sketchup.active_model.selection[0].definition.name == 'attractor' moved = tool_state.to_s == '0' && tool_name.to_s == 'MoveTool' @count = 0 unless @count == 1 update = attractor && moved if update selection = Sketchup.active_model.selection[0].parent.instances[0] @count = @count + 1 puts(" first click of " + tool_name.to_s ) if @count == 1 if @count == 2 puts(" second click of " + tool_name.to_s ) $dc_observers.get_latest_class.redraw_with_undo(selection) @count = 0 end end end end Sketchup.active_model.tools.add_observer(JcB_MoveToolObserver.new) if not defined? JcB_MoveToolObserver
-
here's a fun bit of code...
now it does what the OP asked...
look below...
john
EDIT: changed back to original as my counter was failingBETTER CODE BELOW...
-
@unknownuser said:
the other thing I was wondering if arrow keys can be used to move the dc's 'attractor'
You need a Tool to get the key-presses, then read-update-write the position values depending on which key was pressed, then redraw the DC.
This file was made specifically for Jeff's DC Magnet Beer model.
-
cheers Jim,
that works and is much cleaner than i was attempting...what other thing can we do with ruby to manipulate DC's?
I'll see if I can turn this into a pick point version...
john
-
Hey, I want in on the fun too.
-
@sam yours looks cooler than my effort...
-
-
-
Next step is multi- attractors
Advertisement