sketchucation logo sketchucation
    • Login
    1. Home
    2. niccah
    3. Posts
    ⚠️ Attention | Having issues with Sketchucation Tools 5? Report Here
    N
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 18
    • Posts 90
    • Groups 1

    Posts

    Recent Best Controversial
    • Multithreading - Queue?!

      Hey!

      I started to get some experience in multithreading in ruby. It's very interesting!

      Problems, which I want to solve with MT is: Cross THE line A face....

      so I have lots of faces (lets say 16) and I have 4 CPUs - so I decided "by hand" that every CPU gets 4 faces to check.
      But I want to write a queue for the thread - I think this should be a better performance.

      With the help of google I found for example this page: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/thread/rdoc/Queue.html#method-i-pop

      But there is written: require 'thread' => but I haven't this file and I can find it nowhere

      Do you have any experience to use queues in Ruby?

      Thanks again for your help!

      posted in Developers' Forum
      N
      niccah
    • RE: Group the selected entities and give them a name[Solved]

      @dan rathbun said:

      In the index for [Code Snippets] by Subject there is this entry:

      Copy selection to new group?

      absolutely perfect! That's it!

      Thanks a lot!

      Just for other interested people:

      
      model = Sketchup.active_model
      selection = model.selection.to_a
      	
      group = model.active_entities.add_group(selection)
      group.name = "result"
      
      
      posted in Developers' Forum
      N
      niccah
    • Group the selected entities and give them a name[Solved]

      I want to automate following event with a script:

      I group the selected entities, right click: "Elementinformation" and enter a name like "result"...

      So, that's what I already have:

      
      model = Sketchup.active_model
      selection = model.selection # all the selected entities
      
      

      Now I want to add a group, give them a name and add "selection" to the group:

      
      group = model.add_group
      group.name = "result"
      group.entities. ... (?)
      
      

      How can I add the "selection" to that group? It tried a lot, but without success 😞

      Do you have a tip what can I do?

      Thanks a lot for your help!

      posted in Developers' Forum
      N
      niccah
    • RE: Min. z value of some points

      This forum is amazing!

      I learn a lot from you! Thanks a lot for all these information!

      posted in Developers' Forum
      N
      niccah
    • RE: Min. z value of some points

      oh thank you very much!

      I saw the function "inject", but I ignored them because I thought, that's not interesting for me.

      Just for the sake of completeness: One have to add a "Geom::" in the front of "BoundingBox.new"

      Thanks a lot again for your help!

      br

      posted in Developers' Forum
      N
      niccah
    • Min. z value of some points

      Hi!

      I have lots of 3D points: points = [[1, 2, 3], [2, 3, 5], ...]

      Is there a easy way to get for example the minimum z value of all these points in Ruby?

      At the moment I have a points.each loop and compare every z value with the last one....

      Thanks for your help!

      posted in Developers' Forum
      N
      niccah
    • RE: Global vertex position fails, when I pull a face

      @thomthom said:

      Hang on....

      I think I might see what causes what you describe... you're not obtaining global coordinates at all. You're just looking at the local coordinates. You need to apply the transformation of the parent entities to the Point3d object.

      When you then change the geometry in your group, you then offset it bounding box, affecting the coordinates. (If I understand this all right)

      global_position = vertex.position.transform( parent_transformations )

      Uhh jeah - I think that's the point I looked for! I didn't know that I can transform the position it self - but that's exactly that I want!

      Thanks a lot!

      And thanks for all your tips for optimizations!

      posted in Developers' Forum
      N
      niccah
    • RE: Global vertex position fails, when I pull a face

      @thomthom said:

      There is nothing that guaranties that the entities and vertices will be returned in the same order after the model has been modified.

      Yes, you're right and I know that - I just compared the minimum of (for example) y values.... at the beginning it should be 0 for some verticies. I pull a face and then the minimum of y is (for example) -10.

      @thomthom said:

      btw, on a side note - .typename is a terrible performance killer. For more information: http://www.thomthom.net/thoughts/2011/12/never-ever-use-typename/

      Oh, thanks a lot! I didn't know that! That's a great info! I will adjust my code.

      posted in Developers' Forum
      N
      niccah
    • RE: Global vertex position fails, when I pull a face

      @thomthom said:

      Hard to tell what is going on here without seeing any code.

      But you are aware that then you open a group of component its coordinated are transformed into world coordinates automatically by SU?

      Okay, sorry, here more explanations with code:

      
      model = Sketchup.active_model
      groups = model.entities
      result = groups[0]
      
      UI.messagebox result.transformation
      
      entities = result.entities
      face = Array.new
      		
      # read all faces
      i=0
      entities.each do |tmp|
      if tmp.typename == "Face"
      	if tmp.normal[2] != 0
      		face[i]=Face.new(tmp)
      		i+=1
      	end
      end
      end
      
      

      And the class for faces:

      
      class Face
      	def initialize(face)
      		
      		vertices = face.vertices
      		
      UI.messagebox vertices[0].position
      	end
      end
      
      

      Now I start the code... everything is okay....
      then I pull a face manually in Sketchup and start the code again... every verticies has a different NOT GLOBAL position.

      I hope I could help you to understand my problem πŸ˜„

      Thanks a lot for your help!

      posted in Developers' Forum
      N
      niccah
    • Global vertex position fails, when I pull a face

      Hi!

      I have a problem with the global vertex positions....

      Initial situation:

      • a group with different faces inside
      • to get the global positions of the single verticies: group.transformation + vertex.position

      up till now: everything is fine...

      now I pull a face - the group gets larger - group.transformation changes.... AND the moved verticies get a NEGATIV value.

      Is there an easy possibility to "rearrange" the verticies? If not, I have to go over all verticies - get the smallest value and rearrange each value.

      Thanks a lot for your help!

      posted in Developers' Forum
      N
      niccah
    • 1
    • 2
    • 3
    • 4
    • 5
    • 5 / 5