sketchucation logo sketchucation
    • Login
    1. Home
    2. rossthompson
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 19
    • Posts 35
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Plugin to identify "Thermal Bridges"

      Hi, I'm afraid not. I wasn't able to find a solution.

      Ross

      posted in Developers' Forum
      R
      rossthompson
    • Find the midpoint of walls on a 2D DWG

      Hi All,

      I use SketchUp for creating simplified models for analysis software.

      These models need zones creating that pick up the midpoints of internal walls and the inside face of external walls. A screen shot is attached.

      Typically this is done from an imported 2D DWG floor plan. The layers etc. will vary.

      Can anyone think of a way to create these zones via ruby?
      It seems like something that is easy to explain to a human but not so easy to code.

      Thanks.
      Ross


      Rooms.JPG

      posted in Plugins
      R
      rossthompson
    • RE: Plugin to identify "Thermal Bridges"

      Hi Pixero,
      Thanks for getting back to me. I've had a look through and I don't think any of those plugins will be able to do it unfortunately.

      posted in Developers' Forum
      R
      rossthompson
    • Plugin to identify "Thermal Bridges"

      Hi,

      It has been a while since I posted, so I'm hoping this is the right section.

      I work for a company that uses SketchUp for the thermal analysis of buildings. Regulations now require us to evaluate heat lost through junctions between elements.

      For example external corners of a building, or where a window joins a wall. The attached PDF shows some useful diagrams.

      The current approach is to make a simple sketchup model of the building, then try to motivate a graduate to measure and record all the lengths associated with these junctions. This can takes hours if not days, a frustrating process as the computer already has the inputs!

      So this prompts the question, could this be done automatically with a plugin / algorithm?

      My coding experience is limited, but it would be great to get an estimate for the number of person-hours the programming work would take.

      If anyone is looking for development work, please get in touch. This plugin would be very valuable to our company and many others.

      Thanks

      Ross


      Thermal Bridging Diagrams.pdf

      posted in Developers' Forum
      R
      rossthompson
    • RE: Convert Array into Integer

      Hi, that has sorted it.

      Thank you

      posted in Plugins
      R
      rossthompson
    • Convert Array into Integer

      Hi,

      I am trying to use a simple bit of code that allows me to set the color alpha value in SketchUp 7.

      I use this version as its the last one with a free DWG importer.

      Anyway the problem is I can only get an array from 'UI.inputbox' and I need an integer to set the color.alpha value.

      Can anyone correct the code?

      Thanks

      Ross

      ` def translucent
      model = Sketchup.active_model
      materials = model.materials
      m=materials.add("translucent") unless m=materials["translucent"] # Adds a material to the "in-use" material pallet.

      title = 'Opacity'
      prompt = 'Opacity'
      default = 0.5
      result = UI.inputbox([prompt], [default], "text") # need to use array

      UI.messagebox(result)

      m.color = Sketchup::Color.new(100, 100, 100, result) # Specify the colour.opacity
      color = m.color
      alpha = m.alpha=0.5 # Set material transparency
      materials.current = materials["translucent"] # Set to the current material
      Sketchup.send_action "selectPaintTool:" # Start the paint tool
      end`

      posted in Plugins
      R
      rossthompson
    • Apply Material to ALL Entities on a Layer.

      Hi,

      I am working with some imported geometry (from Revit via DWG file).

      The windows of the building are components on a layer called 'Window'.

      Inside the components are the frame part on a layer 'Frame' and the glass on a layer 'Glass'.

      After importing all the geometry is assigned the default material so it is opaque.

      I simply want to select all entities on the 'Glass' layer regardless of if they are in an active component or otherwise and assign to them a transparent glass material.

      This would mean you can see through the glass into the room.

      A workaround would be to view the model in color by layer mode but I don't want to go down this route.

      Does anybody know of any code that can help?

      Thanks

      Ross

      posted in Plugins
      R
      rossthompson
    • Dividing Up a Window Frame

      Hi,

      I work with a program for building analysis that imports simple SketchUp geometry (e.g buildings drawn with a single face to represent a wall).

      The problem is the export tool struggles with window frames. The window can't be drawn as an island inside the frame or it will cause the export to fail.

      The most effective work around is to add diagonal lines to break up the frame into simple pieces. See attached image.

      The ruby script for the exporter is scrambled so it can't easily be altered. But I was wandering if there was a way to develop a script that creates the diagonal lines automatically.

      I can think of two approaches:

      1. Identify the glass window pane by its material (or manual selection) and move it perpendicular to the frame. This way SketchUp automatically generates the diagonal lines I require. And the pane can then be moved back.

      2. Run a script that cycles through each vertex and checks for another vertex within a certain 'grab distance' (100mm sounds about right for most windows). A line could then be added between all vertices less than a certain distance apart and this should hopefully give the desired results.

      I hope this gives a clear explanation of the problem and any help would be greatly appreciated.

      Ross


      Capture.JPG

      posted in Plugins
      R
      rossthompson
    • RE: Save As Plugin

      Aerilius thanks very much for this - that is a clever approach.

      I have tried running the module you have written. However it opens command prompt with an error message "The system cannot find the file specified. 0 file(s) copied".

      I have tried debugging through the ruby console (see attachment) and the script correctly identifies my custom template file and the path to my desktop.

      However line 8 returns 'false' when trying to copy the file.

      I don't understand why this would be the case.

      Do you have any ideas?

      Thanks

      Ross


      Ruby Console.jpg

      posted in Plugins
      R
      rossthompson
    • RE: Save As Plugin

      PC

      posted in Plugins
      R
      rossthompson
    • Save As Plugin

      Hi,

      I was wandering if anyone can help me - I am looking for a ruby script to perform the following:

      1. Open a fresh window of SketchUp (leaving all the currently open windows as they are)

      2. Save the newly opened blank model to the desktop as 'temp.skp'

      Is this possible with the API?

      I know it only takes a few seconds to do these actions manually, but I am required to do this so often a script would be very valuable.

      Thanks

      Ross

      posted in Plugins
      R
      rossthompson
    • RE: Create Layers From Component Names

      TIG - thanks so much for that.

      Would it be possible to revise the code to ignore any nested components? I guess this could be done with a simple change to the definition?

      Also could the layer colour be fixed to black?

      Thanks so much for your help

      Ross

      posted in Plugins
      R
      rossthompson
    • Create Layers From Component Names

      Hi,

      I am working on a model that has a very large number of imported components.

      What I would like to do is run a script that creates a layer for each component. Ideally the layer name would be identical to the component name, and each component would be placed on the corresponding layer.

      Has anybody come across something similar to this?

      I hope this is clear.

      Ross

      posted in Plugins
      R
      rossthompson
    • Select a Face and any Islands

      Hi guys,

      I am frequently required to measure the wall area from models of buildings.

      This can obviously be done by selecting all the surfaces and looking in the entity window for the total area.

      The problem I have is that I need to include the area of the windows in the measurement. This can mean having to select many other faces making the job harder than it needs to be.

      I was wandering if anyone knew of a short cut that would allow you to select a face including any islands within it?

      Obviously any edges would need to be ignored as they prevent the entity window from outputting the area.

      Hopefully the image illustrates the problem clearly.

      Any help would be appreciated.

      Ross


      Selection.JPG

      posted in Plugins
      R
      rossthompson
    • RE: Toggle Wireframe

      Good spot.

      Thanks it is sorted now.

      Ross

      posted in Plugins
      R
      rossthompson
    • Toggle Wireframe

      Hi guys,

      Hopefully an easy one. I am trying to write a button to toggle between the face style of 'shaded with textures' (my default) and 'wireframe'.

      I can't quite see why it can't be done with a simple if statement. My code is below

      Any help would be appreciated.

      Ross

      ` # Toggle Wireframe
      def wireframe
      if Sketchup.active_model.rendering_options["RenderMode"] = 0 # 2 = shaded, 0 = wireframe
      Sketchup.active_model.rendering_options["RenderMode"] = 2
      else
      Sketchup.active_model.rendering_options["RenderMode"] = 0
      end

      end`

      posted in Plugins
      R
      rossthompson
    • Toggle X-Ray Button Held Down

      Hi guys,

      I have written a very basic script that allows me to toggle X-ray rendering mode on and off from a custom made toolbar. However when the mode is active the icon does not remain 'pressed' as it does on the official 'Face Style' toolbar. The image below hopefully illustrates the effect I want. The code is also included.

      Any help would be greatly appreciated. I have no idea how to approach this.

      Thanks

      Ross

      
      toolbar = UI;;Toolbar.new "View"
      	cmd = UI;;Command.new("X-Ray") { xray }
      	cmd.large_icon = "CBG/togglexray_lg.png"
      	cmd.small_icon = "CBG/togglexray_sm.png"
      	cmd.tooltip = "Toggle X-Ray"
      	toolbar = toolbar.add_item cmd
      	toolbar.show
      # Toggle X-ray
      def xray
        if Sketchup.active_model.rendering_options["ModelTransparency"] == false
          Sketchup.active_model.rendering_options["ModelTransparency"] = true
        else
          Sketchup.active_model.rendering_options["ModelTransparency"] = false
        end
      end
      
      
      

      Pressed Icon.JPG

      posted in Plugins
      R
      rossthompson
    • RE: Rotate Axis About Origin

      Hi TIG,

      Cheers for that, I have tried setting up separate scenes and that works perfectly.

      Thanks for your help.

      Ross

      posted in Plugins
      R
      rossthompson
    • Rotate Axis About Origin

      Hi,

      I am frequently dealing with building where certain parts are on a 45 degree angle. Is it possible to write a script that rotates the axes by a set angle about the origin?

      The ideal behavior would be to press the button once to rotate the axes by 45 degrees, then press it a second time to reset it back to normal.

      Any help would be appreciated.

      Ross

      posted in Plugins
      R
      rossthompson
    • RE: Directly apply a material

      Hi, that worked perfectly

      Thanks TIG

      posted in Plugins
      R
      rossthompson
    • 1 / 1