sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Looking for a report

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 166 Views 2 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.
    • genma saotomeG Offline
      genma saotome
      last edited by

      I have a need to review all the materials used in all of the components. It would be better if the primary sort is by materials but I can make do if the sort is by component instead as what matters most is that it is complete and accurate. It would be ideal if "front face not textured" is there too.

      I would appreciate any suggestions on where I might find a solution that address this need.

      1 Reply Last reply Reply Quote 0
      • genma saotomeG Offline
        genma saotome
        last edited by

        Actually, I can narrow things down quite a bit... this code:

        def GetHighlightFaces(entities, untextured)
        
          count=0
        
          entities.each do |ent|
        
            case ent.typename
        
            when "ComponentInstance"
              count+=GetHighlightFaces(ent.definition.entities, untextured)
        
            when "Group"
              count+=GetHighlightFaces(ent.entities, untextured)
        
            when "Face"
              if not (ent.material and ent.material.texture and ent.material.texture.filename)  and not (ent.back_material and ent.back_material.texture and ent.back_material.texture.filename)
        	ent.material=untextured
        	#ent.back_material=reverse
        	count+=1
              #else
        	#ent.material=reverse if not (ent.material and ent.material.texture and ent.material.texture.filename)
        	#ent.back_material=reverse if not (ent.back_material and ent.back_material.texture and ent.back_material.texture.filename)
              end
        
            end
          end
        
          return count
        
        end
        

        finds any face taht has not been textured and paints it red. If these faces happen to be part of any component, I need to know it's name so I can get in there and either texture the face or delete it. NOT being a ruby programmer, I have no idea how this code could be tweeked to tell me the component name. If someone knows how to do that and would share the code, I'll edit this file and test it.

        Thanks!

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Just noting that you are asking for 2 separate things... the 1st post asks about an "in view report",... the 2nd asks about a tool that would modify model entities.

          I would think that there is already likely to be a plugin, that conditionally applies materials to drawing elements.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @genma saotome said:

            If these faces happen to be part of any component, I need to know it's name so I can get in there and either texture the face or delete it.

            Normally for components and groups that will have ALL of their faces textured the same, you do not individually texture them. Instead you leave them with the default material (ie, nil,) and apply the material to the parent object, and all it's faces with default nil material will be textured.)

            If you need to apply a different material (other than the component's default,) to specific faces, you then overrride the default only for those certain faces.

            So... when you examine a face's material (that is within a group or component,) and it is nil (which in Ruby evals to false,) you must check it's parent to see if there is a material applied, in order to say whether or not it will be textured.

            Seems like you are trying to do things the hard way.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • genma saotomeG Offline
              genma saotome
              last edited by

              @dan rathbun said:

              Seems like you are trying to do things the hard way.

              Nope. I'm doing things "The Game Way". EXPORT the fewest polys, fewest textures, no textures on backfaces, no polys w/o textures. As minimal as possible... applying a texture to a component puts that texture on the backface -- I can't allow that.

              The code I showed, above, was what I use to identify and color untextured polys bright red (written by someone else). If they're big enough, I'll see them and either delete the poly or texture it correctly. 99 out of 100 times, I delete the poly. I need either a report OR a modification of the code I posted, whichever will get me a display/listing of all component/texture assignments. With the information in hand I can go right to the specific component definition and find the problem. W/O it's an ordeal.

              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