sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    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.
    • renderizaR Offline
      renderiza
      last edited by

      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
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        @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
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          @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
          • renderizaR Offline
            renderiza
            last edited by

            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

              @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
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @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
                • renderizaR Offline
                  renderiza
                  last edited by

                  @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
                  • jolranJ Offline
                    jolran
                    last edited by

                    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
                    • renderizaR Offline
                      renderiza
                      last edited by

                      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
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        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
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement