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

    Help Faking Ambient Occlusion!

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 3 Posters 498 Views 3 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.
    • renderizaR Offline
      renderiza
      last edited by

      Added the following code to the one above one to make script work on some solid objects that are simple but I need to find a solution that works every time. 😒

       
      znormal = face.normal.z
      if znormal == 1 || znormal == -1
          next
      end
      
      

      Note: Ok the above code is too bad of an idea and will not use it at all.

      [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

      1 Reply Last reply Reply Quote 0
      • renderizaR Offline
        renderiza
        last edited by

        Hi, here is my progress so far...

        
        model = Sketchup.active_model
        sel = model.selection
        ents = model.active_entities
        faces = ents.grep(Sketchup;;Face)
        outer_edge = []
        
        faces.each do |face|
            loop = face.outer_loop
            borders = loop.edges
        
            outer_edge << borders
            outer_edge.flatten!
        end
        
        outer_edge.each do |edge|
            status = sel.contains? edge   
            if (status)
                edge.hidden = false
                sel.remove edge
            else
                edge.hidden = true
                sel.add edge
            end
        end
        
        

        What I need now is to find a way to hide the lines that are facing outward...Any ideas?

        Note Update: I was testing code with non solid objects only and was not aware that it doesn't work with solid objects. 😒 Need to rethink this through again...oh well! πŸ˜’

        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

        1 Reply Last reply Reply Quote 0
        • A Offline
          Anton_S
          last edited by

          @renderiza said:

          What I need now is to find a way to hide the lines that are facing outward...Any ideas?

          Maybe this will help: Highlight edges in profile

          1 Reply Last reply Reply Quote 0
          • renderizaR Offline
            renderiza
            last edited by

            Thank you Anton_S I will take a look at it! πŸ‘

            [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

            1 Reply Last reply Reply Quote 0
            • renderizaR Offline
              renderiza
              last edited by

              Hi, here is another WIP and I am happy with the progress so far. The following code does an ok job with vertical line and now I need to work on horizontal lines.

              Anton_S the code you posted by TIG helpd me find this "faces = edge.faces " which was very usefull so thank you. πŸ‘

              
              model = Sketchup.active_model
              sel = model.selection
              ents = model.active_entities
              edges = ents.grep(Sketchup;;Edge)
              
              edges.each do |edge|
              
                  faces = edge.faces
                  faceone = faces.first
                  facetwo = faces.last
              
                  f1nx = faceone.normal.x
                  f1ny = faceone.normal.y
                  f1nz = faceone.normal.z
              
                  f2nx = facetwo.normal.x
                  f2ny = facetwo.normal.y
                  f2nz = facetwo.normal.z
              	
                  #######################
                  ## NE Vertical Lines ##
                  #######################
                  if f1nx == 1 and f2ny == 1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y < centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
                  if f2nx == 1 and f1ny == 1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y > centertwo.y
                          edge.hidden = true
                      else
              	    edge.hidden = false
                      end
                  end
              	
                  #######################
                  ## SE Vertical Lines ##
                  #######################
                  if f1nx == 1 and f2ny == -1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y > centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
                  if f2nx == 1 and f1ny == -1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y < centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
                  #######################
                  ## SW Vertical Lines ## 
                  #######################
                  if f1nx == -1 and f2ny == -1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y > centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
                  if f2nx == -1 and f1ny == -1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y < centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
                  #######################
                  ## NW Vertical Lines ##
                  #######################
                  if f1nx == -1 and f2ny == 1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y < centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
                  if f2nx == -1 and f1ny == 1
                      boundboxone = faceone.bounds
                      centerone = boundboxone.center
                      boundboxtwo = facetwo.bounds
                      centertwo = boundboxtwo.center
              
                      if centerone.y > centertwo.y
                          edge.hidden = true
                      else
                          edge.hidden = false
                      end
                  end
              
              end
              
              

              If anyone has any suggestions to better my code I am all ears...cheers!

              [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

              1 Reply Last reply Reply Quote 0
              • renderizaR Offline
                renderiza
                last edited by

                WIP - 7/26/2013

                Hi, this is an update to deal with all vertical lines and it should now work 100% of the time. I still need to work of top & bottom horizontal lines but I imaging it should be easier than vertical lines. Ok here is the code so far...

                model = Sketchup.active_model
                sel = model.selection
                ents = model.active_entities
                edges = ents.grep(Sketchup;;Edge)
                
                edges.each do |edge|
                
                    faces = edge.faces
                    faceone = faces.first
                    facetwo = faces.last
                
                    areaone = faceone.area
                    areatwo = facetwo.area
                
                    f1nx = faceone.normal.x
                    f1ny = faceone.normal.y
                    f1nz = faceone.normal.z
                
                    f2nx = facetwo.normal.x
                    f2ny = facetwo.normal.y
                    f2nz = facetwo.normal.z
                
                    #######################
                    ## NE Vertical Lines ##
                    #######################
                    if f1nx == 1 and f2ny == 1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## N ##
                        #######
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        #######
                        ## E ##
                        #######
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                    end
                
                    if f2nx == 1 and f1ny == 1 and
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## N ##
                        #######
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        #######
                        ## E ##
                        #######
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                    end
                
                    #######################
                    ## SE Vertical Lines ##
                    #######################
                    if f1nx == 1 and f2ny == -1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                        #######
                        ## E ##
                        #######
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        #######
                        ## S ##
                        #######
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                         if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                    end
                
                    if f2nx == 1 and f1ny == -1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## E ##
                        #######
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        #######
                        ## S ##
                        #######
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                         if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                    end
                
                    #######################
                    ## SW Vertical Lines ##
                    #######################
                    if f1nx == -1 and f2ny == -1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## W ##
                        #######
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                               edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                               edge.hidden = true
                            end
                        end
                
                        #######
                        ## S ##
                        #######
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                              edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                              edge.hidden = true
                            end
                        end
                    end
                
                    if f2nx == -1 and f1ny == -1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## W ##
                        #######
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                       end
                
                       if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                               edge.hidden = true
                            end
                        end
                
                        #######
                        ## S ##
                        #######
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                              edge.hidden = true
                            end
                        end
                
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                              edge.hidden = true
                            end
                        end
                
                    end
                
                    #######################
                    ## NW Vertical Lines ##
                    #######################
                    if f1nx == -1 and f2ny == 1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## W ##
                        #######
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        #######
                        ## N ##
                        #######
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                        
                        if centerone.y < centertwo.y and centerone.x < centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                    end
                
                    if f2nx == -1 and f1ny == 1
                        boundboxone = faceone.bounds
                        centerone = boundboxone.center
                        boundboxtwo = facetwo.bounds
                        centertwo = boundboxtwo.center
                
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            edge.hidden = true
                        else
                            edge.hidden = false
                        end
                
                        #######
                        ## W ##
                        #######
                        if centerone.y < centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone < areatwo
                                edge.hidden = true
                            end
                        end
                
                        #######
                        ## N ##
                        #######
                        if centerone.y > centertwo.y and centerone.x < centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                        if centerone.y > centertwo.y and centerone.x > centertwo.x
                            if areaone > areatwo
                                edge.hidden = true
                            end
                        end
                
                    end
                
                    ######################################
                    ## Edges with more than three faces ##
                    ######################################
                    if faces[2]
                        edge.hidden = false
                    end
                
                    #########################
                    ## Edges with one face ##
                    #########################
                    if faces[1] == nil
                        edge.hidden = true
                    end
                
                end
                

                [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                1 Reply Last reply Reply Quote 0
                • renderizaR Offline
                  renderiza
                  last edited by

                  Hi, this is another attempt and it seems to be working quite well with the test I have made so far. I am now wondering how to make the code work with faces that are on an angle in respect to the xyz axis. πŸ˜•

                  If anyone has a clue I am all ears...here is the code so far

                  model = Sketchup.active_model
                  sel = model.selection
                  ents = model.active_entities
                  edges = ents.grep(Sketchup;;Edge)
                  
                  edges.each do |edge|
                  
                      faces = edge.faces
                      faceone = faces.first
                      facetwo = faces.last
                  
                      areaone = faceone.area
                      areatwo = facetwo.area
                  
                      f1nx = faceone.normal.x
                      f1ny = faceone.normal.y
                      f1nz = faceone.normal.z
                  
                      f2nx = facetwo.normal.x
                      f2ny = facetwo.normal.y
                      f2nz = facetwo.normal.z
                  
                  	boundboxone = faceone.bounds
                  	centerone = boundboxone.center
                  	boundboxtwo = facetwo.bounds
                  	centertwo = boundboxtwo.center
                  
                  	#############################
                  	## ZN Top Horizontal Lines ##
                  	#############################
                  	if f1nz == 1 and f2ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.y < centertwo.y
                             edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.y < centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.y > centertwo.y
                             edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == 1 and f1ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.y > centertwo.y
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.y > centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.y < centertwo.y
                              edge.hidden = true
                          end
                  	end
                  
                  	#############################
                  	## ZE Top Horizontal Lines ##
                  	#############################
                  	if f1nz == 1 and f2nx == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.x < centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == 1 and f1nx == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.x > centertwo.x
                  				edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	#############################
                  	## ZS Top Horizontal Lines ##
                  	#############################
                  	if f1nz == 1 and f2ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.y > centertwo.y
                             edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.y > centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.y < centertwo.y
                             edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == 1 and f1ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.y < centertwo.y
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.y < centertwo.y
                  				edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.y > centertwo.y
                              edge.hidden = true
                          end
                  	end
                  
                  	#############################
                  	## ZW Top Horizontal Lines ##
                  	#############################
                  	if f1nz == 1 and f2nx == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.x > centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == 1 and f1nx == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.x < centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	######################################
                  	######################################
                  	######################################
                  
                  	################################
                  	## ZE Bottom Horizontal Lines ##
                  	################################
                  	if f1nz == -1 and f2nx == 1
                          boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.x < centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == -1 and f1nx == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.x > centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	################################
                  	## ZN Bottom Horizontal Lines ##
                  	################################
                  	if f1nz == -1 and f2ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.z < centertwo.z and centerone.y < centertwo.y
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.y < centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.y > centertwo.y
                              edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == -1 and f1ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.y > centertwo.y
                              edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.y > centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.y < centertwo.y
                              edge.hidden = true
                          end
                  	end
                  
                  	################################
                  	## ZW Bottom Horizontal Lines ##
                  	################################
                  	if f1nz == -1 and f2nx == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.x > centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == -1 and f1nx == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.x < centertwo.x
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  	end
                  
                  	################################
                  	## ZS Bottom Horizontal Lines ##
                  	################################
                  	if f1nz == -1 and f2ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z < centertwo.z and centerone.y > centertwo.y
                              edge.hidden = true
                          end
                  
                          if centerone.z > centertwo.z and centerone.y > centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z < centertwo.z and centerone.y < centertwo.y
                              edge.hidden = true
                          end
                  	end
                  
                  	if f2nz == -1 and f1ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.z > centertwo.z and centerone.y < centertwo.y
                              edge.hidden = true
                          end
                  
                          if centerone.z < centertwo.z and centerone.y < centertwo.y
                  			edge.hidden = true
                          end
                  
                  		if centerone.z > centertwo.z and centerone.y > centertwo.y
                              edge.hidden = true
                          end
                  	end
                  
                  	######################################
                      	######################################
                  	######################################
                  
                      #######################
                      ## NE Vertical Lines ##
                      #######################
                      if f1nx == 1 and f2ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                  		if centerone.y < centertwo.y and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## N ##
                          #######
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          #######
                          ## E ##
                          #######
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                      end
                  
                      if f2nx == 1 and f1ny == 1 and
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## N ##
                          #######
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          #######
                          ## E ##
                          #######
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                      end
                  
                      #######################
                      ## SE Vertical Lines ##
                      #######################
                      if f1nx == 1 and f2ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## E ##
                          #######
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          #######
                          ## S ##
                          #######
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                           if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                      end
                  
                      if f2nx == 1 and f1ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## E ##
                          #######
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          #######
                          ## S ##
                          #######
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                           if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                      end
                  
                      #######################
                      ## SW Vertical Lines ##
                      #######################
                      if f1nx == -1 and f2ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## W ##
                          #######
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                 edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                 edge.hidden = true
                              end
                          end
                  
                          #######
                          ## S ##
                          #######
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                edge.hidden = true
                              end
                          end
                      end
                  
                      if f2nx == -1 and f1ny == -1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## W ##
                          #######
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                         end
                  
                         if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                 edge.hidden = true
                              end
                          end
                  
                          #######
                          ## S ##
                          #######
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                edge.hidden = true
                              end
                          end
                  
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                edge.hidden = true
                              end
                          end
                      end
                  
                      #######################
                      ## NW Vertical Lines ##
                      #######################
                      if f1nx == -1 and f2ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## W ##
                          #######
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          #######
                          ## N ##
                          #######
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y < centertwo.y and centerone.x < centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                      end
                  
                      if f2nx == -1 and f1ny == 1
                  		boundboxone = faceone.bounds
                          centerone = boundboxone.center
                          boundboxtwo = facetwo.bounds
                          centertwo = boundboxtwo.center
                  
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              edge.hidden = true
                          end
                  
                          #######
                          ## W ##
                          #######
                          if centerone.y < centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone < areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          #######
                          ## N ##
                          #######
                          if centerone.y > centertwo.y and centerone.x < centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                  
                          if centerone.y > centertwo.y and centerone.x > centertwo.x
                              if areaone > areatwo
                                  edge.hidden = true
                              end
                          end
                      end
                  
                      ######################################
                      ######################################
                      ######################################
                      ######################################
                  
                      ######################################
                      ## Edges with more than three faces ##
                      ######################################
                      if faces[2]
                          edge.hidden = false
                      end
                  
                      #########################
                      ## Edges with one face ##
                      #########################
                      if faces[1] == nil
                          edge.hidden = true
                      end
                  	
                      #######################
                      ## Edges inside face ##
                      #######################
                      if f1nz == 1 and f2nz == 1
                          edge.hidden = true
                      end
                      
                      if f1nz == -1 and f2nz == -1
                          edge.hidden = true
                      end
                      
                      ###
                  
                      if f1nx == 1 and f2nx == 1
                          edge.hidden = true
                      end
                  
                      if f1nx == -1 and f2nx == -1
                          edge.hidden = true
                      end
                  
                      ###
                  
                      if f1ny == 1 and f2ny == 1
                          edge.hidden = true
                      end
                  
                      if f1ny == -1 and f2ny == -1
                          edge.hidden = true
                      end
                  
                  end
                  

                  [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                  1 Reply Last reply Reply Quote 0
                  • renderizaR Offline
                    renderiza
                    last edited by

                    If anyone is interest I updated the code above with much better one...cheers!

                    [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      cleblanc
                      last edited by

                      I would be interested. Could you post the new version?

                      Thanks!

                      Chris

                      1 Reply Last reply Reply Quote 0
                      • renderizaR Offline
                        renderiza
                        last edited by

                        I still plan to keep working on this and will post future progress. The best case scenario will be to make it work on faces that have angle...so far my attempts have failed in solving this but will keep trying.

                        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

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

                        Advertisement