sketchucation logo sketchucation
    • Login
    1. Home
    2. njeremy2
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ”Œ Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download
    N
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 58
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Basic operation on char...

      hmmmm, well...

      With that, you can add an attribute called "reference" for all components and set attribute then ?

      So if I do like that : componentinstance.definition.set_attribute('Reference', '755480RED', 'Valuedefaultif 755480RED doesnt exist')

      That would work ?

      And to list all references, how should I do ?
      componentinstance.definition.set_attribute('Reference') ?

      posted in Developers' Forum
      N
      njeremy2
    • RE: Basic operation on char...

      @thomthom said:

      Btw, did you create the component? Is it intended for the user to read that reference code?
      If not, then you might want to store it in an attribute:

      Entity#get_attribute: https://developers.google.com/sketchup/docs/ourdoc/entity#get_attribute
      Entity#set_attribute: https://developers.google.com/sketchup/docs/ourdoc/entity#set_attribute
      class AttributeDictionary: https://developers.google.com/sketchup/docs/ourdoc/attributedictionary
      class AttributeDictionaries: https://developers.google.com/sketchup/docs/ourdoc/attributedictionaries

      Sorry I don't understand the first time I read your post...
      I can use attributes but I see in AUTOMATIC Sketchup.pdf that's attributes cannot be stored when you save a component (I understand that)

      And put the reference into the description was for me the easiest solution (I hope, if someone has a better solution, tell me).

      In that way, I'm sure the reference is shared when I sent a component to my database

      posted in Developers' Forum
      N
      njeremy2
    • RE: Basic operation on char...

      @thomthom said:

      Btw, did you create the component? Is it intended for the user to read that reference code?
      If not, then you might want to store it in an attribute:

      Entity#get_attribute: https://developers.google.com/sketchup/docs/ourdoc/entity#get_attribute
      Entity#set_attribute: https://developers.google.com/sketchup/docs/ourdoc/entity#set_attribute
      class AttributeDictionary: https://developers.google.com/sketchup/docs/ourdoc/attributedictionary
      class AttributeDictionaries: https://developers.google.com/sketchup/docs/ourdoc/attributedictionaries

      no no ! it's ok !

      Components are already create when I put components in design I launch my plug test.
      My plugin search all components and then I ask it to display each references include in their description

      posted in Developers' Forum
      N
      njeremy2
    • RE: Basic operation on char...

      Yeahhh !! thanks thomthom !!

      I searched in french tutorials, that's why I didn't found anything !! lol

      πŸ‘

      posted in Developers' Forum
      N
      njeremy2
    • Basic operation on char...

      Hello everyone ! πŸ˜„
      I have a stupid question but I can't find the solution...
      I would like to retrieve a string until " " (space) from description of component.

      %(#008000)[MY example :
      Definition : Cube
      Description : 755480RED That's my cube]

      755480RED is a reference of the cube and "That's my cube" the real description.
      I just need to retrieve the reference include in the description.

      description = Sketchup.active_model.description
      Sketchup.active_model.entities.each do |entities|
      @tab << entities
      	@tab.each do |element|
      		UI.messagebox "#{element.description}".to_i
      	end #end TAB.EACH
      end #model.each
      

      Here,
      when I put : UI.messagebox "#{element.description}" I have the complete description.
      when I put : UI.messagebox "#{element.description}".to_i I have only the first number (it works only if the reference are numbers only)

      What I need is to put a condition which is:
      Retrive the description until you found " " but I don't know how to do that.

      Someone can help me ?

      posted in Developers' Forum
      N
      njeremy2
    • RE: Retrive the tool selected before launching my plugin

      Now, I'm using name to identify the tool

      For this moment it works πŸ‘

      I don't understand the ID method, maybe when I feel ill at ease with ruby, I can understand how it works

      Thank you Dan and Karen !!

      posted in Developers' Forum
      N
      njeremy2
    • RE: Retrive the tool selected before launching my plugin

      @dan rathbun said:

      @njeremy2 said:

      It works for most of tools except for LineTool (it's called "SketchTool" instead of "Linetool"), polygon, axis tool.

      We know. This is why I told you (in post http://forums.sketchucation.com/posting.php?mode=quote&f=180&p=405232#pr404805 ) that you need a send action lookup hash.

      ahhh ok !! lol sorry !

      You write too much text and google translation doesn't translate very well ! πŸ˜„

      posted in Developers' Forum
      N
      njeremy2
    • RE: Retrive the tool selected before launching my plugin

      Hmmm, it's little bit weird :

      When I retrive the ID of the tool with your solution, I obtain an ID number but when I launch a second time the plugin, I have a second ID number. WHY ??? πŸ˜’

      But, I've try this:

      @model = Sketchup.active_model
      @tools = @model.tools
      @name = @tools.active_tool_name
      @name2 = "select#{@name};"
      
      Sketchup.send_action "#{@name2}"
      

      It works for most of tools except for LineTool (it's called "SketchTool" instead of "Linetool"), polygon, axis tool.

      Maybe if I can retrive the ID with "@id = @tools.active_tool_id" and "Sketchup.send_action (@id)" it should be better but how do we do ?

      posted in Developers' Forum
      N
      njeremy2
    • RE: Retrive the tool selected before launching my plugin

      Hmmmmmmm
      I a little bit hard to use ...

      To begin easily, I made a plugin which display the name of selected tool
      I will show you the progress πŸ˜‰

      posted in Developers' Forum
      N
      njeremy2
    • RE: Retrive the tool selected before launching my plugin

      I'm gonna test it right now πŸ˜„

      posted in Developers' Forum
      N
      njeremy2
    • Retrive the tool selected before launching my plugin

      Hello everyone ! β˜€ (35Β°C in South of France)

      Today I have a new enigma, I need to create a plugin which allow us to choose 3 points and find the center of the them.
      This part is done but for this plugin I need more.

      My plugin should work like that :

      1. I select the tool (circle tool for example), a component or something else...
      2. I launch the plugin
      3. I select my 3 points
      4. The center is draw and the circle tool is activate on the center (or component placed here).

      example :

      http://img39.imageshack.us/img39/275/79886999.jpg

      I search on Google Sketchup API and automatic sketchup PDF, I use Sketchup.send_action "selectCircleTool:" for activate the plugin circle tool.

      I should retrive the tool before lauching the plugin, I try this :

      tools = Sketchup.active_model.tools
      Sketchup.send_action "#{tools}"
      

      or

      tools = Sketchup.active_model.select_tool nil
      Sketchup.send_action "#{tools}"
      

      I succeed how to pick a component to put in the center but I don't know how to retrieve a tool selected before
      Someone can help me ? πŸ˜„

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      @dan rathbun said:

      @thomthom said:

      Instead of a timer, wouldn't DefinitionObserver.onComponentInstanceAdded be better..?
      https://developers.google.com/sketchup/docs/ourdoc/definitionobserver#onComponentInstanceAdded

      He is a month-old newbie.. I didn't want to go into observers with him yet.

      πŸ‘ right ! thanks πŸ˜„

      not "month-old", I'm "week-old" newbie ! πŸ˜‰

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      Dan, if you were a girl, I could fall in love with you !!!

      It's working !

      Thanks to Dan and TIG !!

      If you need a help from me for Sketchup, ask me πŸ˜‰ I'm a professional almost ! lol

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      @dan rathbun said:

      @njeremy2 said:

      Can I have all parameters of "place_component" ?

      There are only 2.

      And the API is wrong.. the method always returns the model object. (It cannot return the new component instance because there may be many off them.)

      So instead do this:

      
      > before = @composantDef.instances.to_a
      > toolset = Sketchup.active_model.tools
      > @model.place_component(@composantDef, true)
      > tid = UI.start_timer(1.0,true){
      >   if toolset.active_tool_id != 21013
      >     UI.stop_timer(tid)
      >     after = @composantDef.instances.to_a - before
      >     after.each {|inst| inst.name = @nameCompo }
      >   end
      > }
      > 
      

      I'm gonna try this now, I will tell you again when it's working πŸ˜›

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      I want to put a name on each copy
      the name is store on that variable : @nameCompo

      I put that code

      newCompo = @model.place_component(@composantDef, true)
      

      I try

      newCompo.name = "#{@nameCompo}"
      

      but it didn't work

      I try also

      @model.place_component(@composantDef, true, "#{nameCompo})
      

      didn't work too...
      Can I have all parameters of "place_component" ?

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      @dan rathbun said:

      I think there is a component spray plugin that you could use to spray trees into a model.

      yeah ! but it's not only trees πŸ˜‰

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      @dan rathbun said:

      Here is another way which can copy multiple objects (be they components, groups, primitives, or any combination of them.)

      1) Select the component, or the selection contains anything(s) you wish to copy.

      2) Sketchup.send_action("copy:")

      3) Sketchup.send_action("paste:")

      User presses ESC to unselect the copied things. (But the MoveTool is still active afterward.)
      You can clear the selection via Sketchup.active_model.selection.clear() and then reset the original selection if you have first saved it to an array.

      All this can be done with the Edit menu options, or the Copy and Paste buttons from the Standard toolbar, or CTRL+C/CTRL+V shortcuts.

      Yeah, I think it could be a great solution but the tool i've made is really useful for people who works for making forest on sketchup for example.

      You select your first tree, activate the plugin, and put your tree everywhere you click (like the video game SIMS on computer 😜 )

      BUT I WOULD THANKS TO ALL OF YOU ! πŸ‘

      posted in Developers' Forum
      N
      njeremy2
    • RE: Copy tool --&gt; no preview

      @tig said:

      https://developers.google.com/sketchup/docs/ourdoc/model#place_component
      model.place_component(component_definition, true)
      πŸ˜•

      I LOVE YOU !!!
      It works great !!!!!!!!!!!!!!!
      Since monday, I try to find the solution on the observer but it didn't work ... lol

      Just for my personnal culture, what is the observer ? how do you use that ? (I read so many times the pdf and search on the net but I don't understand exactly the purpose)

      I know it use for retrive any change on edge, entities, component ... but what for ?
      Can you give me example ?

      posted in Developers' Forum
      N
      njeremy2
    • Copy tool --&gt; no preview

      Hello everyone,

      I know is useless because this tools already exist but I have created a plugin which copy a component and paste that copy every where you click on your design but I don't know how to have preview before putting the component on the design.

      1. You select the component
      2. launch the plugin
      3. click where you want to put the copy of the component (ex : a mailbox)
      4. push "space" bar to quit the component

      The benefit of this plugin is you don't have to press "CTRL" or reselect the component you want to copy.

      http://img20.imageshack.us/img20/5782/movex.png

      Original tool with the preview before putting the component

      http://img32.imageshack.us/img32/6931/22608080.jpg

      My tool :
      Tool activate, before clicking

      http://img24.imageshack.us/img24/9577/31931110.jpg

      after clicking on design

      http://img401.imageshack.us/img401/6528/66827814.jpg

      But I cannot have the preview like the original plugin. Without this, the accuracy is bad...
      Someone can tell me how to add this preview ? πŸ˜„

      posted in Developers' Forum
      N
      njeremy2
    • RE: Explode group, retrive all entities and recreate group

      @dan rathbun said:

      Does your boss ever use the
      http://forums.sketchucation.com/download/file.php?id=87554
      Model Info > Statistics panel ??

      [attachment=1:1ebrpxvl]<!-- ia1 -->ModelInfo_Statistics.png<!-- ia1 -->[/attachment:1ebrpxvl]

      Yes he knows this tool, but it don't give you the texture (in m²) and of the components neither groups 😞

      thanks to all everybody !!! I think I found the solution. πŸ‘

      When I need to found each entities in a group I use that :

      if g.is_a?(Sketchup;;Group)				  
      	g.entities.each do |element|
      		if element.definition.name[0] != 0 && element.name == ""
      		element.name = "#{element.definition.name}"
      		end # end if
      	end #|element|
      
      

      With that, I can change the name of component inside a group

      The first code of TIG gave me an idea, I combine my code with a piece of code from him and it worked ! (it was only a sample of code used to test for me)
      Now I have to copy that piece of code in the big one ! πŸ˜„

      Before :

      http://img205.imageshack.us/img205/1108/33890297.png

      After launching the plugin :

      http://img585.imageshack.us/img585/7154/18942418.png

      posted in Developers' Forum
      N
      njeremy2
    • 1
    • 2
    • 3
    • 2 / 3