sketchucation logo sketchucation
    • Login
    1. Home
    2. Pauline01
    3. Posts
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    P
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 16
    • Posts 45
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Add a text on a point

      ok, now i want can change my text contained in a group.

      In my second plugin, i have a menu to change "Name_zone" of the object selected.

      I can't change the 2D text of my object, because it contained in a group of entities.

      In my second plugin i want do this after "#I wish change my 2D text in the object selected
      #??? "

      It's possible or i delete my object and i create a new?

      My code who associate my text in a group of entities.

      thx again and again. I'am begining...

      First plugin:

      
      
      def add_etiquette
      
        # Get "handles" to our model and the Entities collection it contains.
        model = Sketchup.active_model
        entities = model.entities
      
        # Create a series of "points", each a 3-item array containing x, y, and z.
        pt1 = [0, 0, 0]
        pt2 = [30, 0, 0]
        pt3 = [30, 0, 17]
        pt4 = [0, 0, 17]
        coordinates = [0, 0, 8.5]
        
        # Call methods on the Entities collection to draw stuff.
        # new_face = entities.add_face pt1, pt2, pt3, pt4
        group = entities.add_group
        point = Geom;;Point3d.new coordinates
        group.entities.add_face(pt1,pt2,pt3,pt4)
       
        
        prompt = ["Zone Name"]
        val = group.get_attribute("MyDico", "Name_zone")
        default = [val]
      
        result = UI.inputbox prompt, default, "Enter the Zone Name"
        adrresult = result[0].to_s
        group.set_attribute("MyDico", "Name_zone", adrresult.to_s)
        group.entities.add_text adrresult.to_s, point
        UI.messagebox ("@ ; " + adrresult.to_s + " saved")
       
       
      end
      
      
      

      Second plugin:

      
      
      def zonename
      
      
        
        prompt = ["Name"]
        val = Sketchup.active_model.selection[0].get_attribute("MyDico", "Name_zone")
        default = [val]
        result = UI.inputbox prompt, default, "Enter the Zone Name"
        adrresult = result[0].to_s
      
        adr = Sketchup.active_model.selection[0].set_attribute("MyDico", "Name_zone", adrresult.to_s)
      
        #I wish change my 2D text in the object selected text=adrresult
        #???
      
        UI.messagebox ("@ ; " + adr.to_s + " saved")
      
      end
      
      
      
      
      
      #Menu
      if (not file_loaded?("zEtiquette_config2.rb"))
       
          UI.add_context_menu_handler do |menu|
            if (Sketchup.active_model.selection.length == 1)
      	    menu.add_separator
      	    if ((Sketchup.active_model.selection[0].get_attribute("MyDico", "Name_zone")) != nil)
      	
      		  menu.add_item("Change Zone Name (@" + Sketchup.active_model.selection[0].get_attribute("MyDico", "Name_zone").to_s + ")") { zonename }
           
      	    end
            end
          end
      	$VSX = Vsx.new
      
        file_loaded("zEtiquette_config2.rb")
      end
      
      
      
      posted in Plugins
      P
      Pauline01
    • RE: Add a text on a point

      ok thx

      posted in Plugins
      P
      Pauline01
    • Add a text on a point

      Re re hello, 😛

      I try to add on my group a text.

      The text will be contain the string of "adrresult"(see in my code).

      I have somes things but...

      In my code i want complete after : " #i want to associate the position of my text on a point
      #???? position_point_of_my_text = text.point "

      and

      " # text=addresult
      #??? textstring = text.text= addresult "

      thx again...

      
      
      require 'sketchup.rb'
      
      class Vsx
        @@Obj = nil
      end
      
      def add_etiquette
      
        # Get "handles" to our model and the Entities collection it contains.
        model = Sketchup.active_model
        entities = model.entities
      
        # Create a series of "points", each a 3-item array containing x, y, and z.
        pt1 = [0, 0, 0]
        pt2 = [30, 0, 0]
        pt3 = [30, 0, 17]
        pt4 = [0, 0, 17]
        
        # Call methods on the Entities collection to draw stuff.
       # new_face = entities.add_face pt1, pt2, pt3, pt4
        group = entities.add_group
        group.entities.add_face(pt1,pt2,pt3,pt4)
        
        #i want to associate the position of my text on a point
        #???? position_point_of_my_text = text.point
      
      
        prompt = ["Zone Name"]
        val = group.get_attribute("MyDico", "Name_zone")
        default = [val]
      
        result = UI.inputbox prompt, default, "Enter the Zone Name"
        adrresult = result[0].to_s
        group.set_attribute("MyDico", "Name_zone", adrresult.to_s)
        UI.messagebox ("@ ; " + adrresult.to_s + " saved")
       
        # text=addresult
        #??? textstring = text.text= addresult
       
      end
      
      #Menu
      if (not file_loaded?("zEtiquette_config.rb"))
       
          tool_menu = UI.menu "Tools"
      	tool_menu.add_item("Create zone item") {
          add_etiquette
          }
      	
      	  
      	$VSX = Vsx.new
      
        file_loaded("zEtiquette_config.rb")
      end
      
      
      
      posted in Plugins
      P
      Pauline01
    • RE: Selection of item created

      oh! thx

      posted in Plugins
      P
      Pauline01
    • Selection of item created

      Re hello,

      You help me to create a groupe of entities, but i need to select automaticly this group // object after the creation because i want add an attribute with dictionnary system.

      In the code, i want select my object after the line "#i want select the item created to configure an attribute #???".

      Thx.

      
      
      require 'sketchup.rb'
      
      def add_etiquette
      
        # Get "handles" to our model and the Entities collection it contains.
        model = Sketchup.active_model
        entities = model.entities
      
        # Create a series of "points", each a 3-item array containing x, y, and z.
        pt1 = [0, 0, 0]
        pt2 = [30, 0, 0]
        pt3 = [30, 0, 17]
        pt4 = [0, 0, 17]
        
        # Call methods on the Entities collection to draw stuff.
        # new_face = entities.add_face pt1, pt2, pt3, pt4
        group = entities.add_group
        group.entities.add_face(pt1,pt2,pt3,pt4)
      
      
        #i want select the item created to configure an attribute
        #???
      
      
        #define an adress for the object in a dictionnary
        prompt = ["Name_zone"]
        val = Sketchup.active_model.selection[0].get_attribute("MyDico", "Name_zone")
        default = [val]
        result = UI.inputbox prompt, default, "Enter the Zone Name"
        adrresult = result[0].to_s
      
        adr = Sketchup.active_model.selection[0].set_attribute("MyDico", "Name_zone", adrresult.to_s)
        UI.messagebox ("@ ; " + adr.to_s + " saved")
       
      end
      
      #Menu
      if (not file_loaded?("zEtiquette_config.rb"))
       
          tool_menu = UI.menu "Tools"
      	tool_menu.add_item("Create zone item") {
          add_etiquette
          }
      	
      	  
      	$VSX = Vsx.new
      
        file_loaded("zEtiquette_config.rb")
      end
      
      
      
      posted in Plugins
      P
      Pauline01
    • RE: Create group

      oh, ok.... it's simple. thx guys

      posted in Developers' Forum
      P
      Pauline01
    • Create group

      hello,

      I create an entitie with a plugin but i don't arrive create a group with each point of my entitie...

      
      
      require 'sketchup.rb'
      
      def add_etiquette
      
        # Get "handles" to our model and the Entities collection it contains.
        model = Sketchup.active_model
        entities = model.entities
      
        # Create a series of "points", each a 3-item array containing x, y, and z.
        pt1 = [0, 0, 0]
        pt2 = [30, 0, 0]
        pt3 = [30, 0, 17]
        pt4 = [0, 0, 17]
        
        # Call methods on the Entities collection to draw stuff.
        new_face = entities.add_face pt1, pt2, pt3, pt4
      
        
        ##here i want create a group of "new_face"(in sketchup it's a selection right click and make group). 
        ##How do in ruby?                                                                                    
      
      
      end
      
      #Menu
      if (not file_loaded?("zEtiquette_config.rb"))
       
          tool_menu = UI.menu "Tools"
      	tool_menu.add_item("Create zone item") {
         add_etiquette
       }
           
      	$VSX = Vsx.new
      
        file_loaded("zEtiquette_config.rb")
      end
      
      
      
      posted in Developers' Forum
      P
      Pauline01
    • SelectionObserver and get attributes....

      Hello,

      I see the classe http://code.google.com/intl/fr-FR/apis/sketchup/docs/ourdoc/selectionobserver.html, i use this to run a ruby script when i click on a component in skecthup.

      for example:

      My component "Component#1" has in "Component Attribute" an identity, adress, and others descriptions... i want when i click on this component, run my ruby script (I already did that), but i don't know to retrieve "Component Attribute". I wish put for example the attribute "identity" of "Componente#1" in a variable in ruby.

      
      require 'sketchup.rb'
      
      class MySelectionObserver < Sketchup;;SelectionObserver
      
             def onSelectionBulkChange(selection)	   
      		wd=UI;;WebDialog.new( "Somfy Controller", true, "",950, 700, 100, 100, false )
      		wd.show
      		
      ####################
      		#I WANT TO PUT IDENTITY ATTRIBUE OF MY COMPONENT#1 IN THIS VARIABLE
                      identity= '000003'
      		wd.set_url("http://localhost/final_programme/index.php?identity="+identity+"")
      ####################
      
             end
      end
      
           # Attach the observer.
           Sketchup.active_model.selection.add_observer(MySelectionObserver.new)
      # end of sample.rb
      
      

      thx to help me

      Pauline

      posted in Developers' Forum
      P
      Pauline01
    • Ruby MySQL module in Sketchup

      helloooooo!

      I have a problem!

      I run a script ruby with ruby console in sketchup.In this script i need to do MySQL queries, i have MySQL module in my Ruby 1.9, when i run my script with prompt ruby console (no with ruby console in sketchup), all MySQL queries are ok ( at begining i need: require "mysql" ).

      How i can do to have the same things with Sketchup when I use: require "mysql"???

      To test i need to run this script which require "mysql":

      #############################################################

      require "mysql"

      begin
      # connect to the MySQL server
      dbh = Mysql.real_connect("localhost", "testuser", "testpass", "Motor_control")
      # get server version string and display it
      puts "Server version: " + dbh.get_server_info
      rescue Mysql::Error => e
      puts "Error code: #{e.errno}"
      puts "Error message: #{e.error}"
      puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
      ensure
      # disconnect from server
      dbh.close if dbh
      end

      ###########################################################

      thx to help me 😄

      Pauline

      posted in Developers' Forum
      P
      Pauline01
    • RE: Sketchup / ruby WebDiablog / php

      Nice so finally:

      the form will be in html and javascript, and the dialog between the html file and the ruby script will allow to do all queries. nice! and thx... 😄

      posted in Developers' Forum
      P
      Pauline01
    • RE: Sketchup / ruby WebDiablog / php

      And in html, this is an equal of include("file.php"); because else it's not flexible, i can use frame but i don't care.

      posted in Developers' Forum
      P
      Pauline01
    • RE: Sketchup / ruby WebDiablog / php

      Y i can create just a form in html and to give in script ruby the values of my form and i do my queries in ruby.

      But it's possble to return form values with only html and javascript (unless php) in a ruby script?

      If yes, i will see on the net how to do this.

      posted in Developers' Forum
      P
      Pauline01
    • RE: Sketchup / ruby WebDiablog / php

      I test set.file with url and path php, else i want when i click on a dynamique object, to run a ruby script witch run a webdialog with a php form.

      With this form i configure some parameters object and i put this in a MysSQL base.

      My object is a motor for exemple, in sketchup it has an adress.When i click on this, I take the adress motor to do in my php file somes query in mysql. I can configure speed motor for example in my form. Sketchup is just a graphic interface witch can use google earth to do a geolocation (building and item on this).

      posted in Developers' Forum
      P
      Pauline01
    • RE: Sketchup / ruby WebDiablog / php

      OK!

      But to put localhost in my functon webdialog, how i can do this?

      What is the parameters syntax of webdialog? I don't find in the API.

      My PC will be the server and the program will run only on my machine.

      thx for all!

      posted in Developers' Forum
      P
      Pauline01
    • Sketchup / ruby WebDiablog / php

      Hello,

      I run with Ruby console on sketchup a ruby script whitch contains a new webdialog. I want to do Html, php and JavaScript with mysql (olol) but the webdialog can't treate php. Is it possible? I have wamp server ect ect.

      posted in Developers' Forum
      P
      Pauline01
    • RE: Attribut d'un objet dans une variable ruby...

      up

      posted in Français
      P
      Pauline01
    • RE: How to launch a ruby script with OnClick?

      ok thx i go test!

      posted in Developers' Forum
      P
      Pauline01
    • RE: Attributes object skectchup in a char variable in Ruby?

      Y i want create a script who can put in a ruby variables some attribute of my dynamic object when i click on him, but i don't know how to do this...

      I know c, c++, java, php 5 but sketchup and ruby is new for me 😄.

      If you can help me, it's nice.

      thx

      posted in Developers' Forum
      P
      Pauline01
    • Attribut d'un objet dans une variable ruby...

      Bonjour,

      Mon souci, j'ai un objet dynamique dans sketchup avec des attributs que j'ai défini, dont les intitulés sont Name, Lenght, Description ect ect..peu importe.

      J'aimerais quand je clique sur mon objet dynamique envoyer la valeur des attributs dans une chaîne de caractère par exemple dans un fichier Ruby.

      Exemple: si je clique sur mon objets dynamique dont le Name = Porte_01, j'aimerais avoir dans mon script Ruby, "Porte_01" dans une variable de type char.

      Merci d'avance.

      Je ne sais pas si on peut utiliser la fonction onclick() de sketchup pour faire quelque chose ou si faut programmer un listenner pour attendre un clique sur objet...bref je suis un peu perdu car je manque de contenu a propos de cet outils, programmant essentiellement en Java, c.net, php.

      Pauline

      posted in Français
      P
      Pauline01
    • Attributes object skectchup in a char variable in Ruby?

      Hi,

      I have create on sketchup one dynamic objet with some attributes as a name, a description, a lenght, a position x, y, z ect ect...

      The goal is to take this attribute when i click on this object and to put them in a char variable in a ruby script.

      It's possible?
      This is a function or i must to pass by listener/reaction ect ect ...?
      If you have an idea or somthething, it's cool.

      CYA

      Pauline

      posted in Developers' Forum
      P
      Pauline01
    • 1
    • 2
    • 3
    • 2 / 3