Browse the API index on GitHub, or open the searchable HTML reference locally. Use Classes to find a class such as ModraUp::Model, or Methods to find a method by name.
Pick a start point, move the pointer to preview the line, and click a second point to create an edge. The tool snaps to geometry and adds the edge to the current editing context. Each completed line is one undo step.
- Download the Two-Point Line extension and install the RBZ file using the Extension Manager.
- Open a model and choose Extensions → Two-Point Line.
- Click the start point, move the pointer, then click the end point. The tool is ready to draw another independent line. Press Esc after the first click to discard the preview.
- Choose Edit → Undo to remove the last line. Switch to the Select tool when you are finished.
The RBZ is a ZIP archive. Its root contains the same two Ruby files as the example source directory.
Plugins/
├── modraup_example_line.rb
└── modraup_example_line/
└── main.rb
- modraup_example_line.rb is the loader. It selects the API namespace and registers a
SketchupExtensionwith the name, version, and path to the implementation. - main.rb adds the menu command and implements the tool.
onMouseMoveuses anInputPointto track the cursor, anddrawrenders the preview. On the second click,onLButtonDowncallsactive_entities.add_lineinside an undoable operation.
To run from source, enter puts ModraUp.find_support_file('Plugins') in the ModraUp Ruby Console. Copy the loader and its matching folder directly into the printed directory, following the tree above. Restart ModraUp and use the same menu command.
Inside ModraUp, ModraUp and Sketchup refer to the same Ruby module. You can write plugins using either spelling, including for classes such as InputPoint. Try these in the ModraUp Ruby Console:
ModraUp.equal?(Sketchup) # => true
ModraUp::InputPoint.equal?(Sketchup::InputPoint) # => true
model = ModraUp.active_model # also available as Sketchup.active_modelThe example chooses the available name once in its loader:
API = defined?(::ModraUp) ? ::ModraUp : ::SketchupThe tool then uses API.active_model and API::InputPoint throughout. UI, Geom, and SketchupExtension keep their top-level names with either spelling.
A dot denotes a class or module method, as in ModraUp.active_model. A hash denotes an instance method, as in ModraUp::Model#active_entities. Plain numeric model coordinates are in inches. Use helpers such as 25.mm for other units. The structured API data is also available.