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
    • A small "entity to group" problem

      hi,
      i wopuld be greatful for a small tip:

      i have a @main_element,
      which contains some faces

      when i iterate thru the entities, i can check the normal, see the top face and push pull

      i also can create a new group within the @main_element-container and put an edge in it.

      buit when i want to put one of the @ main_element's entities (here it is a face) into this new group,
      i get a "parent" problem, which i don't understand:

      
      
      @selection.each { |entity|
      	
      		if entity.is_a?(Sketchup;;Face) 
      		
      			check_normal_for_horizontal(entity) #my own method
      			puts @bgf_count_normal # 1 is face top
      			if @bgf_count_normal == 1
      				puts "---FACE UP ... IN MAIN-ELEMENT"
      				#			
      				entities = @main_element.entities
                                      #
      				group = entities.add_group
      				entities2 = group.entities
      				point1 = Geom;;Point3d.new(0,0,0)
      				point2 = Geom;;Point3d.new(2000,200,200) #works
       				edges = entities2.add_edges point1, point2
      				#
      				#			
      				loop = entity.outer_loop # does not work
      				edgearray = loop.edges
                                      floor = entities2.add_face(edgearray)
                              end
                       end
                       }
      
      

      why does the new face from edgearray not appear in the group?

      info from console:

      ###############
      ---FACE UP ... IN MAIN-ELEMENT
      Error: #<ArgumentError: Edge has different parent>
      C:/Program Files (x86)/SketchUp/SketchUp 2014/Tools/02.rb:959:in `add_face'
      ################

      thanx
      stan

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

      hi,

      in my project i iterate thru selected elements and separate

      edges
      faces
      groups
      components

      but

      when i select a square from a sandbox-mesh, my group info shows not FACE , but (german) "Oberflaeche", which is something like "surface" or "plane???".

      now the question is, how can i "filter" it in an iteration ( >> if innerface.is_a?(Sketchup::?????),

      because otherwise this square is regarded as two faces (2 triangles).

      i have to delete the smooth-diagonal to get a clear face for my further operations.

      so:

      is there a way, how to identify this kind of SURFACE ?

      thanx
      stan


      140701-a.png


      140701-b.png

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Array.uniq! for a 3d-point array ???

      hi tig,
      your last question was the solution. i needed an hour and two coffies....

      instead of duplicating all startpoints of face edges in a certain height and then creating new edges between them (which caused the problem, when more lines met in one point >> doubled startpoints)

      i just draw the bottom line and its pendant in height "x" directly in the method and place them into another group.

      but anyway: your line for clearing the array is fantastic, although i had the problem, that there was no controll over which of the identical point is deleted and so the result face sometimes was missing a point. but i will study this later.

      so thanx for helping and the advice ! the OTHER WAY seems to work.

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Array.uniq! for a 3d-point array ???

      hi,
      i cannot find the syntax for

      arry.uniq!,

      where the array contains some 3d-points and i have to delete the identical 3d-point from it.

      the array in the ruby-console:

      show array:

      
      roof.each { |e|
      puts e
      	}
      
      

      result:


      (-503,8105m, 0m, 8,999982m)
      (-503,8105m, -57,150823m, 8,999982m)
      (-583,560407m, -92,554593m, 8,999982m)
      (-583,560407m, -92,554593m, 8,999982m)
      (-583,560407m, -59,804506m, 8,999982m)
      (-503,8105m, 0m, 8,999982m)


      roof.uniq!

      does not work.

      zhanx for tips!
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: [solved] &quot;movin&quot; group into another group (in ruby)

      hi,
      thanx! work like a dream,
      as soon as i found out, that a

      ng - group must be created before calling the method, then it moves both groups into it.
      fantastic!

      THANK YOU !!!!!
      stan

      result:

      
              g0 = @group_floors #COMES FROM ANOTHER METHOD
      	g1 = @facade_group #COMES FROM ANOTHER METHOD
      	ng = model.entities.add_group
      	self.insert(ng, g0, g1)
      
      
      ##***************************************************************************
      def self.insert(ng, g0, g1)
      ##***************************************************************************
      ng.entities.add_instance(g0.entities.parent, g0.transformation)
      ng.entities.add_instance(g1.entities.parent, g1.transformation)
      g0.erase!
      g1.erase! 
      #ng.name = "master house group created"
      count = 1
      entities3 = ng.entities
      entities3.each { |entity|
      if entity.is_a?(Sketchup;;Group)
      entity.explode if count == 1 #SO GROUPS ELEMENTS ARE AGAIN AT LEVEL 1, as needed
      count =  count + 1
      end	
      		}
      end
      
      
      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: [solved] submenue in a submenue ??

      got it!

      thanx, works perfectly...

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • [solved] submenue in a submenue ??

      hi,
      i went thru the api and forum,
      but did not find a clear syntax for a 2nd level submenue:

      plugins

      ruby

      submenue

      sub_submenue

      i know from ather rubies, that it is possible. but how?

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: [solved] &quot;movin&quot; group into another group (in ruby)

      hi mitcorb,
      very kind from you, but i know the solution in skp itself,
      what i need is a solution in ruby, i just cannot get the group entities into another group..

      but thanx a lot !!!!
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • [solved] &quot;movin&quot; group into another group (in ruby)

      hi,
      after hours of trying and searching i have to ask:

      when i have 2 different groups at level 1 in the drawing,

      how can i

      a. "move = insert" group 1 INTO group 2

      b. insert them both into a GROUP 3

      i tried everything i found , but no chance..

      probably i just need a snall kick to understand the syntax, how the structure is and how elements can be transfered.

      thanx

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: [solved] a simple UI.inputbox problem

      hi tig,
      understood and done, works perfect,
      the combi-version is very nice and confortable and i can pass arguments to it from any method.
      you will then see it in the finished ruby!
      thanx a lot for the explanation.
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Retrieve a value from status bar input box

      hi tig,
      thanx,
      at the moment i have a problem with understanding the tool activation and the activation the VCB

      ( >> http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=52825%26amp;p=480058%26amp;hilit=activate+vcb#p480058)

      in the api the explanantion is still not quite clear to me... t take time
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • [solved] a simple UI.inputbox problem

      hi,
      just a simple UI.inputbox-problem:

      why does this simple method not work?

      
      #***************************************************************************
      def one_value_input
      #***************************************************************************
      get_single_value ["a"],["b"],["c"]
      end#def
      
      #***************************************************************************
      def get_single_value (prompts, defaults, headline)
      #***************************************************************************
      
      puts prompts #>>> puts a
      puts defaults #>>> puts b
      puts headline #>>> puts c
      input = UI.inputbox(prompts,defaults,headline)
      end#def
      
      

      the picture shows, what comes from it....no idea, why ! (and the "c" appears in the pulldown ....

      thanx
      stan


      xxx.png

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Delete a mesh square diagonal edge (hidden) ?

      hi tt_su,
      super, soft & smooth helps to identify. it works. the selected field of mesh is tranfered to a single face (i work with selection).
      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Moving a compo-instance by z

      hi,

      i have a component-instance somewhere in space and i want to copy it in vertical direction.

      how can i say to the transformation, that the movement is only Z and in the position of the original component?
      (the position comes from a mouse-selection, so is not pre-calculated, but given...)

      the transformation allows to input a 3d point [0,0,height_delta],
      but i cannot retrieve the x,y of the original component ....

      
      my_component = group.to_component
            defn = zf_component.definition
      	#defn.name = "name"
      						
      		for groupcopy in 1..my_amount
      						
      		edge = model.entities.add_line([0,0,0],[0,0,@height*groupcopy])
      		vector = edge.start.position.vector_to(edge.end.position)
      		distance = edge.length
      		vector.length = distance
      		toppoint_1 = [0,0,@height*groupcopy]
      		nullpoint = [0,0,0]
      	        toppoint_2 = vector[1]
      						
      	componentinstance =
      	entities.add_instance(defn, [ 0,0,0]) # ???? HOW TO DEFINE THE POSITION OF THE ORIGINAL COMPONENT-DEFINITION TO BECOME A COPY AT THE SAME POSITION ???
      				
      	new_transformation = Geom;;Transformation.new([ 0,0,@height*groupcopy])
       	componentinstance.move! new_transformation
      
      

      thanx
      stan


      Zwischenablage01.png

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Delete a mesh square diagonal edge (hidden) ?

      hi,
      i would like to delete teh diagonal in one nesh field of a mesh created by the sandbox,

      to become one squer face with one face.

      is it possible (for co-planar mesh-triangles only, of course)

      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Retrieve a value from status bar input box

      hi,
      in this topic i found the basic code for retrieving an user input.

      http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=9828

      but i don't know, which arguments are to be sent to the method
      and which is the return value.

      i would like to implement a numerical input in form

      value 1 , value 2, value 3 (where user puts in 1,5,2 with commas),

      at the position in my code, where one face is selected

      and the input controlls further operations.

      i would liek to use the status bar input instead of the UI.messagebox.

      thanx in advance for ideas!

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • [solved] moving selected entity (entities) to a new group

      hi,
      i went thru so many topics and the ruby api, but i cannot find the logic for

      • selecting a face per mouse

      • moving / transforming / whatever THIS SELECTION to a defines group , i just created

      how can this be achieved? is it a transformation or an add-function?

      thanx a lot, i just stick in place...

      stan

      edit:

      found this one at least ..... thanx scethcucation !

      http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=34426

      szan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Text variable within a component?

      hi dan,
      yes, i understand.
      i solved the problem with the following solution:

      the component-related text is placed outside
      and with every calculation per ruby it is selectively deleted and placed with new parameters
      at the new components position.

      seems to work well.

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • Text variable within a component?

      hi,
      is there a ruby-variable, which can show

      the NAME OF THE COMPONENT-INSTANCE

      even when the text (=variable) is placed within the component definition?

      i would like to achieve, that the name of the instance (unique, while created by my ruby, is displayed thru my ruby-script,
      but the text always is moved with the component by the user (it "sricks" to it),

      but i don't want to create a group 'around' them.

      is there any solution for that idea?
      thanx
      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • RE: Retrieving bounding-box-value from a component instance ?

      hi dan,i willk take a look at it.
      yes, i was searching in the forum in the mean time a lot and found a topic from 2009 whit good ideas.
      i can now identify the component instance and retrieve its own height, especially when it is nested.
      there are still some minor problems , but the ruby returns the informations needed now.

      thanx for helping me!

      stan

      posted in Developers' Forum
      artmusicstudioA
      artmusicstudio
    • 1 / 1