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

    UncleString

    @UncleString

    10
    Reputation
    1
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    UncleString Unfollow Follow
    registered-users

    Latest posts made by UncleString

    • Adding a new group issues

      Skecthup-Group.jpgSkecthup-Group.jpg
      I am drawing a staircase using Ruby to retrieve the data from Excel.
      I can get two sections drawn, but the 3rd section, it draws the lines, and makes it a group, but then it goes somewhere else to pushpull.
      BTW- the white tread and the tread outline are both grouped as "bottomStairTread"
      The brown extended tread is still grouped with the first top stair, it got pushpulled somehow with the below code.

      This is the code for the second stair tread

      group = Sketchup.active_model.entities.add_group ; group.name="bottomStairTread" ent2 = group.entities ent2.add_line [start1-1.5,start2,start3+rise-c], [start1-(run+1),start2,start3+rise-c] #run+1.5=riser thickness + nose ent2.add_line [start1-1.5,start2,start3+rise-c], [start1-1.5,start2,start3+rise-c+dado] ent2.add_line [start1-1,start2,start3+rise-c+dado], [ start1-1.5,start2,start3+rise-c+dado] ent2.add_line [start1-1,start2,start3+rise-c+dado], [ start1-1,start2,start3+rise-c] ent2.add_line [start1-1,start2,start3+rise-c], [ start1,start2,start3+rise-c] ent2.add_line [start1,start2,start3+rise-c], [ start1,start2,start3+rise] ent2.add_line [start1,start2,start3+rise], [ start1-(run+1),start2,start3+rise] ent2.add_line [start1-(run+1),start2,start3+rise], [start1-(run+1),start2,start3+rise-c] edg.find_faces; face=edg.faces[0] face.pushpull wdth-(g*2) group = ent2.add_group face.all_connected ;group.name="bottomStairTread" group.description="bottomStairTread"
      How do I make it find faces & pushpull for this section?

      thanks

      posted in Developers' Forum
      U
      UncleString
    • RE: Load plugin on condition of textfile

      Okay, I found a solution, I should have had the if statement in the plugin I wanted to run.

      posted in Developers' Forum
      U
      UncleString
    • Load plugin on condition of textfile

      I have an excel file that opens sketchup, creates the drawing, then closes sketchup.

      NOTE:
      I have changed my way of thinking, now before excel opens sketchup, it will change a word in a text file to "go", then when the plugin works it's magic, it will change the word in the textfile to "no go"

      It still seems to load the plugin even it the textfile is "no go"

      File.open("C:/TestFolder/Doit with Sketchup/RunPlugIn.txt").each do|line| puts line UI.messagebox line if line == "go" load "testOpenSketchup.rb" UI.messagebox "Go" elseif line=="no go" puts "Nope" end end

      posted in Developers' Forum
      U
      UncleString
    • RE: Select Style for drawing

      I found it, it was a test .rb file, not a plugin but it did have
      def get_from_excel

      That is where the plugin was getting the code from.

      Thank you,
      The style does change now that I am in the correct code.

      posted in Developers' Forum
      U
      UncleString
    • RE: Select Style for drawing

      Okay, there is something very strange. I spent a lot of time trying to figure out why it would not pause or even show a msgbox as it was going through the code. I commented out the entire code and got nothing, I un-commented just the 1st line and the code produced a drawing, I don't know what code it used as I had all the code commented out.
      For example
      ` UI.menu("PlugIns").add_item("Get From Excel") { get_from_excel }

       # def get_from_excel
      

      ents=Sketchup.active_model.active_entities

      require 'win32ole'

      xl = WIN32OLE::connect('Excel.Application')

      workbook = excel.Workbooks('Stair_Info_to_Sketchup')

      worksheet = workbook.Worksheets(1)

      ................`

      How is this possible? I am going to assume it was is obviously running a code from somewhere else, but I can't locate it.

      posted in Developers' Forum
      U
      UncleString
    • RE: Select Style for drawing

      Thanks Tig,

      The image does end up in excel, but not with the correct style

      Pic in excel

      posted in Developers' Forum
      U
      UncleString
    • RE: Select Style for drawing

      Thanks,
      I could not find the actual file location, I was able to right click on the style and save it to a different location, and use that address to for the code.
      While this code does change the style.

      ` model = Sketchup.active_model
      entities = model.active_entities
      Sketchup.send_action("viewIso:")
      view = model.active_view

      #---------------Change Style----------
      filename = File.expand_path('C:\Users\dmorrison\Downloads\08Construction Documentation Style.style')
      styles = Sketchup.active_model.styles
      status = styles.add_style(filename, true)
      #-----------------------------

      Puts in SketchUp install directory by default

      status = view.write_image "test.jpeg"
      keys = {
      :filename => "S:/Stairs/Stair Pics/write_image.jpeg",
      :width => 500,
      :height => 400,
      :antialias => false,
      :compression => 0.5,
      :transparent => false
      }
      model = Sketchup.active_model
      view = model.active_view

      new_view = view.zoom_extents
      view.write_image keys`

      It does not change in my actual plugin.

      The last lines of the plugin to insert the image into excel
      ` #-----Pictures Insert Code---------------

      #require 'win32ole'
      model = Sketchup.active_model
      entities = model.active_entities
      Sketchup.send_action("viewIso:")
      view = model.active_view
      #---------------Change Style----------
      filename = File.expand_path('C:\ProgramData\SketchUp\SketchUp 2015\SketchUp\Styles\Default Styles\08Construction Documentation Style.style')
      styles = Sketchup.active_model.styles
      status = styles.add_style(filename, true)
      #-----------------------------

      Puts in SketchUp install directory by default

      status = view.write_image "test.jpeg"
      keys = {
      :filename => "S:/Stairs/Stair Pics/write_image.jpeg",
      :width => 500,
      :height => 400,
      :antialias => false,
      :compression => 0.5,
      :transparent => false
      }
      model = Sketchup.active_model
      view = model.active_view

      new_view = view.zoom_extents
      view.write_image keys
      #------------------------------------
      worksheet.pictures.delete
      #-----Pictures Insert Code---------------
      pic = worksheet.Pictures.Insert('S:\Stairs\Stair Pics\write_image.jpeg')
      range = worksheet.Range('a14:e32')
      pic.ShapeRange.LockAspectRatio = false
      pic.Top = range.Top
      pic.Left = range.Left
      pic.Width = range.Width
      pic.Height = range.Height`

      posted in Developers' Forum
      U
      UncleString
    • Select Style for drawing

      Construction Documentation Style.jpgIs there a way to select a style for my drawing?

      I would like it to use "Construction Documentation Style"

      Here is the code I am using to save the image.

      ` model = Sketchup.active_model
      entities = model.active_entities
      Sketchup.send_action("viewIso:")
      view = model.active_view

      Puts in SketchUp install directory by default

      status = view.write_image "test.jpeg"
      keys = {
      :filename => "S:/Stairs/Stair Pics/write_image.jpeg",
      :width => 500,
      :height => 400,
      :antialias => false,
      :compression => 0.5,
      :transparent => false
      }
      model = Sketchup.active_model
      view = model.active_view

      new_view = view.zoom_extents
      view.write_image keys`

      Thanks

      posted in Developers' Forum
      U
      UncleString