like this...

john
cheers Dave, how did you make that?
I did some with just this and moving grouped copies, exploding, but did you use a second plugin for the surfaces?
john
@ Dave you had the pre v6 mod, which was just a typo, but it also has the 'PC' png icon instead of the pdf mac one I started with...
@Pete I updated the rbz...
john
cheers Pete, I chucked that in at the last minute incase 'someone' wanted to test it on SUv6, I'll revert to what was working >>> give me a minute...
john
it's coming along, I'll send you both a demo version...

Dave can try some intricate wood turning...
john
not sure if the OP will return, but I made that with a plugin I adapted...
so far it only makes a welded sinusoidal circle, that you can set the segments, height and frequency of...
by moving and scaling copies, you can replicate the results in the video...
just takes a bit longer...
john
to do this sort of thing?

john
Sam's was the basic that you should get working first...
mine was an elaboration to show passing the the pts to something else...
have a look at the query tool in the examples folder as well...
john
@deanby7 said:
...I'm running Version 8 Sketchup
Sketchup.active_model.tools.active_tool_id has been around since v6?
try it in Ruby Console after a tool change, does it fail there?
but, I agree with Garry on linetool.rb, I made a few tools based on it...
john
you have a few things going wrong there and it's easier for me to add some note to one that works...
the main one is you need to get your own copy of the class variable and ruby doesn't wait when you call the tool, so you have to...
this one adds a timer, and adds your method into the same namespace as the class...
module BbN # namespace it so it doesn't clash
extend self
# avoid common names for methods
def bd_pick
n = 5
# call the tool
Sketchup.active_model.select_tool BbN;;Pick_Points.new(n)
# get it's id
tool_id = Sketchup.active_model.tools.active_tool_id
#create a timer and use the id to know if it's finnished
wait_for_tool = UI.start_timer(1.0, true) do
if Sketchup.active_model.tools.active_tool_id == tool_id
else
# this is the 'pop' back, we retrieve the values from the @@var
result = (BbN;;Pick_Points.class_variable_get(;@@pts))
# I prefer p over puts as it shows a usable array
p result[0]
p result[1]
# clean up
UI.stop_timer(wait_for_tool)
end
end
end
class Pick_Points
def initialize(n)
@ipt = Sketchup;;InputPoint.new
@@pts = []
@count = n
@tally = 0
end
def onLButtonDown(flags,x,y,view)
@ipt.pick view,x,y
@@pts << @ipt.position.to_a
p @tally += 1
if @@pts.length == @count
p 'done'
Sketchup.active_model.select_tool(nil)
end
end
end
# add menu , toolbar or shortcut key cmd
unless file_loaded?("dbpick.rb")
cmd = UI;;Command.new(BbN;;bd_pick)
UI.menu("Plugins").add_item("dbpick") {cmd}
end
end
also, use code blocks in the forum, it's in the toolbar...
john
expanding on Sam's example, if you want something more flexible...
module SaM # namespace it so it doesn't clash
class Pick_Points
def initialize(n)
@ipt = Sketchup;;InputPoint.new
@@pts = []
@count = n
@tally = 0
end
def onLButtonDown(flags,x,y,view)
@ipt.pick view,x,y
@@pts << @ipt.position.to_a
p @tally += 1
if @@pts.length == @count
p 'done'
Sketchup.active_model.select_tool(nil)
end
end
end
end
and run it from your code with..
n = 5 # any number
Sketchup.active_model.select_tool SaM;;Pick_Points.new(n)
then retrieve it's values with...
SaM;;Pick_Points.class_variable_get(;@@pts)
john
dimension first then try
dims = Sketchup.active_model.entities.grep(Sketchup;;Dimension)
i = 0
dims.each do |d|
i+=1
d.text = "D#{i}"
end
it hard to do a sort, but maybe the order of dimensioning will be honoured...
john
Theoretically, you could write a ruby to make the dynamic component for single session use...
when the user saves or closes the model, the dynamic attributes could be stripped or nobbled...
if reopened on the same or another licensed computer, the plugin could restore the attributes...
but, I'm only thinking out loud...
john
@gentlemanjosh said:
... all of my plugins have a .plugin extension ...
you are looking inside SketchUp.app contents and the .pluginsare all compiled C code, not ruby...
don't put anything into the app, unless you 'really' know how to bypass issues...
always make sure your using the User/<your_name>/Library/... until you know how it all works...
john
this is where I recently read about admin permissions issues...
If I drag and drop a png from the internet directly into sketchup 2016 it doesn’t get in the model. I was under the impression this used to work on previous versions: The following gif shows the issue: 1 - Drag and dro…
SketchUp Community (forums.sketchup.com)
I'm not sure it will ever work with pasteboard though...
john
hi John,
can you not 'Save As' a png/jpg into a watched folder that triggers an SU import?
or maybe just an unwatched folder and a ruby button/shortcut to import last item in that folder?
I think the problem with Pasteboard on both platforms is a permission issue with a raw binary stream...
i.e. it could be anything, so it gets blocked...
john
are you using Capitals for method names in your real code?
You need to post the full example for anyone else to find the problem...
if you do, wrap it in a 'code' block so it's easy to read and copy paste for testing...
webDialogs normally work fine...
john
I use
c = (Sketchup;;Color.new 'blue').to_a
# => [0, 0, 255, 255]
c.dup
# => [0, 0, 255, 255]
can't remember why, but maybe for the same reason...
john
does this work in v14 and above?
I don't use PC's but I'm looking for code that does something similar to this...
require 'win32ole'
val = 48
circle_first = UI.start_timer(1.0, true) do
if Sketchup.active_model.tools.active_tool_name != 'CircleTool'
Sketchup.send_action('selectCircleTool;')
else # run the script
WIN32OLE;;new('WScript.Shell').SendKeys("#{val}{ENTER}")
p "#{val}{ENTER}"
UI.stop_timer(circle_first)
arc_next = UI.start_timer(1.0, true) do
if Sketchup.active_model.tools.active_tool_name != 'ArcTool'
Sketchup.send_action('selectArcTool;')
else # run the script
WIN32OLE;;new('WScript.Shell').SendKeys("#{val/2}{ENTER}")
p "#{val/2}{ENTER}"
UI.stop_timer(arc_next)
end
end
end
end
john
it's been a while and maybe everyone has lost interest, but I found a few more for the mac list...
the big question is, how many of these run on a PC?
single # denotes a Menu Title, ## Item Title, ### hard coded shortcut combo...
# SketchUp
Sketchup.send_action('showAboutBox;') ## About SketchUp
Sketchup.send_action('showSketchUpPreferences;') ## Preferences...
Sketchup.send_action('manageLicenses;') ## License...
Sketchup.send_action('checkWebUpdate;') ## Check Web for Update...
Sketchup.send_action('hide;') ## Hide SketchUp ### ⌘H
Sketchup.send_action('hideOtherApplications;') ## Hide Others ### ⌘H
Sketchup.send_action('unhideAllApplications;') ## Show All
Sketchup.send_action('terminate;') ## Quit SketchUp ### ⌘Q
# File
Sketchup.send_action('newDocument;') ## New ### ⌘N
Sketchup.send_action('openDocument;') ## Open... ### ⌘O
Sketchup.send_action('clearRecentDocuments;') ## Clear Menu
Sketchup.send_action('performClose;') ## Close ### ⌘W
Sketchup.send_action('saveDocument;') ## Save ### ⌘S
Sketchup.send_action('saveDocumentAs;') ## Save As... ### ⇧⌘S
Sketchup.send_action('saveCopy;') ## Save A Copy As...
Sketchup.send_action('saveAsTemplate;') ## Save As Template...
Sketchup.send_action('revertDocumentToSaved;') ## Revert
Sketchup.send_action('sendToLayOut;') ## Send to LayOut
Sketchup.send_action('importFromGoogleEarth;') ## Add Location...
Sketchup.send_action('clearLocation;') ## Clear Location
Sketchup.send_action('toggleTerrain;') ## Show Terrain
Sketchup.send_action('browse3DWarehouse;') ## Get Models...
Sketchup.send_action('shareWithGoogleEarthCommunity;') ## Share Model...
Sketchup.send_action('runImporter;') ## Import...
Sketchup.send_action('runPageLayout;') ## Page Setup... ### ⇧⌘P
Sketchup.send_action('runDocumentSetup;') ## Document Setup...
Sketchup.send_action('printDocument;') ## Print... ### ⌘P
# Edit
Sketchup.send_action('editUndo;') ## Undo ### ⌘Z
Sketchup.send_action('editRedo;') ## Redo ### ⇧⌘Z
Sketchup.send_action('cut;') ## Cut ### ⌘X
Sketchup.send_action('copy;') ## Copy ### ⌘C
Sketchup.send_action('paste;') ## Paste ### ⌘V
Sketchup.send_action('pasteInPlace;') ## Paste In Place
Sketchup.send_action('editDelete;') ## Delete
Sketchup.send_action('eraseConstructionGeometry;') ## Delete Guides
Sketchup.send_action('selectAll;') ## Select All ### ⌘A
Sketchup.send_action('deselectAll;') ## Select None ### ⇧⌘A
Sketchup.send_action('editHide;') ## Hide ### ⌘E
Sketchup.send_action('editUnhide;') ## Selected
Sketchup.send_action('editUnhideLast;') ## Last
Sketchup.send_action('editUnhideAll;') ## All ### ⇧⌘E
Sketchup.send_action('editLock;') ## Lock
Sketchup.send_action('editUnlockSelected;') ## Selected
Sketchup.send_action('editUnlockAll;') ## All
Sketchup.send_action('makeComponent;') ## Make Component... ### ⇧⌘G
Sketchup.send_action('makeGroup;') ## Make Group ### ⌘G
Sketchup.send_action('closeGroupOrComponent;') ## Close Group/Component ### ⇧⌘G
Sketchup.send_action('intersectWithModel;') ## With Model
Sketchup.send_action('intersectSelected;') ## With Selection
Sketchup.send_action('intersectWithContext;') ## With Context
# View
Sketchup.send_action('toggleToolPalette;') ## Large Tool Set
Sketchup.send_action('toggleSolidModelToolPalette;') ## Solid Tools
Sketchup.send_action('toggleGoogleToolPalette;') ## Location
Sketchup.send_action('toggleWarehouseToolPalette;') ## Warehouse
Sketchup.send_action('togglePageTabsDsiplay;') ## Scene Tabs
Sketchup.send_action('viewShowHidden;') ## Hidden Geometry
Sketchup.send_action('sectionToggleDisplay;') ## Section Planes
Sketchup.send_action('sectionToggleActivation;') ## Section Cuts
Sketchup.send_action('viewShowAxes;') ## Axes
Sketchup.send_action('viewShowGuides;') ## Guides
Sketchup.send_action('toggleShadows;') ## Shadows
Sketchup.send_action('toggleFog;') ## Fog
Sketchup.send_action('toggleDisplayEdges;') ## Edges
Sketchup.send_action('toggleDisplayBackEdges;') ## Back Edges
Sketchup.send_action('toggleProfiles;') ## Profiles
Sketchup.send_action('toggleDepthQue;') ## Depth Cue
Sketchup.send_action('toggleExtensions;') ## Extension
Sketchup.send_action('toggleGlobalTransparency;') ## X-ray
Sketchup.send_action('renderWireframe;') ## Wireframe
Sketchup.send_action('renderHiddenLine;') ## Hidden Line
Sketchup.send_action('renderShaded;') ## Shaded
Sketchup.send_action('renderTextures;') ## Shaded With Textures
Sketchup.send_action('renderMonochrome:') ## Monochrome
Sketchup.send_action('toggleHideRestOfModel;') ## Hide Rest of Model
Sketchup.send_action('toggleHideSimilarComponents;') ## Hide Similar Components
Sketchup.send_action('pageAdd;') ## Add Scene
Sketchup.send_action('pageUpdate;') ## Update Scene
Sketchup.send_action('pageDelete;') ## Delete Scene
Sketchup.send_action('pagePrevious;') ## Previous Scene
Sketchup.send_action('pageNext;') ## Next Scene
Sketchup.send_action('slideshowStart;') ## Play
Sketchup.send_action('pageOptions;') ## Settings
Sketchup.send_action('toggleToolbarShown;') ## Hide Toolbar
Sketchup.send_action('runToolbarCustomizationPalette;') ## Customize Toolbar ...
# Draw
Sketchup.send_action('selectLineTool;') ## Line ### ⌘L
Sketchup.send_action('selectFreehandTool;') ## Freehand ### ⌘F
Sketchup.send_action('selectArc3PointTool;') ## Arc ### ⌘J
Sketchup.send_action('selectArcTool;') ## 2 Point Arc
Sketchup.send_action('select3PointFitArcTool;') ## 3 Point Arc
Sketchup.send_action('selectArcPieTool;') ## Pie
Sketchup.send_action('selectRectangleTool;') ## Rectangle ### ⌘K
Sketchup.send_action('selectRectangle3PointTool;') ## Rotated Rectangle
Sketchup.send_action('selectCircleTool;') ## Circle
Sketchup.send_action('selectPolygonTool;') ## Polygon
# Camera
Sketchup.send_action('viewUndo;') ## Previous
Sketchup.send_action('viewRedo;') ## Next
Sketchup.send_action('viewTop;') ## Top ### ⌘1
Sketchup.send_action('viewBottom;') ## Bottom ### ⌘2
Sketchup.send_action('viewFront;') ## Front ### ⌘3
Sketchup.send_action('viewBack;') ## Back ### ⌘4
Sketchup.send_action('viewLeft;') ## Left ### ⌘5
Sketchup.send_action('viewRight;') ## Right ### ⌘6
Sketchup.send_action('viewIso;') ## Iso ### ⌘7
Sketchup.send_action('viewParallelProjection;') ## Parallel Projection
Sketchup.send_action('viewPerspective;') ## Perspective
Sketchup.send_action('viewTwoPointPerspective;') ## Two-Point Perspective
Sketchup.send_action('cameraMatchNewPhoto;') ## Match New Photo...
Sketchup.send_action('editPhotoMatch;') ## Edit Matched Photo
Sketchup.send_action('selectOrbitTool;') ## Orbit ### ⌘B
Sketchup.send_action('selectDollyTool;') ## Pan ### ⌘R
Sketchup.send_action('selectZoomTool;') ## Zoom
Sketchup.send_action('selectFieldOfViewTool;') ## Field of View
Sketchup.send_action('selectZoomWindowTool;') ## Zoom Window
Sketchup.send_action('viewZoomExtents;') ## Zoom Extents
Sketchup.send_action('viewZoomToSelection;')
Sketchup.send_action('viewZoomImage;') ## Zoom to Photo
Sketchup.send_action('selectPositionCameraTool;') ## Position Camera
Sketchup.send_action('selectWalkTool;') ## Walk
Sketchup.send_action('selectTurnTool;') ## Look Around
Sketchup.send_action('selectImageIglooTool;') ## Image Igloo
# Tools
Sketchup.send_action('selectSelectionTool;') ## Select
Sketchup.send_action('selectEraseTool;') ## Eraser
Sketchup.send_action('selectPaintTool;') ## Paint Bucket
Sketchup.send_action('selectMoveTool;') ## Move ### ⌘0
Sketchup.send_action('selectRotateTool;') ## Rotate ### ⌘8
Sketchup.send_action('selectScaleTool;') ## Scale ### ⌘9
Sketchup.send_action('selectPushPullTool;') ## Push/Pull
Sketchup.send_action('selectExtrudeTool;') ## Follow Me
Sketchup.send_action('selectOffsetTool;') ## Offset
Sketchup.send_action('selectOuterShellTool;') ## Outer Shell
Sketchup.send_action('selectUnionTool;') ## Union
Sketchup.send_action('selectDifferenceTool;') ## Subtract
Sketchup.send_action('selectDifferenceNDTool;') ## Trim
Sketchup.send_action('selectIntersectTool;') ## Intersect
Sketchup.send_action('selectBooleanSplitTool;') ## Split
Sketchup.send_action('showSolidModelToolsMenu;') ## Split
Sketchup.send_action('selectMeasureTool;') ## Tape Measure ### ⌘D
Sketchup.send_action('selectProtractorTool;') ## Protractor
Sketchup.send_action('selectAxisTool;') ## Axes ### ⌘F
Sketchup.send_action('selectDimensionTool;') ## Dimensions
Sketchup.send_action('selectTextTool;') ## Text
Sketchup.send_action('doThreeDText;') ## 3D Text
Sketchup.send_action('selectSectionPlaneTool;') ## Section Plane ### ⌘Y
# Window
Sketchup.send_action('performMiniaturize;') ## Minimize ### ⌘M
Sketchup.send_action('performZoom;') ## Zoom
Sketchup.send_action('showModelPropertiesPanel;') ## Model Info ### ⇧⌘I
Sketchup.send_action('entityProperties;') ## Entity Info ### ⌘I
Sketchup.send_action('orderFrontColorPanel;') ## Materials ### ⇧⌘C
Sketchup.send_action('showComponentBrowser;') ## Components
Sketchup.send_action('showStyleBrowser;') ## Styles
Sketchup.send_action('showLayerPanel;') ## Layers
Sketchup.send_action('showOutliner;') ## Outliner
Sketchup.send_action('showPagePanel;') ## Scenes
Sketchup.send_action('orderFrontFontPanel;') ## Show Fonts ### ⌘T
Sketchup.send_action('showRubyConsole;') ## Ruby Console
Sketchup.send_action('showShadowsPanel;') ## Shadows
Sketchup.send_action('showFogSettingsPanel;') ## Fog
Sketchup.send_action('showPhotoMatchPanel;') ## Match Photo
Sketchup.send_action('showSoftenEdgesPanel;') ## Soften Edges
Sketchup.send_action('showInstructor;') ## Instructor
Sketchup.send_action('browse3DWarehouse;') ## 3D Warehouse
Sketchup.send_action('browseExtensionStore;') ## Extension Warehouse
Sketchup.send_action('toggleInspectors;') ## Hide Dialogs
Sketchup.send_action('getPhotoTexture;') ## Photo Textures !!!!!!!!!!!! not working
Sketchup.send_action('arrangeInFront;') ## Bring All to Front
# Help
Sketchup.send_action('showWelcomePanel;') ## Welcome To SketchUp…
Sketchup.send_action('showOnlineHelpCenter;') ## Knowledge Center
Sketchup.send_action('contactUs;') ## Contact Us
# Orphans
Sketchup.send_action('fixNonPlanarFaces;') ## Model Info >> Statistics >> Fix Problems
I may have missed some...
john