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

    Topics

    • D

      Dynamic component rotation

      Watching Ignoring Scheduled Pinned Locked Moved Dynamic Components sketchup
      2
      0 Votes
      2 Posts
      7k Views
      P
      open the component, select the raw geometry and make another component, set its axis in the direction you require, close the nested component that holds the geometry is the one you will rotate. If you want to rotate in another direction as well, then you would nest it again so that the rotations are independent
    • D

      IPad sketchup viewer with interact?

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Discussions sketchup
      3
      0 Votes
      3 Posts
      757 Views
      sketch3d.deS
      probably not with the mobile viewers but maybe with a future release of the my.SketchUp.com browser version (currently WIP).
    • D

      Reduce model complexity

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Discussions sketchup
      5
      0 Votes
      5 Posts
      1k Views
      bazB
      post deleted by me
    • D

      Component inserts at origin automatically

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      3
      0 Votes
      3 Posts
      418 Views
      D
      This was driving me nuts! This forum never let's me down!! : ) Many thanks TIG
    • D

      Staircase builder - strange scaling behaviour - Help!

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      1k Views
      D
      Staircase builder fixed! Fixed!
    • D

      Architectural plugins

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      17
      0 Votes
      17 Posts
      4k Views
      D
      Staircase builder has been revised and some bugs fixed. Try it out! db1stairbuilder.rb
    • D

      Minimum dimension of a component

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      662 Views
      Dan RathbunD
      My solution: def thickness(obj) ents =( obj.definition.entities rescue obj.entities ) tran =( obj.transformation rescue IDENTITY ) edges = ents.grep(Sketchup;;Edge).find_all {|e| e.start.position == ORIGIN || e.end.position == ORIGIN } if edges.size < 3 return 0.to_l # not a 3D object or edges array empty end shortest = edges.min_by {|e| e.length } shortest.start.position.transform(tran).distance( shortest.end.position.transform(tran) ) end This should work with an argument that is a definition, group or component instance. If a ComponentDefinition is passed, the transform will be the IDENTITY transform, otherwise an instance or group will be it's transform (which also might be == IDENTITY.) Within the entities the local origin is == ORIGIN, so there is no need to create any temporary point object for comparison, just to select the 3 edges. Once we have the shortest (untransformed) edge, we apply the transformation to both it's vertex positions, to account for any rotation and scaling (either uniform or not.) Now, this assumes that the shortest definition edge is always to be considered the thickness, even in the instances. But what if someone does non-uniform scaling and makes one of the longer edges shorter than the one that is supposed to be the shortest ? I suppose, if you control the definitions, you could attach an attribute to the "thickness" edge, and find it by attribute.
    • D

      Component axes, glueing and animating

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      4
      0 Votes
      4 Posts
      320 Views
      JQLJ
      There's an extra trick with Glued/hole cutting components. If you insert a hole cutting component into another and if their glueing planes match, then you can cut two holes in a face, just a SINGLE face. You can't cut two faces wether or not they are coplanar.
    • D

      Architectural layer name conventions

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Discussions sketchup
      39
      0 Votes
      39 Posts
      10k Views
      JQLJ
      You guys also know that you can leave those settings blank, and what it'll do is change scenes without affecting the current settings. So you can have a scene with an active section cut and when you change to one without section planes toggled on, it will change other stuff, but keep current active section cut.
    • D

      Obtaining selected face vertices

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      653 Views
      Dan RathbunD
      @deanby7 said: I know I'm missing something basic here but trying to get the vertices of a selected face.... @mod = Sketchup.active_model > sel = @mod.selection > verts = sel.grep(Sketchup;;Face) {|f|f.vertices} > v = verts.position > Doesn't give me an array of 3d point values as expected? Interrogate the Ruby documentation for each method used. The Sketchup::Selection class (as well as most other API collection classes,) mix in the Enumerable library module. This is where grep() comes from. Enumerable#grep() http://ruby-doc.org/core-2.0.0/Enumerable.html#method-i-grep The grep() method always returns an array, either of the collection members matching the pattern, or the results of the block (if given.) It is similar to using a combination of find_all(), followed by map(). Your pattern was all Sketchup::Face objects, and you used a block which passed each face into the block in turn. Your block then called Sketchup::Face#vertices() upon each, which always returns an Array of Sketchup::Vertex objects. So at the very least, your verts reference could point to an empty array (if no faces were grep'ed, and therefore the block is never called.) If the collection does hold face references, there will be a nested array of vertices, for each face found. Now, there is a difference between a vertex and a point. Sketchup::Vertex objects are model entity objects (and subclass of Sketchup::Drawingelement, which is subclass of Sketchup::Entity.) Meaning they are entities that are saved within the model geometric database. They, in turn have a position property. Accessing that, returns a Geom::Point3d object, which in a virtual geometry "helper" object. Anyway, if you want points, then call position upon the vertices, within the block: point_arys = sel.grep(Sketchup;;Face) {|f| f.vertices.map{|v| v.position } } ... which now gives you an array of nested arrays of points (for each face.) Or, ... access the points in two steps: vert_arys = sel.grep(Sketchup;;Face) {|f| f.vertices } for face_verts in vert_arys face_points = face_verts.map {|v| v.position } # do something with the array of face_points end
    • D

      Axes vectors in Sketchup 8

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      601 Views
      thomthomT
      To get the working model axes there is a hack for older versions of SU - if you only need the direction. You aren't able to obtain the origin though. Here's a snippet directly from Vertex Tools: # SU7+ only - incorrect in older versions. # A hack to get the current model axis. # # @return [Array<Vector3d,Vector3d,Vector3d>] # @since 1.0.0 def get_local_axis if FEATURE_MOVING_AXIS # SketchUp 8+ tr = get_local_transformation elsif @model.respond_to?( ;edit_transform ) # SketchUp 7 if @model.active_path tr = @model.edit_transform else tr = get_local_transformation end else # SketchUp 6 tr = Geom;;Transformation.new end [ tr.xaxis, tr.yaxis, tr.zaxis ] end # SU7+ only - incorrect in older versions. # A hack to get the current model axis. # # @return [Array<Vector3d,Vector3d,Vector3d>] # @since 1.1.0 def get_local_transformation @model.start_operation('Get Local Transformation (Hack)') entities = @model.active_entities tr = entities.add_group(entities.add_group).transformation # (?) SketchUp bug? # The transformation returned has X, Y and Z set to 1.0e+030! # Why this high value? Overflow bug? Geom;;Transformation.new( tr.xaxis, tr.yaxis, tr.zaxis, ORIGIN ) ensure @model.abort_operation end That FEATURE_MOVING_AXIS constant comes from a check if the SU version is 8 or higher.
    • D

      Assigning a default material.

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      1k Views
      Dan RathbunD
      @tig said: Another way to set it by ' display_name' [i.e. what you can read] would be... mats = model.materials name = 'Brick_Antique' mat = nil mats.each{|m| if m.display_name == name mat = m break end } oface.material = mat Still another way: mats = model.materials name = 'Brick_Antique' mat = mats.find {|m| m.display_name == name } oface.material = mat
    • D

      Help with window hole in wall script

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      30
      0 Votes
      30 Posts
      5k Views
      D
      Gary K - They look interesting, I will check these out! With TIG and sdmitch's very informative help I have succeeded with my little script! Posted here for information. Cheers guys. Now to look at automating the move of window component with its associated reveals! Hmmm observers? dbwindowwallopen.rb
    • D

      From AutoLisp to Ruby

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      14
      0 Votes
      14 Posts
      2k Views
      Dan RathbunD
      @deanby7 said: I'm running Version 8 Sketchup. ... which runs Ruby v1.8.6-p287 on PC, and v1.8.5-p0 on OSX. @deanby7 said: I'm getting an error.... Error: #<NoMethodError: private methodclass_variable_get' called for SaM::Pick_Points:Class>` For some reason Ruby 1.8 had made class_variable_get() and class_variable_set() to be private methods. In SketchUp v14+ using Ruby 2.0+, they were changed to be public methods.
    • 1 / 1