sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    How do you move vertices?

    Scheduled Pinned Locked Moved Developers' Forum
    24 Posts 4 Posters 1.1k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      @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 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        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 Reply Last reply Reply Quote 0
        • T Offline
          todd burch
          last edited by

          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 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            Ahh, very helpful, thanks again Todd,

            Chris

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

            1 Reply Last reply Reply Quote 0
            • 1
            • 2
            • 2 / 2
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement