I know how to relealize the effect like linetool ,which shows a dynamic line,
and I wanna know how to dynamically display complex 3D graphics with color ,instead of a dynamic line, like the effect of dragging skp file into Sketchup, the 3D graphics move as the mouse move.
You can check out the View#draw method.
You can call
Sketchup::Model.place_component if you are actually placing a component instance. (If you do this from within a custom tool, the native Move Tool will be activated for the placing, and your tool will no longer be active.)
Here is a code example that “mimics” the Move Tool using
I also posted another example of a Drag Tool that uses a transformation to move an instance instead. (This can be used within a custom tool.)
The whole of this topic thread has interesting information (for context.)
well ,i did not make it clear , i mean that create a tool ,in which the interface Tool::draw(view) can draw a 3D graphic，for example，a cupboard composed of faces and rendered in some color by
the API of class view from Tool::draw(view). I don’t want to load a skp file to get a created model to load.
First of all … the abstract
Tool class draw methods do not create model geometry. They draw in virtual view space. This is usually meant to show the user what geometry can be created. (ie, the rubber banding between the 1st point clicked and the mouse cursor for a linetool.)
When the user indicates to the tool that they like what was virtually drawn, then your tool’s code stops drawing to the view, and then use the
Sketchup::Entities class factory methods to actually add geometric faces and edges.
There is no easy quick answer for complex coding tasks. You are just going to have to try to write code that does these complex tasks.
When you encounter specific coding problems, come back and post a code snippet and explain the specific problem you are having.
We are not going to write a library or a tool extension for you.
The best thing you can do is read the examples …
… and study the various extensions by the SketchUp Team …