sketchucation logo sketchucation
    • Login
    1. Home
    2. BillW
    3. Posts
    ⚠️ Attention | Having issues with Sketchucation Tools 5? Report Here
    B
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 33
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [Req] Texture Corrector.... PLEASE

      Thomthom

      Feel free to parcel up the code.

      Regards

      Bill Wood

      posted in Plugins
      B
      BillW
    • RE: Small Problem-Thumbnails Dysfunctional

      I think what happens makes sense because the thumbnail is retrieved from the Plugins folder
      (file "config-thumb.jpg"). I guess the thumbnail is generetaed on the fly so one session may affect another session.

      posted in Dynamic Components
      B
      BillW
    • RE: [Req] Texture Corrector.... PLEASE

      I dont know if this is of any use - a ruby I call via the ruby console with load "<filename>"
      after selecting the faces I want to work on.

      What it does is set the front face (of selected faces) to have the same material and texture mapping as the back face. It worked for me with a particular problem I had in which an imported image I exploded and did a pushpull - the top face didnt show the texture map - it was on the other side ie back face.
      Reapplying the material didn't do the trick as the image had been scaled on import. For your situation
      the code will need to changed ie

      get_back_UVQ to get_front_UVQ
      ent.material = ent.back_material to ent.back_material = ent.material

      
      model = Sketchup.active_model
      tw = Sketchup.create_texture_writer
          
      model.selection.each { | ent | 
        case ent.typename
          when "Face" then
      
      # sets front material and mapping as back material
      
           ent.material = ent.back_material
            uvHelp = ent.get_UVHelper(true, true, tw)
      
            pt_array = []
            
            numint = (ent.outer_loop.vertices.length / 4).floor
      
            vert = ent.outer_loop.vertices[numint-1]
            uvq = uvHelp.get_back_UVQ(vert.position)
            pt_array.push(vert.position,uvq)
      
            vert = ent.outer_loop.vertices[(numint*2) - 1]
            uvq = uvHelp.get_back_UVQ(vert.position)
            pt_array.push(vert.position,uvq)
      
            vert = ent.outer_loop.vertices[(numint*3) - 1]
            uvq = uvHelp.get_back_UVQ(vert.position)
            pt_array.push(vert.position,uvq)
      
            vert = ent.outer_loop.vertices[(numint*4) - 1]
            uvq = uvHelp.get_back_UVQ(vert.position)
            pt_array.push(vert.position,uvq)
      		  
           ent.position_material ent.material,  pt_array , true # Set front coords
      
        end
      }
      
      
      posted in Plugins
      B
      BillW
    • Math functions and SU7

      I just noticed while testing some of my SU6 plugins that there is a problem with the inbuilt Ruby Math functions. If I type the following into the Ruby console I get an error:

      tan(20)
      Error: #<NoMethodError: (eval):56: undefined method `tan' for main:Object>
      (eval):56
      Math::tan(20)
      2.23716094422474

      tan(20) works with SU6

      Can someone confirn this

      posted in Developers' Forum
      B
      BillW
    • RE: Component Attributes - ImageURL

      Thanks Remus

      I finally figured it out. Instead of using back slash \ - use forward slash / in the path name.
      ie C:/seat.jpg I assume the forward slash option covers Mac pathnames.

      The image gets scaled to fit the Component Options - image slot 130 x 85 pixels
      So you just need to get the image ratio correct.

      For Google Sketchup guys
      It would be nice if there was a way of clicking on the Component Options - image which could take you to a manufacturers web site. Perhaps a new parameter Form Design > URL

      Although, it looks like (from the docs) an URL can be embedded in the description/summary fields with
      <a href="http://www.google.com">

      posted in Dynamic Components
      B
      BillW
    • Component Attributes - ImageURL

      Just out of interest - has anyone got the Component Attributes>Form Design - parameter ImageURL to work?

      Not sure if this is to display a web page link or whether it can be used to display a photo (ie image).
      I added a reference to a jpeg from a sub folder and finally from local disk C:\seat.jpg to no avail.
      No image in the Component Options dialog. I even checked if the Components palette displayed the image.
      I also checked the file suffix .jpg

      Even tried out of desperation a link to http://www.google.com Nothing happened.

      Any ideas?

      Thanks

      posted in Dynamic Components sketchup
      B
      BillW
    • RE: Escalating problems

      My feeling is that you might have problems getting an escalator to work as a DC, to many variables to make the escalator fully parametric.

      Although more for the Ruby forum:
      I already have an escalator plugin which displays the setout dynamically as you go for flr/flr height, width and number of lead in steps. What I want from Sketchup is a way of tapping into the DC dialogs to set parameters but using my ruby code to draw the escalator.

      Any thoughts from the guys at Google?


      escalators 2.JPG

      posted in Dynamic Components
      B
      BillW
    • RE: Change axes from ruby

      Hi NewOne

      It looks like I misunderstood what you were after.

      I thought you wanted to change the Sketchup Axes before placing a component ie the orientation of a placed component is determined by the current axes orientation. There is no method for changing the axes as far as I am aware.

      This statement invokes the Axes tool which allows the user to set the axes orientation prior to next call

      Sketchup.send_action("selectAxisTool:")

      The place_component method places a component "modcomp" in the Model using the component placement tool.

      status = Sketchup.active_model.place_component modcomp, false

      Apologies for the confusion.

      posted in Developers' Forum
      B
      BillW
    • RE: Change axes from ruby

      The way I got around the problem in one of my tools was to call the axes tool as shown below

      Sketchup.send_action("selectAxisTool:") if @rotate
      status = model.place_component modcomp, false

      Regards

      Bill Wood

      posted in Developers' Forum
      B
      BillW
    • RE: Geom point_to_polygon_2D - does it exist

      Thanks Todd

      I just checked the docs and I should have looked a bit closer rather than doing a straight copy.
      A bit of word blindness going on - my apologies.

      posted in Developers' Forum
      B
      BillW
    • Geom point_to_polygon_2D - does it exist

      I thought I would try Geom point_to_polygon_2D
      to test if inside a face outer loop.

      I copied and pasted from the ruby documentation ----- Geom.point_to_polygon_2D
      and got the response on running my ruby

      Error: #<NoMethodError: undefined method `point_to_polygon_2D' for Geom:Module>

      I even tried Geom::point_to_polygon_2D

      I checked the geomtests.rb test file and the test method "pointToPolygon2DTest" was empty

      Does the point_to_polygon_2D method exist under a different name??
      If not, is there any ruby code available anywhere that performs the same check.

      Thanks in advance

      BillW

      posted in Developers' Forum
      B
      BillW
    • RE: Making a copy of a face with holes

      Thanks Fredo6

      I knew I had to work with loops but wasnt sure of what to do.
      I have now found an example of how to do this in Didier's double_rectangle.rb tool

      Thanks again

      posted in Developers' Forum
      B
      BillW
    • Making a copy of a face with holes

      I am writing a tool that initially has a set of selected faces.
      I want to make a copy of each selected face modifying each vertex to a zero height, applying a pushpull and adding to a group. The problem I have got is there doesnt seem to be a copy method for a face as there is for a group. Not even a clone method.

      I have found a way around with the following code

      facepts = curface.vertices.collect { | vert |
      pt = vert.position
      pt.z = 0
      pt
      }
      newface = grp.entities.add_face facepts

      The problem with this solution is that it doesnt handle holes in faces.

      Has anyone found a way of duplicating a face with holes

      Thanks in advance.

      Bill Wood

      posted in Developers' Forum
      B
      BillW
    • 1
    • 2
    • 2 / 2