I am trying to make a plugin in which I need selection inputs from the user.
Atually I need to be able as a user to select one group in sketchup (via mouse clicking), name it somewhat in ruby,
then select another group (via mouse clicking again) and give it another name in ruby, so I can go on with calculations, manipulating geometry etc.
How is this possible? I really tried to find out on my own but I didnt come up with a solution in the resourses that I have by far.
I see plugins that when they run, they prompt the user to select stuff, even show graphic previews of the result, etc.
I cant realize how this can be coded...
Any help - explanations - resources - tutorials - references would be great!
Posts
-
Prompting user to select objects while running script
-
RE: Problems defining a method
Thank you John. I actually worked it out after trying really hard to see whats going wrong.
I guess you can see I am a starter in ruby scripting, though it is really fulfilling to see my code actually work! -
Problems defining a method
I am encountering an mysterious issue while defining a method.
Code goes as follows:mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection u = [1,0,0] apoint = [1,0,0] face1 = sel[0] def classifiy(u, point1, face1) # σημείο προβολής pt = Geom;;Point3d.new pt result = faces_array[0].classify_point(pt) ent.add_cpoint pt if result == Sketchup;;Face;;PointOutside UI.messagebox(pt.to_s + ' is outside the face') elsif result == Sketchup;;Face;;PointInside UI.messagebox(pt.to_s + ' is inside the face') elsif result == Sketchup;;Face;;PointOnVertex UI.messagebox(pt.to_s + ' is on a vertex') elsif result == Sketchup;;Face;;PointOnEdge UI.messagebox(pt.to_s + ' is on an edge of the face') elsif result == Sketchup;;Face;;PointNotOnPlane UI.messagebox(pt.to_s + ' is not on the same plane as the face') end result end classify (u, apoint, face1)
I get an error:
@unknownuser said:Error: #<SyntaxError: C:/my_path.../3.rb:27: syntax error, unexpected ',', expecting ')'
classify (u, point, face1)^
C:/ProgramData/SketchUp/SketchUp 2014/SketchUp/Plugins/test.rb:27: syntax error, unexpected ')', expecting '='
classify (u, point, face1)^>
<main>:in
load' <main>:in
<main>'
-e:1:in `eval'
nilWhy is this happening? Other methods with multiple arguments work just fine..
I cant figure this out on my own.. Can anyone help?