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

    mbastian

    @mbastian

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

    mbastian Unfollow Follow
    registered-users

    Latest posts made by mbastian

    • RE: [Plugin]ArcCurve-set_segments.rb & changearcsegments 130830

      First of all: I am NOT a programmer, so there is ZERO error handling on this quick-and dirty script. I had tried TIG's solution, but did not work on my DWG because some of the arcs would "clip" others as they were rebuilt by the script.

      So I wrote this small routine to:

      • loop through imported AutoCAD entities.
      • select curves and group them (individually)
      • create a more refined clone of the curve (the number of segments is controlled by two parameters. See script)
      • Delete the original curve.

      Anyone is welcome to turn this snippet into something better and more reusable.

      Best,
      Marcos.


      theModel = Sketchup.active_model
      #selEntities = theModel.selection

      theModel.selection.clear
      allEntities = theModel.entities

      Collect user values:

      prompts = ["Minimum number of segments:", "Minimum Segment Length:"]
      defaults = [36, 10]
      input = UI.inputbox(prompts, defaults, "Enter Desired Settings")

      #set minimum length for each arc segment (in model units)
      userSegs = input[0]
      minLen = input[1]

      #UI.messagebox(userSegs.to_s)
      #UI.messagebox(minLen.to_s)

      allEntities.each do |i|
      if (i.typename == "Edge")
      aCurve = i.curve
      if (aCurve)
      Sel = theModel.selection unless defined?(Sel)
      Sel.add (aCurve.edges)
      newGroup = allEntities.add_group (theModel.selection)
      Sel.clear
      else
      #not a Curve
      end
      end
      end

      theModel = Sketchup.active_model
      theModel.selection.clear
      allEntities = theModel.entities

      Loop through all entities

      allEntities.each do |i|

      #open Groups, search for Curves
      if (i.typename == "Group")

      #Loop through array of Entities inside each Group
      subset = i.entities
      subset.each do |s|
      curve = s.curve

      if it is a curve, collect a few properties

      if (curve)

      get coord. transformation, since entities are in a group

      #use "transform" below to translate to global coordinates
      tr=i.transformation

      cCenter = curve.center.transform! (tr)
      cSangle = curve.start_angle
      cEangle = curve.end_angle
      cRadius = curve.radius
      cNormal = curve.normal.transform! (tr)
      cXaxis = curve.xaxis.transform! (tr)
      cYaxis = curve.yaxis.transform! (tr)

      cLength = curve.length
      #UI.messagebox(" Curve Length is " + cLength.to_s)

      #divides arcs in minLen(model unit) increments
      divSegs = (cLength / minLen).to_i
      #UI.messagebox("Divided Result is " + divSegs.to_s)

      #for very small arcs, sets a minimum number of segments
      if (divSegs <= userSegs)
      numSegs = userSegs

      UI.messagebox("Using: " + numSegs.to_s)

      else
      #subdivides larger arcs using target length
      numSegs = divSegs.to_i

      UI.messagebox("using Divided total" + numSegs.to_s)

      end

      myarc = allEntities.add_arc cCenter,cXaxis,cNormal,cRadius,cSangle,cEangle,numSegs
      #Erases original
      i.erase!

      end # if curve

      end # entities inside group loop

      end # if it is a group

      end #loop through all entities

      posted in Plugins
      M
      mbastian
    • RE: Tip for importing DWG into SketchUp

      First of all: I am NOT a programmer, so there is ZERO error handling on this quick-and dirty script. I had tried TIG's solution, but did not work on my DWG because some of the arcs would "clip" others as they were rebuilt by the script.

      So I wrote this small routine to:

      • loop through imported AutoCAD entities.
      • select curves and group them (individually)
      • create a more refined clone of the curve (the number of segments is controlled by two parameters. See script)
      • Delete the original curve.

      Anyone is welcome to turn this snippet into something better and more reusable.

      Best,
      Marcos.


      theModel = Sketchup.active_model
      #selEntities = theModel.selection

      theModel.selection.clear
      allEntities = theModel.entities

      Collect user values:

      prompts = ["Minimum number of segments:", "Minimum Segment Length:"]
      defaults = [36, 10]
      input = UI.inputbox(prompts, defaults, "Enter Desired Settings")

      #set minimum length for each arc segment (in model units)
      userSegs = input[0]
      minLen = input[1]

      #UI.messagebox(userSegs.to_s)
      #UI.messagebox(minLen.to_s)

      allEntities.each do |i|
      if (i.typename == "Edge")
      aCurve = i.curve
      if (aCurve)
      Sel = theModel.selection unless defined?(Sel)
      Sel.add (aCurve.edges)
      newGroup = allEntities.add_group (theModel.selection)
      Sel.clear
      else
      #not a Curve
      end
      end
      end

      theModel = Sketchup.active_model
      theModel.selection.clear
      allEntities = theModel.entities

      Loop through all entities

      allEntities.each do |i|

      #open Groups, search for Curves
      if (i.typename == "Group")
      
          #Loop through array of Entities inside each Group
          subset  = i.entities
            subset.each do |s|
            curve = s.curve
      
            # if it is a curve, collect a few properties
            if (curve)
      
            # get coord. transformation, since  entities are in a group
            #use "transform" below to translate to global coordinates
            tr=i.transformation
      
            cCenter = curve.center.transform! (tr)
            cSangle = curve.start_angle
            cEangle = curve.end_angle
            cRadius = curve.radius
            cNormal = curve.normal.transform! (tr)
            cXaxis = curve.xaxis.transform! (tr)
            cYaxis = curve.yaxis.transform! (tr)
      
            cLength = curve.length
            #UI.messagebox(" Curve Length is " + cLength.to_s)
      
            #divides arcs in minLen(model unit) increments
            divSegs = (cLength / minLen).to_i
            #UI.messagebox("Divided Result is " + divSegs.to_s)
      
              #for very small arcs, sets a minimum number of segments
              if (divSegs <= userSegs)
              numSegs = userSegs
              #  UI.messagebox("Using: " + numSegs.to_s)
              else
              #subdivides larger arcs using target length
              numSegs = divSegs.to_i
              #  UI.messagebox("using Divided total" + numSegs.to_s)
              end
      
            myarc = allEntities.add_arc cCenter,cXaxis,cNormal,cRadius,cSangle,cEangle,numSegs
            #Erases original
            i.erase!
      
            end # if curve
      
          end # entities inside group loop
      
      end # if it is a group
      

      end #loop through all entities

      posted in SketchUp Discussions
      M
      mbastian
    • RE: Photo Match Issues

      Awesome!!
      I owe you all a beer!! And two extras for ThomThom!

      The Advanced Camera worked like a charm! I only had to override the Eye Position, and the updated image matched perfectly. I still don't know why my SketchUp insists in "zooming out" with every new image match, but I'll worry about that later.

      • As a small bit of extra information: The overwritten eye position was initially not retained even after the Scene was updated (through the Scene tab). Clicking the tab reverted to the wrong eye position. However once the view was cloned (with Right Click > Add Scene), the correct eye position and image were recorded.

      Once again, Thank you!
      Marcos.

      @jql said:

      That's not happening with me. If my match photo scene is active when I import a new image, it will keep exactly the same camera.

      That seems a zoom error that also occured to me when rendering a match photo scene.

      Do you have or are you able to install Thomthom camera tools?

      If so, after that is installed, go to top menu Camera > Advanced;
      Compare every value on advanced;
      Position should be the same and camera direction too;
      Pay special attention and check if W/H is the same value in both scenes;
      If it isn't, try setting both scenes to 0 and see if they match.

      [attachment=0:1jrya59m]<!-- ia0 -->camera.jpg<!-- ia0 -->[/attachment:1jrya59m]

      If they do, then you can update scenes, if not you can copy values but it's easier this way:

      create a new scene with the new image as background underlay in styles;
      in scenes manager untick camera position on the new scene;
      then double click the original photo match scene;
      go back to the new scene and tick the camera postion tick box back on.
      You should have a new scene with the same camera position than the match photo.

      posted in SketchUp Discussions
      M
      mbastian
    • Photo Match Issues

      I can't for the life of me figure this one out, so I'm hoping someone out there will have solved it.

      In previous versions of Sketchup, a matched photo could be updated by simply re-importing an updated version of the photo in question. SketchUp would create another scene and neatly replace the old background image with the camera/axes unchanged.

      However, SketchUp now resets the camera and axes every time a new PhotoMatch is started!

      • Perhaps the screenshots below may help illustrate the problem:
      1. The first image (below) is a temporary jpg exported from Google Earth with a reference grid for the photo matching. The axis and scale have been set, and the image can now be replaced with a final background, without the construction geometry.

      Matching 01

      1. In the past, I would only import a second image, and SU would add it to the new scene. As you can see below however, PhotoMatch has reset the view parameters, and the "previous zoom" tool does not work either.

      Matching 02

      WTF Skethup?!?

      • This is is driving me nuts! Has anyone else experienced this issue?
      • Alternatively, would anyone know of another way to replace an existing PhotoMatch source?

      Thanks in advance!

      posted in SketchUp Discussions sketchup
      M
      mbastian