# Copyright 2005, @Last Software, Inc. # This software is provided as an example of using the Ruby interface # to SketchUp. # Permission to use, copy, modify, and distribute this software for # any purpose and without fee is hereby granted, provided that the above # copyright notice appear in all copies. # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #----------------------------------------------------------------------------- require 'sketchup.rb' #----------------------------------------------------------------------------- # Needs clearer documentation. This method parses a string, which is in the form # of a length and then returns a Length object with the value (in current units). def positionConstructionPointTest point = Geom::Point3d.new(100,200,300) model = Sketchup.active_model entities = model.active_entities entities.add_cpoint point cpoint = entities[0] position = cpoint.position if (position) UI.messagebox position else UI.messagebox "Failure" end end if( not file_loaded?("constructionpointtests.rb") ) # This will add a separator to the menu, but only once add_separator_to_menu("Plugins") plugins_menu = UI.menu("Plugins") ConstructionPointTest_menu = plugins_menu.add_submenu("ConstructionPoint Tests") ConstructionPointTest_menu.add_item("ConstructionPoint.position") { positionConstructionPointTest } end #----------------------------------------------------------------------------- file_loaded("constructionpointtests.rb")