sketchucation logo sketchucation
    • 登入
    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

    How do you move vertices?

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    24 貼文 4 Posters 1.7k 瀏覽 4 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Chris FullmerC 離線
      Chris Fullmer
      最後由 編輯

      @unknownuser said:

      I would like to see .pushpull return an array of newly created edges and faces, with the opposite face listed first.

      That would be great.

      That makes sense to compare and subtract, then find the leftover entity with the normal that matches the original face. That did not cross my mind to search that way. Thanks guys! I'll post it when I get it written (probably after work or during lunch).

      @unknownuser said:

      @Chris - a terminology thing: we're not dealing with "names" of faces. We're dealing with Object References.
      Oops, I'll work on my terminology 😄

      Chris

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

      1 條回覆 最後回覆 回覆 引用 0
      • Chris FullmerC 離線
        Chris Fullmer
        最後由 編輯

        ok, here is the code I put together based on your guys comments. It gets all geometry before pushpulling, then all geometry after pushpulling and does a subtraction, leavin just the new stuff. Then searches through that for a face with a normal == to the original face's normal. Thanks for the help on this. Now I can do a uniform scale on the new face. So I'll incorporate it all into my greeble script later today I hope. Thanks!

        model = Sketchup.active_model
        entities = model.selection
        # Initialize my Arrays
        existing_ents = []
        current_ents = []
        new_ents = []
        # Define existing entities and then push.pull my face
        existing_ents = entities[0].all_connected
        entities[0].pushpull( 100, true)
        # Define all entities after the push.pull
        current_ents = entities[0].all_connected
        # Define new entities through subtraction
        new_ents = current_ents - existing_ents
        # Loop through each new entity to find the faces, 
        # then find just the face with its normal matching the original face
        # Send a quick text to the Ruby console and paint the face to show it worked
        new_ents.each do |ent|
        	if ent.typename == ( "Face" )
        		if ent.normal == entities[0].normal
        			puts "Found it!  The Object Reference is " + ent.to_s
        			ent.material = [0,0,0]
        		end
        	end
        end
        

        This script requires having a single face selected when the script is run.

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 條回覆 最後回覆 回覆 引用 0
        • T 離線
          todd burch
          最後由 編輯

          For your playing around with stuff like this, (and I encourage it), here's a tip. Instead of this:

          
          entities = model.selection
          .
          .
          existing_ents = entities[0].all_connected
          
          

          Do this, and it's less typing:

          
          entity = model.selection[0]
          .
          .
          existing_ents = entity.all_connected
          
          

          That way, you get rid of the array reference early and no more qualifying every use with [0].

          For short stuff (shorter than this), I just use the console.

          1 條回覆 最後回覆 回覆 引用 0
          • Chris FullmerC 離線
            Chris Fullmer
            最後由 編輯

            Ahh, very helpful, thanks again Todd,

            Chris

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 條回覆 最後回覆 回覆 引用 0
            • 1
            • 2
            • 2 / 2
            • 第一個貼文
              最後的貼文
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement