Always face center-line/ Magnetic tool
-
@flippie123 said:
Hi Jeff, I'm not trying to compete with Zaha. I have been using sketchup since the very beginning. In the beginning I started to do some simple architecture using sketchup but now years later I'm doing some pretty advanced architecture designs using sketchup where I'm trying to reach the limits of the program.
I'm very exited about sketchup2015 because the 64bit version makes much more possible.
Off course I can use Rhino to do some modelling. But at the end my clients want to see a Sketchup model because for them a sketchup model is easy to read.
my bad.. i suppose i read too literally when you posted her model saying 'i want to make this'
here are a couple example DC files showing attractor type stuff in sketchup.. maybe some ideas will spring from them:
-
here's possibly the most basic dynamic component ever made
it's a one liner:
just use the regular Move tool to move it around and make copies (though doesn't seem to work with copy/array)?.. it will always point at the origin.
(as is, you have to stay on the positive side of the red axis or it will point backwards) -
@jeff hammond said:
here's possibly the most basic dynamic component ever made
haha...yes it always point to the center line but it is not magnetic. I tried to use the sketchyphysics tool but it only works for Sketchup7. And it is not easy to use.
-
@flippie123 said:
haha...yes it always point to the center line but it is not magnetic.
hmm.. it was meant as proof of concept.. the origin in this case is "magnetic"..
copy a bunch of them around:
then select them all and move them at once:
with a less simple DC, you could make it the other way.. the objects stay put and you move the attractor around (though probably moving the the attractor via numerical input).
-
@flippie123 said:
I tried to use the sketchyphysics tool but it only works for Sketchup7. And it is not easy to use.
My model up there was done in 2015 32bit, the only version it doesn't work in at the moment is 2015 64bit. Make sure you are using the latest version.
Yes it can be difficult to use, it isn't the most easily understood plugin and the documentation is limited.
But mostly I don't think it would work for you as it doesn't really work for positioning stuff then placing it. It is more of an animation 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
Advertisement