sketchucation logo sketchucation
    • Login
    1. Home
    2. ManuelB
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 9
    • Groups 1

    ManuelB

    @ManuelB

    10
    Reputation
    1
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    ManuelB Unfollow Follow
    registered-users

    Latest posts made by ManuelB

    • Find the position of a specific vertex on a face.

      Hello, ๐Ÿ˜„

      The method below shows the x, y,z positions of all vertices at the beginning of edges for a selected face.

      Sketchup.active_model.selection.grep(Sketchup;;Face).each{|f|f.edges.each{|e|p e.start.position}}
      

      I wish to know the position of the vertex down right side for a selected face?

      https://i.imgur.com/JTUT9u3.png

      The goal is to find this vertex even if the face is tilted or drawn in any direction.

      It's been a while since I study the class "Edges" and "Faces" in the API without success.

      Thanks for your help.

      Manuel

      posted in Developers' Forum
      M
      ManuelB
    • Create a component from a selected face.

      Hello everyone ๐Ÿ˜„

      I want to write a ruby code that allows you to create a component in "Glue to = Any" from a selected face.
      If possible the axis towards must go towards the top and the red axis over the width.

      https://i.imgur.com/iOGpFs1.png

      The face must be removed to leave the component in SketchUp.

      Your help writing this method would be very appreciated.

      Thank you in advance.

      Manuel

      posted in Developers' Forum
      M
      ManuelB
    • RE: Subtract the selection of edges

      @tig said:

      http://ruby.sketchup.com/Sketchup.html# ... ass_method
      List the common 'strings' and also the PC only send_actions.

      Yes I saw indeed!

      Before coming to post my questions I did some research and I found all the "send_actions" in this TOPIC.

      To avoid problems, I prefer not to use "send_actions".

      How can you copy the faces and edges of a component and paste in place them on the outside of the component ?

      Code is very complicated for me to write without the "send_actions".

      Thank you

      Manuel

      posted in Developers' Forum
      M
      ManuelB
    • RE: Subtract the selection of edges

      Thank you TIG, your method works perfectly. ๐Ÿ‘

      @tig said:

      In your example, posted before my last one, the code will fail because when you explode the instance any reference to the definition's own faces will be lost - but the explode itself returns an array of the new faces that have resulted from the explode...

      I understand! Your code is a perfect example of how to recover faces after the explode method.

      @tig said:

      I wouldn't rely on send_action, the numerical ones only apply on PCs anyway.

      I did not know! This can then cause problems in other methods that I have written.
      How will you "copy / paste in place" a component being selected without using "send_action"?

      I do not know how to do otherwise than this method:

      
      Sketchup.send_action CMD_COPY
      Sketchup.send_action 21939
      
      

      Thanks for your help.

      posted in Developers' Forum
      M
      ManuelB
    • RE: Subtract the selection of edges

      I tried this code and it still does not work:

      array = []
      mod = Sketchup.active_model
      sel = mod.selection 
      sel.grep(Sketchup;;ComponentInstance).each do |s|
        s.definition.entities.grep(Sketchup;;Face).each do |f| 
          array << f
        end
        s.explode
      end
      sel.add(array)
      p array  
      
      

      The "Entity Info" window indicates that faces are selected, while on the SketchUp scene nothing is selected.

      It's too strange for me!

      Thanks for your help.

      Manuel

      posted in Developers' Forum
      M
      ManuelB
    • RE: Subtract the selection of edges

      I just realized that there is a problem!

      My ultimate goal is to write a code that explodes a component and then selects all the faces.

      To explode a component I use this method:

      Sketchup.send_action 21111
      

      To select faces, I use your TIG method.

      All works well if I use these codes in 2 steps.

      If I want to combine the 2 codes in the same method, nothing works! ๐Ÿ˜ฎ

      
      Sketchup.send_action 21111
      model = Sketchup.active_model
      ss = model.selection
      faces = ss.grep(Sketchup;;Face)
      ss.clear
      ss.add(faces)
      
      

      Do you know what for and how to get around the problem?

      Thank you

      posted in Developers' Forum
      M
      ManuelB
    • RE: Subtract the selection of edges

      Yes it's exactly that TIG. ๐Ÿ‘
      I thank you very much!

      posted in Developers' Forum
      M
      ManuelB
    • RE: Subtract the selection of edges

      Hello TIG,

      I just want to deselect the edges to keep only the selected faces.
      I hope it's more understandable now.

      Thank you

      posted in Developers' Forum
      M
      ManuelB
    • Subtract the selection of edges

      Hello, ๐Ÿ˜„

      I am a beginner in ruby and I need your help to write a method.

      For example:

      • I draw a cube.

      • I select all. (The faces and edges of my cube are selected.)

      How to write a simple code that allows you to subtract the edges of the selection?

      Thanks for your help

      Manual

      posted in Developers' Forum
      M
      ManuelB