sketchucation logo sketchucation
    • Login
    1. Home
    2. michaelazer
    3. Topics
    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!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 15
    • Groups 1

    Topics

    • M

      Draw shapes in a shape

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      152 Views
      TIGT
      Sorry we muddle you with using edge/line - I always meant 'edge' - never 'line' as in "[point,vector]". Can you at least work out the bounds of what's been made ? Then add some grouped faces with it... Then we can talk again about trimming/not-overlapping them with your edges collection
    • M

      Count Certain Shapes

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      8
      0 Votes
      8 Posts
      259 Views
      TIGT
      @michaelazer said: Thanks, TIG. I think I mixed up with the logic of Sketchup. (1) Does count=faces.length count all faces on the screen OR in the array I made? It's 'faces' in the array you have made - so it counts just the faces that match your pattern. (2) If a user deletes a face manually, will it be removed from the array? OR only from the screen? When a users erases a face it vanishes from the model's entities collection. If you have made the array of faces before the deletion then the now deleted face is still counted - because the array is a list of faces that matched the pattern at the moment the list was made... You can check for each face's 'validity' before 'counting' thus: count=0; faces.each{|face|count+=1 if face.valid?} Now 'count' only includes 'valid' [i.e. NOT-deleted faces. Again this is dependent on the moment you make the count. The array 'faces' includes all matching faces at the moment the list is made. The 'count' is now the number of valid faces within that array [they were check to be 'matching']. If the user erases another face after the count is made you are again 'out of step'. Similarly if additional matching faces are added after the matching 'faces' array is compiled the list is incomplete. It's easy enough to have some code to compile a list of matching faces and count valid ones at various stages of your tool's use, just remember to do it at the appropriate moment to avoid having out of date information in the array or count...] (3) If the answer to (2) is "only from the screen" does this mean that if I re-draw the array, will the shape that the user deleted get re-drawn? Thanks, again.The array is only a list of faces that match your pattern. You can't 'redraw the array' as it's a list of references to faces only. If a face is deleted from the model you can no longer access its information as it no longer exists. If you mean 'remake' the array you can just rerun the code (remembering to empty the array first with faces=[]), and the new list will no longer include the face that was erased. If you want to remember faces even if they are gone you can make an array of say 'face_points' and later use those to recreate a missing face... this is porbably more complex than you want... for each face face_points=[]; face.vertices.each{|v|face_points<<v.position}
    • M

      Save coordinates in an array

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      17
      0 Votes
      17 Posts
      683 Views
      M
      Thank you so much, Dan. Your tips solved the problem. Now, I have the program running, but I don't get the correct coordinates. I was expecting to get some positive and some negative, according to where I am from the axes. I clicked the 4 corners of the screen and I got the following, which doesn't look right: @unknownuser said: x: 46 y: 48 z: 48 x: 53 y: 52 z: 46 x: 54 y: 57 z: 46 x: 52 y: 46 z: 56
    • 1 / 1