ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Soften coplanar ?

    22
    0 Votes
    22 Posts
    2k Views
    jolranJ
    entities.fill_from_mesh(mesh, true, 2 | 8) is working nicelly, but a small gotcha.. %(#FF0000)[mesh.add_polygon(1,2,3) mesh.add_polygon(2,3,4)] Does gives hard edges, as expected. %(#FF0000)[mesh.add_polygon(1,-2,3) mesh.add_polygon(-2,3,4)] gives hard soft edge between Points 2, as expected. but so does this: %(#FF0000)[mesh.add_polygon(1,2,3) mesh.add_polygon(-2,3,4)] or %(#FF0000)[mesh.add_polygon(1,-2,3) mesh.add_polygon(2,3,4)] So I'm starting to see some trouble with this method. To be able to stear edge visibility one need to use 2 Points in comparison. For ex a Collection of edge.start and end positions. For a triangulated quad this works but not if the face has innerloops, Or faces where triangulation is splitting the face without hitting innerloops. Was to fast here.. The docs actually explains this behavior, "value of [-1, 2, 3] indicates that the edge from 1 to 2 is hidden"
  • Help adding arc in ruby script

    10
    0 Votes
    10 Posts
    2k Views
    artmusicstudioA
    hi tig, ok, let's play with some formulas thanx stan
  • Asigning colours to elements

    5
    0 Votes
    5 Posts
    221 Views
    artmusicstudioA
    hi dan, thanx, next step is done! this one works: @c_step = Sketchup;;Color.new(30,125,180) group.entities.grep(Sketchup;;Face).each{|f| f.material=@c_step} stan
  • Error: #<NameError: undefined local variable or method

    3
    0 Votes
    3 Posts
    951 Views
    M
    Thank you, Dan, it works OK now!
  • Communication best practice

    9
    0 Votes
    9 Posts
    287 Views
    tt_suT
    Yes, you must make the server dish out JSONP to comply with same-origin policy.
  • Volumetric visualization

    4
    0 Votes
    4 Posts
    350 Views
    M
    Thank's to all, problem solved!
  • Colored faces

    15
    0 Votes
    15 Posts
    387 Views
    pingpinkP
    Thank You again Dan and TIG ! . I understand an idea now.
  • Model.select_tool "PaintTool"

    5
    0 Votes
    5 Posts
    290 Views
    Dan RathbunD
    @tomasz, Looks like a custom paint tool using the same cursor is in order...
  • Are Dynamic Components very slow? Why?

    3
    0 Votes
    3 Posts
    221 Views
    Dan RathbunD
    Make sure the Outliner window is closed, it SLOWS SketchUp way down.
  • Same Name Selection

    7
    0 Votes
    7 Posts
    270 Views
    pingpinkP
    Thanks tt_su ! , I'm going to read it !
  • Round-function ???

    3
    0 Votes
    3 Posts
    257 Views
    tt_suT
    @artmusicstudio said: if so, is there another "simple" syntax for rounding to 2 after comma - position ( or any other, of course) ? If you want a rounded float in return: <span class="syntaxdefault">module Example<br />  def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">round</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">number</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> precision</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    i </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 10.0 </span><span class="syntaxkeyword">**</span><span class="syntaxdefault"> precision<br />    </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">number </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> i</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">round </span><span class="syntaxkeyword">/</span><span class="syntaxdefault"> i<br />  end<br />end</span> ` Example.round(12.3456, 2) > 12.35` If you are formatting a number into a string to the UI you can use sprintf: ` sprintf('%.2f', 12.3456) > "12.35"`
  • General question - definition of units (inch/metric)

    15
    0 Votes
    15 Posts
    935 Views
    jolranJ
    Heh, it was like this for 100 puts statements in the console. to_s_to_l: 2.884 using send: 2.915 Rookie premature refactoring gone bad
  • Offset-function per ruby (simple)

    6
    0 Votes
    6 Posts
    420 Views
    icehuliI
    @artmusicstudio said: @slbaumgartner said: @artmusicstudio said: hi, is there an equivalent for the skp-function "offset" in ruby for simple forms like square or circle ? thanx stan Were you looking to move objects, per Dan's replies, or for a Ruby equivalent to the offset tool (i.e. to create a "parallel" shape inside or outside the original)? hi, slbaumgartner, yes , you got it, what i look for here (though dan's advice is also helpful for other things) is in deed the offset-function, creating a parallel shape (only simple forms like rectangles or circles). stan you can try this: http://www.smustard.com/script/Offset simply works for faces(polygons) and polylines
  • How to create a face with a hole touching its edge?

    13
    0 Votes
    13 Posts
    417 Views
    icehuliI
    Some observations..... The sketchup offset tool is not consistent. It does not always provide the same result....sometime gives the left, sometime gives the right. They are slightly different. Both results have two faces, a bigger face and a small one(the hole). The bigger face is selected in both results, while the small one is not selected. On the left, the small one is separated from the bigger face, i.e. the bigger face contains a hole. On the right, the small one is overlapped with the bigger face, i.e. the bigger face does not contain a hole. ....... [image: I7i0_offset_diff.PNG]
  • Simple Extension for Mac

    25
    0 Votes
    25 Posts
    1k Views
    Dan RathbunD
    Only Sketchup::ComponentDefinition and Sketchup::ComponentInstance will have dictionaries with that special name.
  • Some light entertainment

    14
    0 Votes
    14 Posts
    325 Views
    Rich O BrienR
    @adamb said: Rich, why is your avatar Brian Blessed? Gordon....He's alive!!! It's not Brian Blessed unfortunately. It's Action Bronson... [image: action-bronson-terry-richardson-8.jpg]
  • Offset + Thickness + Groups

    2
    0 Votes
    2 Posts
    308 Views
    pingpinkP
    I can do it now ! def glass_groups model = Sketchup.active_model model.start_operation( "Face Offset" , true) selection = model.selection entities = model.active_entities #entities = model.entities arr = [] faces = [] selection.each{|entity| if entity.class == Sketchup;;Face arr.push entity end } $face_offset = 13 $glass_thickness = 6 prompts = ["Offset Width [mm] ", "Glass Thickness [mm] "] defaults = [$face_offset.to_s,$glass_thickness.to_s ] list = ["",""] input = UI.inputbox prompts, defaults, list, "Offset Face." doffset = input[0].to_f $face_offset = doffset berase = true # 1. Offset Glass + Erase outer faces arr_glass = [] arr.each{|entity| face = face_offset1(entity, doffset.mm, berase) arr_glass.push face } entities.each do |e| faces.push e if e.is_a? Sketchup;;Face end # 2. Glass Thickness + Group's Name distance = input[1].to_f n='Glass unit' faces.each do |e| # e.pushpull distance.mm, true g = entities.add_group e e.pushpull(-distance.mm) g.name=n ############### end model.commit_operation end
  • Module variable with 'require' problem

    8
    0 Votes
    8 Posts
    280 Views
    Dan RathbunD
    @inteloide said: Now, the problem is that @@var must be define in B.rb : what about if I need to create a third file which require @@var ? I must declare again the same variable ! NO.. the @@var is a module variable. It is SHARED by ALL classes and modules that include the mixin module M::I If you change @@var value from an instance of class M::A, all other instances will see the change. Also any modules that included the M::I mixin will share the @@var. (It is a proxy lookup INTO the mixin library module M::I.) Files are NOT included (that is a Python feature.) IN Ruby modules are included. A file can define multiple modules. @inteloide said: Any solution ? (Because in my plugins, there are a lot of variables used in a lot of sub-programs... If you want each class instance or sub-module to use it's OWN variables, the use instance vars, ... @var (only a single @ before the variable name.) This is all basic Ruby, explained in the "Pick-Axe" Book.
  • Paste between instances and onLayerAdded issue

    8
    0 Votes
    8 Posts
    228 Views
    jiminy-billy-bobJ
    It is in my code. I just simplified everything to paste this snippet.
  • Menue definition - small problem

    3
    0 Votes
    3 Posts
    214 Views
    artmusicstudioA
    hi dan, super, thanx, i understood and it works now, besides a small message in the console: load '01.rb' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/01.rb:66: warning: already initialized constant THISFILE true i start the ruby directly, not in a module (when i put it in the module, it does not work, probably because of all the entities definitions etc. / still workin' on it) regards stan

Advertisement