• Login
sketchucation logo sketchucation
  • Login
๐Ÿ”Œ Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

How to display Vertex and change color when selected?

Scheduled Pinned Locked Moved Developers' Forum
10 Posts 4 Posters 452 Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    renderiza
    last edited by 12 Apr 2013, 22:53

    How to display Vertex and change color when mouse over it?

    Also it will be nice to change the color of edges and faces like it does when you have select tool activated.

    Thanks in advance!

    [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 13 Apr 2013, 00:45

      @unknownuser said:

      Also it will be nice to change the color of edges and faces like it does when you have select tool activated.

      Are you using the Selection set for anything else when you want to change their color ?

      If not.. then just push refs to entities into the selection set.

      ss = Sketchup.active_model.selection ss.add( ent )

      You can also pass an array of entities into the add method.

      ๐Ÿ’ญ

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 13 Apr 2013, 00:49

        @unknownuser said:

        How to display Vertex and change color when mouse over it?

        The API does not expose the little inferencing dots that native tools use.

        You must do so within a Tool class, using the draw methods. (You draw a little circle.)

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • R Offline
          renderiza
          last edited by 13 Apr 2013, 02:04

          This kinda work but only problem is that if cursor is touching nothing the edge remains selected until it touches something that is not an edge. Is there a fix for this?

          select_comp=view.pick_helper
          selected_comp=select_comp.best_picked 
          ss = Sketchup.active_model.selection
          
          if selected_comp.is_a? (Sketchup;;Edge)
           ss.add( selected_comp )
          else
           ss.clear
          end
          

          For the vertext suggestion I have yet to test this but soon I will give it a try

          Thank you very much!

          [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by 13 Apr 2013, 02:06

            @dan rathbun said:

            The API does not expose the little inferencing dots that native tools use.

            @dan, where does linetool.rb draw the circle, I can't see it in the code, but this apears to be all that displays the dots...
            # set the tooltip that should be displayed to this point view.tooltip = @ip1.tooltip
            I can see later when you draw the line, but not the dots...

            @Renderiza, linetool.rb and mousetool.rb are worth looking at for tracking ideas

            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dan Rathbun
              last edited by 13 Apr 2013, 04:18

              @driven said:

              ... this appears to be all that displays the dots...
              # set the tooltip that should be displayed to this point view.tooltip = @ip1.tooltip

              No that displays the popup box with yellow background, and says things like:
              "on Face", "from Midpoint", "on Edge", etc.

              The inferencing "dots" are created by the InputPoint class.

              But you have no control over those... they are controlled by SU's inferencing engine.

              SO actually .... @Rafael you actually could the built-in inferencing by using an InputPoint.
              (As long as you do not care what color it is.)

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • R Offline
                renderiza
                last edited by 13 Apr 2013, 14:07

                @dan rathbun said:

                SO actually .... @Rafael you actually could the built-in inferencing by using an InputPoint.
                (As long as you do not care what color it is.)

                Not sure about how to make what you suggested work. ๐Ÿ˜ž

                I am using inputPoint already to place entities in place but there is not inferencing showing.

                [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                1 Reply Last reply Reply Quote 0
                • J Offline
                  jolran
                  last edited by 13 Apr 2013, 14:56

                  Like Dan said, you have to use the draw method.

                  
                  
                  #Your inputpoint wherever you initialize it...
                  @ph = Sketchup;;InputPoint.new
                  
                  def draw(view)
                     view.draw_points(@ph, 5, 5, "red") if @ph
                  end
                  
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    renderiza
                    last edited by 15 Apr 2013, 23:47

                    Thanks guys!

                    At first I could not make this work but after a couple (lots!) of tries it worked!

                    Here is what I was doing wrong...

                    
                    def draw(view)
                       ip1 = view.inputpoint x,y ;	
                       point = ip1.position ;		
                       point3 = Geom;;Point3d.new (point.x,point.y,point.z)
                       view.draw_points (point3, 10, 1, "red")		
                    end
                    

                    and here was the right way...

                    ip1 = view.inputpoint x,y ;
                    @point = ip1.position ;
                    
                    def draw(view)		
                       point3 = Geom;;Point3d.new (@point.x,@point.y,@point.z)
                       view.draw_points (point3, 10, 1, "red")		
                    end
                    

                    Again thanks for help!

                    [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Dan Rathbun
                      last edited by 16 Apr 2013, 10:22

                      Don't put spaces between method names and their argument lists when you surround the list with** ( )**

                      Ruby generates a warning for every line that has the unneeded space.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      1 / 1
                      • First post
                        1/10
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement