sketchucation logo sketchucation
    • Login
    1. Home
    2. yiannicivil
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    Y
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Groups 1

    yiannicivil

    @yiannicivil

    10
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    yiannicivil Unfollow Follow
    registered-users

    Latest posts made by yiannicivil

    • Prompting user to select objects while running script

      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!

      posted in Developers' Forum
      Y
      yiannicivil
    • 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!

      posted in Developers' Forum
      Y
      yiannicivil
    • 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'
      nil

      Why is this happening? Other methods with multiple arguments work just fine..
      I cant figure this out on my own.. Can anyone help?

      posted in Developers' Forum
      Y
      yiannicivil