🚨 Skimp | 25% Off until March 30 Buy Now

Subcategories

  • No decscription available

    20 Topics
    462 Posts
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • What is the safest 3d format?

    5
    0 Votes
    5 Posts
    783 Views
    deaneauD
    yes I will try... i would wish skp would be a format only visible in the viewer as suggestion SKV sketchup viewer file
  • Obtaining selected face vertices

    2
    0 Votes
    2 Posts
    737 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
  • Preventing add_curve curves exploding...

    3
    0 Votes
    3 Posts
    574 Views
    D
    I'll post the code here, because it's where I searched for a solution first and couldn't find one... [image: 8ARS_working_edges_centre.gif] I striped out the colouring but left the selection add, as a progress bar substitute... # with Tig's advice from PM ... model = Sketchup.active_model sel = model.selection ents = model.active_entities view = model.active_view mats = model.materials # cylindrical sine wave pair on a unit radius with 24 sides... wave = [[1.0, 0.0, 0.0], [0.9659258262890683, 0.25881904510252074, 0.050799999999999984], [0.8660254037844387, 0.49999999999999994, 0.08798818102449896], [0.7071067811865476, 0.7071067811865475, 0.1016], [0.5000000000000001, 0.8660254037844386, 0.08798818102449898], [0.25881904510252096, 0.9659258262890682, 0.05080000000000003], [6.123233995736766e-17, 1.0, 1.2442411479337108e-17], [-0.25881904510252063, 0.9659258262890683, -0.05079999999999998], [-0.4999999999999998, 0.8660254037844388, -0.08798818102449893], [-0.7071067811865475, 0.7071067811865476, -0.1016], [-0.8660254037844385, 0.5000000000000003, -0.087988181024499], [-0.9659258262890682, 0.258819045102521, -0.050800000000000047], [-1.0, 1.2246467991473532e-16, -2.4884822958674216e-17], [-0.9659258262890684, -0.25881904510252035, 0.05079999999999989], [-0.8660254037844388, -0.4999999999999998, 0.08798818102449892], [-0.7071067811865479, -0.7071067811865471, 0.1016], [-0.5000000000000004, -0.8660254037844384, 0.08798818102449903], [-0.25881904510252146, -0.9659258262890681, 0.05080000000000014], [-1.8369701987210297e-16, -1.0, 3.267705224142925e-17], [0.2588190451025203, -0.9659258262890684, -0.050799999999999915], [0.4999999999999993, -0.866025403784439, -0.08798818102449889], [0.7071067811865475, -0.7071067811865477, -0.1016], [0.8660254037844384, -0.5000000000000004, -0.08798818102449901], [0.9659258262890681, -0.2588190451025215, -0.05080000000000014], [1.0, 0.0, -0.0]] # waves have an additional point to complete the circle... segments = wave.length - 1 # single undo model.start_operation('wave') # Make the empty 'container' group. container = ents.add_group() cont_ents = container.entities # add the empty surf_grp() to cont_ents surf_grp = cont_ents.add_group() surf_ents = surf_grp.entities # Add Surface soft edges and faces using offset points... i = 0 segments.times do f = surf_ents.add_face(ORIGIN, wave[i], wave[i + 1]) view.refresh f.edges.each{|e| e.soft="true" e.smooth="true" sel.add(e) } i += 1 view.refresh end # add the wave to cont_ents... cont_ents.add_curve(wave) # and explode the surface faces... surf_grp.explode sel.clear model.commit_operation EDIT: after getting the other working using add_face I made a few adjustment to this code... john
  • Code to calculate Catenary curves?

    21
    0 Votes
    21 Posts
    6k Views
    Didier BurD
    Hi, Check this one by Aerilius: http://rhin.crai.archi.fr/rld/plugin_details.php?id=990
  • Observer or Event when Changing Model

    5
    0 Votes
    5 Posts
    687 Views
    fredo6F
    @dan rathbun said: But that was a bug in older SketchUp versions, wasn't it ? I remember it happened when saving the model (most often.) But I thought it was fixed. Maybe, although I am not sure. But as you know, supporting older versions is also a requirement, so that, as long as the old tricks work, you finally leave it as it is. Fredo
  • From AutoLisp to Ruby

    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.
  • Assigning a default material.

    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
  • Volume of Multiple Groups

    13
    0 Votes
    13 Posts
    5k Views
    F
    Thankyou Dan!
  • Import fbx in Sketchup

    6
    0 Votes
    6 Posts
    30k Views
    Bob JamesB
    Fluidimporter is good and more flexible since it imports other type files at $89 http://www.fluidinteractive.com/products/sketchup-extensions/fluidimporter/ but I find that SimLab FBX importer for SketchUp is more reliable at $79 https://extensions.sketchup.com/en/content/simlab-fbx-importer-sketchup
  • Catenary curve

    6
    0 Votes
    6 Posts
    1k Views
    thomthomT
    I always wanted an extension that added a tool that let you specify the length of a curve, and then you could adjust the start and end of it within that constraint. I had a quick look the other day of the code - looking at how it could be adapted to taking input from a Ruby tool.
  • Starting a new Ruby Tool Extension

    13
    0 Votes
    13 Posts
    3k Views
    thomthomT
    The example focused on writing a tool. Tool are so complex that in an example I didn't want to muddle everything else into it. In the examples I'm writing I was a separate "tutorial" that describe in detail how to structure the folders and register the extension and add a menu. Toolbars and localization are good separate topic - each deserving their own attention. I had thought I'd put it on GitHub once it was more fleshed out - but maybe I should try to put out the WIP since we already have a topic on this going here. As for parenthesis - that's a code style and that is something people have to pick for their own. I used explicit parenthesis myself because I was familiar with other languages that always required them. But in Ruby this isn't the norm. I found that it was easier to just use normal convention for the language - as sharing code and adopting example code required less work. For Ruby code I use the GitHub style guide which seem to be the de-facto standard. IDE's normally base their inspection rules on this and you'll hear a lot of squawking if you use a different style - unless you spend the time to reconfigure the style rules.
  • Axes vectors in Sketchup 8

    6
    0 Votes
    6 Posts
    773 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.
  • Trajectory curve

    2
    0 Votes
    2 Posts
    543 Views
    D
    cheers for posting these scripts... john
  • Help with window hole in wall script

    30
    0 Votes
    30 Posts
    6k 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
  • Tracking Usage

    4
    0 Votes
    4 Posts
    700 Views
    G
    When I have collected usage information in the past I have done so only with the consent of the user. Furthermore the numbers simply go into a database and do not have names or locations attached. Many web sites today perform analytics. Even sketchucation performs a type of analytics to establish daily download numbers for plugins. The key bit is they don't track who downloaded - they just count the downloads. These are the download numbers for cab maker. You can see that the number of downloads gained momentum around the time Sketchucation featured my plugin. Now they have settled down. [image: iwt9_analytics.png] Similarly, in the past I have counted some usage specs to determine if a feature is worth more development or not. Again I do not know or care who used the feature. For example - If I were going to gather info on my CabMaker (which I have not done), I would first ask the user if it is ok and then I would provide them with a configuration that they could turn on / off anytime they want. The info could be something like this for Cabinet counts: Standard=155 Sink=6 Angled=1 Return=5 Left Blind=0 Rignt Blind=0 Tall=1 This combined with users emailing me with wish lists would help me streamline the priorities for further programming.
  • Need help with specific dimension plugin

    11
    0 Votes
    11 Posts
    1k Views
    K
    Oh, my! It works! Thank you guys so so much! TIG you are a Ruby wizard! Thank you for your patience So, here is my final result: http://youtu.be/nqLcLDSt1pM?hd=1
  • Wrong cloning of Sketchup::Color objects

    9
    0 Votes
    9 Posts
    1k Views
    Dan RathbunD
    @fredo6 said: However, and wrongly, I thought Sketchup::Color was just an encapsulation of a 4-value array ... But that does bring up a very good point, that because it is compatible with an array (ie, has a to_a method and it's constructor accepts an array,)... making a clone method is beyond simple: For Ruby 2.0+; module Fredo6;;Cloner refine ;;Sketchup;;Color do def clone() self.class;;new(self.to_a) end end end using Fredo6;;Cloner module Fredo6;;SomePlugin # code that uses refined Color class end
  • Error message : 'reference to deleted Entities'

    6
    0 Votes
    6 Posts
    1k Views
    J
    Wild guess - he started a New model and so the @entities variable now refers to an invalid collection.
  • Ruby Classes

    2
    0 Votes
    2 Posts
    7k Views
    Rich O BrienR
    You could also just use the forums to ask questions as you hit problems.
  • Script to automate Texturing a surface -&gt; Render

    2
    0 Votes
    2 Posts
    547 Views
    C
    Here's what my input/output folders look like after the script: http://i.imgur.com/9yTBr90.png

Advertisement