sketchucation logo sketchucation
    • Login
    1. Home
    2. artmusicstudio
    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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 84
    • Posts 217
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: SKP 2017 - saving component to file via ruby

      hi tig,
      thanx for replying,
      i just red your code and suppose, that every skp-file, you call, will be opened in the viewport and resaved as another version - correct? so it cannot be used as a background task within (under) a running sketchup session (maybe a parallel skp-session opens..... 😄),
      have to try it out later this evening.
      what is a big help for me, is the declaration <<ver=Sketchup::Model::VERSION_2016>>,
      i must have missed it in the api-doc.
      the rest is clear.

      but: so there is no way to declare the skp-version when saving a compo to a file, i guess...
      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • SKP 2017 - saving component to file via ruby

      hi,
      is there any hidden parameter in the api (now in skp 2017), that would alow me to save a compo-definition to a file (name.skp) in version 2015 instead of the version of the opened skp-session?
      the reason is, that i have a version of a vis-program, which does not import version 2017-files.
      (at the moment i have to re-open them in a new skp-session and save_as....)

      or is there a converter, which could be launched from ruby-api to batch-convert the saved compos in a selected folder?

      than in advance.

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: SKP 2017 on older laptop

      hello to all
      and thanx for checking my problem. i will check the specs in detail,
      maybe it is time to buy a new notebook than....
      thanx a lot again
      stan

      posted in Newbie Forum
      artmusicstudioA
      artmusicstudio
    • SKP 2017 on older laptop

      hello,
      up to v 2016 i could work on older laptops,
      v 2017 now reports a missing open gl etc.

      is it possible to run 2017 somehow also on older systems (which still work well 😄 ? even a certain loss of performance would not be a problem....

      thanx

      stan

      posted in Newbie Forum sketchup
      artmusicstudioA
      artmusicstudio
    • STYLES - language handling

      edit 170122-found the string-file for style names in the programm-dir........one step further.....

      hello,
      maybe somebody has an idea for the following problem:

      in german-skp-version:

      • when i iterate thru model.styles via ruby and display their names,
        the styles are shown as following (edit: in ruby concole, not skp-style-menu):

      • own styles with user-name or edited styles : name in german

      • original styles (like chosen from style-submenues and un-edited: in english (skp-basic name in [style-name] form

      • in the style menu the name is always shown in german

      as soon as i click on the german name in the style menu (top line in the style menu), the style gets converted and will be shown now (ruby-iteration) in german in the ruby console.

      NOW:

      how can i retrieve the german name for the english name and vice versa via ruby? is it a hash?

      the problem is:

      i have an input menu, where i can copy the name from the skp-menu and search for the style.
      but here

      not-edited original styles cannot be found, because

      • skp-menu offers the GERMAN NAME (which i copy via c&p)
      • ruby iterates in the english namespace and cannot find this style via name-input

      any solution or tip?

      thanx a lot in advance
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Override the alt-key in a class ??

      hi,

      within my own class (tool) i use shift, ctrl and alt for alternative mouse functions.

      is it possible to override the native alt-function (menu-hi-lite) temporarily within a tool

      and set it back , when the tool is finished?

      i canot find any topic about this ....

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Layer name as if-condition ?? possible ???

      hi,
      this one does not seem to work. i wonder, if a layer.name can be a condition? no info in api....

      
      model = Sketchup.active_model
      entities = model.entities
      
      entities.each { |m|
      puts "iterating m"
      	if m.is_a?(Sketchup;;Group)
      		e = m.entities
      			e.each { |f|
      			puts "iterating f"
      			    if f.is_a?(Sketchup;;Group) and f.layer == "layername"
      					puts f.layer
      						entities2 = f.entities
      							entities2.each { |g|
      							puts "moving entities"
      							newlayer = g.layer = "Layer0"
      								
      									}
      					end				
      					}#f
      		end
      	}#m
      end#def
      
      

      thanx
      stan

      edit: just found out, that

      @unknownuser said:

      if f.is_a?(Sketchup::Group) and f.layer.name == "layername"

      works.

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: UI exit ruby?

      hi and thanx to both,
      @ tig: yes, i also use puts-tags to follow the code in the console , whit line-number-output to see, in which code -line the puts is.
      i will try out all the break, next etc. functions. thanx for this?

      and @tt_su

      yes, interaction with the viewport was exactly, what i hoped for, so i could inspect the geometry at any stage ot the running code. (break - inspect geometry - go on....). the rest is still tooooo 'high' for me, although i already 'speak' a bit ruby...-:)

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Selection.add ??? possible?

      hi,
      when i have

      
      model = Sketchup.active_model
      sel = model.selection
      
      

      and create a edge-copy from a given edge (from an edge-array : edges)

      
      entities2 = Sketchup.active_model.entities
      vertex = edges[0].start
      pt_start = vertex.position
      			
      vertex = edges[0].end
      pt_end = vertex.position
      					
      edge2 = entities2.add_line(pt_start, pt_end)
      
      

      how could i ADD the new edge2 to the sel ??? (merge ?)
      is it possible?

      after this the further code should realise sel incl. the new adge2 as USER's SELECTION .

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • UI exit ruby?

      hi,
      is there a function in the UI, where i could

      stop the ruby at this point and exit,

      to check the actual state of elements in sketchup directly?

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: [solved] merging two triangle faces of a mesh-square

      hi tt,
      to finish this topic,
      i learned how to identify a surface and handle its parts (faces) and now i can manupulate its elements, as needed.

      thanx to all in this topic for helping and ttheir ideas.
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Retrievin object's absolute height ??

      hi jolran,

      1. i'll test your new idea later tonight, but i had the formula with origin
      tra = @main_element.transformation.origin
      

      already and it gave me the origin of the group at the point, where it was made, not to absolute [0,0,0]. but we shall see !!

      1. bounding box : i tried this, but i don't need the lowest point of a group, but one special corner within it, so lowest z of the bbox does not help here.
        and when i retrieve the bbox of the nested element, itz again is relative, not absolute.

      seems to be tricky somehow....

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Retrievin object's absolute height ??

      hi tig,
      i understood and made some tests.
      but if i have a group named

      @main_element (i persume it has a transformation, even it is not moved or anything else)
      and say

      tra = @main_element.transformation

      i get errors , since my syntax is wrong.

      could you give me the syntax for retrieving the transformation from a group?

      i tried a lot of ways, but always get errors.

      thank you!
      stan

      edit:
      when i define tra as

      tra = @main_element.transformation.to_a
      

      i get

      tra [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]

      how can i interpret the numbers?

      edit 2:
      when i move a group in Z+, tra becomes

      tra [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1968.503937007874, 1.0]

      so 14th position seems to give the height.

      the problem is, that if i create a plane in a certain height (Z+), the transformation counts this as 0,0,0 .
      pos. 14 changes first, when i move the group from its origin place, where it was created.......this transformation is not related to absolute zero.... 😞

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Retrievin object's absolute height ??

      hi and thanx,
      so if understand right,
      this would sort the array of given points and find out the one with the highest z, right? (nice code, btw).

      so if if i had

      pt1=[0,0,5]
      pt2=[0,0,6]

      it would return zmax = 6 , right?

      my problem is, that when i retrieve points WITHIN a group, i get relative coordinates, not absolute. and since the group has no transformation, i again don't get ABSOLUTE coordinates ( with ABSOLUTE i hope to get the Z-zero of sketchup space, independent of, if the user changes the coordinate-origin (axes).

      maybe there is a way to get ABSOLUTE COORDINATES of any point outside or inside of grous/components?

      regards
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Is an entity in a surface

      @dan rathbun said:

      @artmusicstudio said:

      i am not yet familiar with " keys" etc..... -:)

      Go to the Ruby Resources "Sticky Thread" here:
      RUBY PROGRAMMING REFERENCES

      Get the CHM files for whatever version Ruby your SketchUp is using.
      SketchUp v8, 2013 and earlier uses Ruby 1.8.6
      (some earlier version used Ruby 1.8.5 and 1.8.0, FYI)

      THEN ... lookup the Hash#keys() method

      hi dan, thanx,
      next one to be studied (of still so many....). -:)

      just to be sure of universality (ruby-versions), i run the code always in 2014 and v8 in win7, vista and xp....
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Is an entity in a surface

      @thomthom said:

      Where did you get @surface from?

      hi thomthom,

      the method is

      having a smooth mesh with any loops projected on it and intesect

      selection of one or more surfaces by user and calling the method

      iterating thru selected surfaces

      iteration thru all elements within one of them

      further operation with edges within the surface, especially the smooth ones

      this peace of code for surface works super for me.

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Retrievin object's absolute height ??

      hi,
      i get object's height by

      
      tra = @main_element.transformation.origin
      reference_height = tra[2]
      
      

      but this gives me the vector from the position in space, where the @main_element was created.

      i would like to calculate the height of a defined point (say toppoint of a bbox)
      above absolute sketchup 0,0,0.

      since this is not a transfromation, is there an absolute - z - variable somewhere?

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Is an entity in a surface

      @slbaumgartner said:

      The return is an Array of all the Faces from any surface containing the Face passed as the argument. If the Face is not in a surface, the return will be an empty array.

      hello,
      thanx a lot. yes,

      in the mean time i renamed the array to @surface.keys and got the array back. works perfectly.

      i have to find out, if there is a way to return this array without renaming (return xxxx ???)

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Is an entity in a surface

      hi,
      this seems to be an interesting approach, but
      what is returned by the method?

      is it an array of elements, i can iterate?
      i am not yet familiar with "keys" etc..... -:)

      if this gives back all entities of the "surface", how could i iterate thru it?
      when i try, i get errors,
      thanx
      stan

      @thomthom said:

      <span class="syntaxdefault">def get_surface</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> face </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  surface </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{}</span><span class="syntaxdefault"> </span><span class="syntaxcomment"># Use hash for speedy lookup<br /></span><span class="syntaxdefault">  stack </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault"> face </span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault">  until stack</span><span class="syntaxkeyword">.empty?<br /></span><span class="syntaxdefault">    face </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> stack</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">shift<br />    edges </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">edges</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">select </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|</span><span class="syntaxdefault"> e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">soft</span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">    for edge in edges<br />      for face in edge</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">faces<br />        next if surface</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">key</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault"> face </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">        stack </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> face<br />        surface</span><span class="syntaxkeyword">[</span><span class="syntaxdefault"> face </span><span class="syntaxkeyword">]</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> face<br />      end<br />    end<br />  end<br />  surface</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">keys<br />end<br /></span>
      
      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: A small &quot;entity to group&quot; problem

      hi tig,

      that's fantastic,

      point 2 : solved ( i already though of retrieving the points , but vertices work perfectly!

      for point 1:

      got it working, super. thanx.

      by the way, is there a code for deliting an array of edges directly ? or do i have to iterate thru the array and erase one after another?

      in my case i create a copy of a face in the new group (>> vertices)
      and wantto delete the original entity incl. edges.

      thanx a lot
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • 1 / 1