⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Intersect_with revisited

    27
    0 Votes
    27 Posts
    3k Views
    C
    @sdmitch said: Perhaps but then you have the added burden of figuring out what is horizontal and what is vertical. Creating a group for each edge seems to work every time and does so fairly quickly. The trouble is that entities.add_group becomes very slow after a while. Nevertheless, I've attached my final version. It divides the edges into classes based on orientation, and these classes are then further divided into groups of max 250 edges. All examples seems to merge correctly. There is also some verification built into the code. I encountered this problem in flowify where the (extended) projection grid intersects the geometry and even though distributing the edges over many groups alliviated the problem it did not fully solve it, so I'm quite happy to have found a better way. As a general observation, intersection is really two distinct problems, the first is to find the intersection edges and the second is to merge the geometry. My biggest problem with intersect stems from the first part. A face in Sketchup does only have to be almost flat while the intersection between two faces is computed from two exactly flat mathematical planes. This means that the intersection edges may fail to merge with the not-exactly-flat face due to tolerance issues. I've found that the following procedure produces a more robust intersect, especially for complicated surfaces: 1) Transform the geometry to a gigantic scale 2) Check all faces by computing a plane form the vertices and then check that all vertices are on that plane. If they are not, then triangulate the face. 3) Intersect Complicated grids.. GridTest.rb
  • [Question] Switch of model and Interactive Plugins on Mac

    6
    0 Votes
    6 Posts
    552 Views
    S
    As John's animation shows, it isn't a matter of each model not having its own Tool activated, it is an issue with SketchUp duplicating certain view.draw_xxx contents on all existing views. This is a bug we reported some time ago.
  • [Idea] Paint brush

    3
    0 Votes
    3 Posts
    1k Views
    T
    i think its better to have this idea, in terms of applying, you can overlay materials with another material looks like photoshop in 3d plugin
  • Create arbitrary shape from list of points

    4
    0 Votes
    4 Posts
    545 Views
    W
    @tig said: Look at http://www.sketchup.com/intl/en/developer/docs/ourdoc/entities#add_faces_from_mesh Thanks for that TIG. I had a look at that and with my simple cube example, it did not quite give me the result i was hoping for. DO i need to manually join the other edges? [image: FxA4R7em.png] @dan rathbun said: Also look at how the SketchUp Team makes shapes in the Shapes plugin example: http://extensions.sketchup.com/en/content/shapes Thanks Dan. I have had a look at that and it seems to describe how to do basic shapes, however what I am looking at is a bit more complex (despite my example) and shaped more like a balloon, or a very irregular shape.
  • SketchUp-Ruby Resources

    29
    0 Votes
    29 Posts
    121k Views
    Dan RathbunD
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |--<<< RUBY RESOURCES >>>--| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Ruby Newbie's Guide to Getting Started viewtopic.php?f=180&t=10142&start=15#p298780 TUTORIALS & PRIMERS ~ Ruby (Generic) ~ Introduction to Ruby http://www.ruby-doc.org/docs/Tutorial/ Ruby User's Guide by Mark Slagell, Iowa State University http://www.rubyist.net/~slagell/ruby/ Ruby Study Notes by Satish Talim http://rubylearning.com/satishtalim/tutorial.html Learn to Program by Chris Pine http://pine.fm/LearnToProgram/ ~ Sketchup Specific ~ Edges to Rubies - The Complete SketchUp Tutorial by Martin Rinehart http://www.martinrinehart.com/models/tutorial/ Ruby Tutorials SketchUcation Forums http://forums.sketchucation.com/viewtopic.php?p=52665#p52665 Tutorial Index SketchUcation Forums http://forums.sketchucation.com/viewtopic.php?f=18%26amp;t=8767 BOOKS ~ Offline (PDF, CHM, TAR, etc.) ~ The Book of Ruby by Huw Collingbourne ** PDF http://www.sapphiresteel.com/IMG/zip/book-of-ruby.zip The Little Book of Ruby by Huw Collingbourne ** PDF http://www.sapphiresteel.com/IMG/pdf/LittleBookOfRuby.pdf Mr. Neighborly's Humble Little Ruby Book by Jeremy McAnally ** PDF http://www.humblelittlerubybook.com/book/hlrb.pdf Programming Ruby - The Pragmatic Programmer's Guide, 1st Ed. (aka "The Old Pick-Axe Book" circa Ruby ver 1.6.x) by David Thomas and Andrew Hunt ** TAR archive of website http://phrogz.net/ProgrammingRuby/ProgrammingRuby_20061016.tar.gz ** CHM edition file is included w/ Win 1.8.6 One-click install see your /ruby/doc directory OR [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=10142%26amp;p=431798#p431798:23sdyhrr]download from SketchUcation[/url:23sdyhrr] Extending Ruby 1.9 - The Pragmatic Programmer's Guide by David Thomas [url:23sdyhrr]http://media.pragprog.com/titles/ruby3/ext_ruby.pdf[/url:23sdyhrr] Ruby Best Practices by Gregory T. Brown ** PDF http://sandal.github.com/rbp-book/pdfs/rbp_1-0.pdf Automatic SketchUp by Matthew Scarpino, Eclipse Engineering LLC [url:23sdyhrr]http://www.autosketchup.com/downloads/Automatic_SketchUp.pdf[/url:23sdyhrr] ~ Online ~ [i:23sdyhrr]Ruby Essentials[/i:23sdyhrr] Techotopia [url:23sdyhrr]http://www.techotopia.com/index.php/Ruby_Essentials[/url:23sdyhrr] Programming Ruby - The Pragmatic Programmer's Guide, 1st Ed. (aka "The Old Pick-Axe Book" circa Ruby ver 1.6.x) by David Thomas and Andrew Hunt [url:23sdyhrr]http://phrogz.net/ProgrammingRuby/frameset.html[/url:23sdyhrr] OR [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=10142%26amp;p=431798#p431798:23sdyhrr]download from SketchUcation[/url:23sdyhrr] ~ Previews of Ruby Books for Sale ~ [i:23sdyhrr]Learn to Program, 2nd Ed.[/i:23sdyhrr] by Chris Pine (expanded from the original tutorial) [url:23sdyhrr]http://www.pragprog.com/titles/ltp2/learn-to-program-2nd-edition[/url:23sdyhrr] [i:23sdyhrr]Programming Ruby - The Pragmatic Programmer's Guide, 2nd Ed.[/i:23sdyhrr] (aka "The New Pick-Axe Book" circa Ruby ver 1.8.x) by David Thomas, with Chad Fowler and Andrew Hunt [url:23sdyhrr]http://pragprog.com/titles/ruby/programming-ruby[/url:23sdyhrr] [i:23sdyhrr]Programming Ruby 1.9: The Pragmatic Programmers' Guide[/i:23sdyhrr] by David Thomas, with Chad Fowler and Andrew Hunt http://pragprog.com/titles/ruby3/programming-ruby-1-9 [i:23sdyhrr]The Ruby Programming Language[/i:23sdyhrr] by David Flanagan and Yukihiro Matsumoto http://books.google.com/books?id=jcUbTcr5XWwC%26amp;lpg=PA98%26amp;ots=fHGordbwjC... TECHNICAL REFERENCES [i:23sdyhrr]Ruby Cheatsheet[/i:23sdyhrr] [url:23sdyhrr]http://www.zenspider.com/Languages/Ruby/QuickRef.html[/url:23sdyhrr] [i:23sdyhrr]Ruby Base Classes - circa ver 1.6.x[/i:23sdyhrr] (but most still OK for 1.8.x which has more methods) [url:23sdyhrr]http://phrogz.net/ProgrammingRuby/builtins.html[/url:23sdyhrr] [i:23sdyhrr]Ruby Core Documentation[/i:23sdyhrr] (may be ver 1.9.x) [url:23sdyhrr]http://www.ruby-doc.org/core/[/url:23sdyhrr] [i:23sdyhrr]RDoc Documentation[/i:23sdyhrr] [url:23sdyhrr]http://rdoc.rubyforge.org/[/url:23sdyhrr] [i:23sdyhrr]RubyGems User Guide[/i:23sdyhrr] [url:23sdyhrr]http://rubygems.org/read/chapter/1[/url:23sdyhrr] [i:23sdyhrr]RubyGems Manuals[/i:23sdyhrr] [url:23sdyhrr]http://docs.rubygems.org/[/url:23sdyhrr] INDEXES [i:23sdyhrr]Resources[/i:23sdyhrr] (SketchUp Sage) [url:23sdyhrr]http://sites.google.com/site/sketchupsage/resources[/url:23sdyhrr] SKETCHUP SPECIFIC ~ API ~ [i:23sdyhrr]SketchUp Ruby API Cheatsheet[/i:23sdyhrr] by Alex Schreyer [url:23sdyhrr]http://www.alexschreyer.net/cad/sketchup-ruby-api-cheatsheet/[/url:23sdyhrr] [i:23sdyhrr]SketchUp Ruby API[/i:23sdyhrr] [url:23sdyhrr]http://code.google.com/apis/sketchup/[/url:23sdyhrr] [i:23sdyhrr]SketchUp Ruby API - Class Index[/i:23sdyhrr] [url:23sdyhrr]http://code.google.com/apis/sketchup/docs/classes.html[/url:23sdyhrr] [i:23sdyhrr]SketchUp Ruby API - Method Index[/i:23sdyhrr] [url:23sdyhrr]http://code.google.com/apis/sketchup/docs/methods.html[/url:23sdyhrr] [i:23sdyhrr]SketchUp Ruby API - Class Diagram[/i:23sdyhrr] [url:23sdyhrr]http://code.google.com/apis/sketchup/docs/diagram.html[/url:23sdyhrr] [i:23sdyhrr]Sketchup Ruby API Class Diagrams[/i:23sdyhrr] by Jim Foltz [url:23sdyhrr]http://sketchuptips.blogspot.com/2008/08/sketchup-ruby-api-class-diagrams.html[/url:23sdyhrr] [i:23sdyhrr]Google SketchUp API Blog[/i:23sdyhrr] [url:23sdyhrr]http://sketchupapi.blogspot.com/[/url:23sdyhrr] [i:23sdyhrr]PickHelper - Visual Guide[/i:23sdyhrr] by Thomas Thomassen [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=30232%26amp;p=266685:23sdyhrr]http://forums.sketchucation.com/viewtopic.php?f=180&t=30232&p=266685[/url:23sdyhrr] [i:23sdyhrr]WebDialogs - The Lost Manual[/i:23sdyhrr] by Thomas Thomassen [url:23sdyhrr]http://forums.sketchucation.com/download/file.php?id=36664[/url:23sdyhrr] ~ Indexes ~ [i:23sdyhrr]SketchUp-Ruby Resources[/i:23sdyhrr] [url:23sdyhrr]http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=10142[/url:23sdyhrr] ~ BBs / Forums ~ [i:23sdyhrr]Developers Forum - Google Groups[/i:23sdyhrr] [url:23sdyhrr]http://groups.google.com/group/google-sketchup-developers[/url:23sdyhrr] [i:23sdyhrr]Developers Forum - SketchUcation Community Forums[/i:23sdyhrr] [url:23sdyhrr]http://forums.sketchucation.com/viewforum.php?f=180[/url:23sdyhrr] ~ Code Snippets ~ [i:23sdyhrr]Code Snippets Index - SketchUcation Developers Forum[/i:23sdyhrr] [url:23sdyhrr]http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=28846[/url:23sdyhrr] ~ Plugins ~ [i:23sdyhrr]Plugins Index (by author) - SketchUcation Plugins Forum[/i:23sdyhrr] [url:23sdyhrr]http://forums.sketchucation.com/viewtopic.php?f=323%26amp;t=28782[/url:23sdyhrr] [i:23sdyhrr]Plugins Visual Index - SketchUcation Plugins Forum[/i:23sdyhrr] [url:23sdyhrr]http://forums.sketchucation.com/viewtopic.php?f=323%26amp;t=16909[/url:23sdyhrr] [i:23sdyhrr]Trimble SketchUp - Plugins (Download Page)[/i:23sdyhrr] [url:23sdyhrr]http://www.sketchup.com/intl/en/download/plugins.html[/url:23sdyhrr] [i:23sdyhrr]Trimble SketchUp - Ruby Scripts (Download Page)[/i:23sdyhrr] [url:23sdyhrr]http://www.sketchup.com/intl/en/download/rubyscripts.html[/url:23sdyhrr] [i:23sdyhrr]Jim Foltz SketchUp Plugins[/i:23sdyhrr] [url:23sdyhrr]http://sketchuptips.blogspot.com/2007/09/plugin-index-page.html[/url:23sdyhrr] [i:23sdyhrr]Ruby Libray Depot[/i:23sdyhrr] ! URL Removed due to too many outdated plugins ! [i:23sdyhrr]Smustard(TM) - Plugins and Scripts[/i:23sdyhrr] [url:23sdyhrr]http://www.smustard.com/scripts/[/url:23sdyhrr] [i:23sdyhrr]JohnJ - Plugins for Sketchup[/i:23sdyhrr] [url:23sdyhrr]http://www.johnj.com/drawing/sketchup/ruby-plugins-for-sketchup/[/url:23sdyhrr]
  • Include paths

    3
    0 Votes
    3 Posts
    429 Views
    Dan RathbunD
    IN Ruby you can do interpolation in double-quoted strings with the #{ } operator. The expression between the curlies is evaluated and passed to the result's to_s method, then stuffed into the string. So you'd create a string of html: html = %Q{ <html> <head> <base href="#{myroot}" /> <link rel="stylesheet" href="resources/css/webdialogs.css" /> </head> <body> </body> </html> } my_dialog.set_html(html) You can also use a HEREDOC. See: http://ruby-doc.org/core-2.0.0/doc/syntax/literals_rdoc.html
  • Tool: getMenu and toolbar

    8
    0 Votes
    8 Posts
    702 Views
    bomastudioB
    Thank you Dan. I'm going to study....
  • Simple Building Generator

    8
    0 Votes
    8 Posts
    2k Views
    R
    @unearthed said: being able to 'populate' and area quickly would be a real advantage. Would also be useful to be able to quickly show how an area could change over time say with single-floor buildings being replaced with multi-floor. Hi, I've managed to have a solution for the urban growth, however it's a pity you'd still have to growth it manually @unearthed said: Also many council GIS's are starting to to put building outlines online and this could 'build' from those... If it's not troubling you so much, could you share some websites or keywords to get those building outline? I'm sure it'll help a lot of people
  • Are there plugins for Layout?

    4
    0 Votes
    4 Posts
    1k Views
    Dan RathbunD
    FYI IMSI DoubleCAD XT was a 2D CAD application, that could be plugged into SketchUp (like Layout can be.) It ran embedded Ruby, and had a clone of SketchUp's API. It development has been discontinued, but you may still be able the download the latest version. http://www.doublecad.com/DoubleCAD/DoubleCAD-XT-v5 http://activate.imsisoft.com/doublecad.aspx?productpage=DoubleCAD_XT_v5 QCad is a low cost (~37USD) 2D application, that has Javascript API & Qt GUI toolkit for plugins. http://www.ribbonsoft.com/en/ There is a free stripped down edition you can tryout. (But it cannot really be used for work. For example trying to add a layer brings up a nag box, saying that is a Pro feature.) FreeCAD is a 2D/3D Open Source free CAD application, that uses Python for extensions and custom workbenches. http://www.freecadweb.org/ http://sourceforge.net/projects/free-cad/
  • [REQ SU api] Set component axis

    5
    0 Votes
    5 Posts
    618 Views
    kimpastroK
    @tig said: Although it's convoluted you can do it already... You use: definition.entities.transform_entities(Geom::Transformation.translation(ORIGIN.vector_to(some_other_point_in_the_context)), definition.entities.to_a) to move the origin/insertion-point of the definition. If there are any existing 'instances' you'll also need to apply an inverse transformation to them ? If the axes are rotated you can also do a ...Geom::Transformation.rotation(anchor_point, axis_vector, angle)... and again you might need to fix any existing 'instances'... Sorry bring back this post but, with this is possible to do the second move (at right)? [image: l3DH_6.png]
  • Help with loading performance using Sketchup C SDK.

    2
    0 Votes
    2 Posts
    524 Views
    Dan RathbunD
    You can also ask your question at: http://forums.sketchup.com/c/developers/sketchup-sdk The SketchUp Team members are more likely to answer, more quickly.
  • Toolbar position

    6
    0 Votes
    6 Posts
    606 Views
    bomastudioB
    A lot of things to study..... many thanks Dan....you are a GURU!!!
  • Deleting Component Instance

    5
    0 Votes
    5 Posts
    804 Views
    bomastudioB
    Guys you are and invaluable support for SU developers.... a beer to all of you!!!
  • ComponentInstance Guid question

    12
    0 Votes
    12 Posts
    2k Views
    thomthomT
    EntityID are unique for the model - but entities will be assigned a new ID each time you open it. They are not persistent. There will not be two entities with the same entityID in a model. ComponentDefinition GUIDs change as you modify the definition. ComponentInstance GUIDs persist - even if you edit the instance/definition.
  • Access specifies entity

    3
    0 Votes
    3 Posts
    455 Views
    Dan RathbunD
    # Search top and 1st nested level for a named group; grps = Sketchup.active_model.active_entities.grep(Sketchup;;Group) if !grps.empty? found = grps.find {|grp| grp.name = "Target Name" } else found = nil end if !found # found will be nil, if group was not found nested = Sketchup.active_model.entities.find_all {|ent| ent.is_a?(Sketchup;;Group) || ent.is_a?(Sketchup;;ComponentInstance) } nested.each {|ent| ents = ent.is_a?(Sketchup;;Group) ? ent.entities ; ent.definition.entities grps = ents.grep(Sketchup;;Group) found = grps.find {|grp| grp.name = "Target Name" } if !grps.empty? } end # found will be the group reference, if it was found # found will be nil, if group was not found
  • Extract 3D information to regenerate the shape

    4
    0 Votes
    4 Posts
    746 Views
    Dan RathbunD
    SketchUp is a surface modeler. Everything in SketchUp is basically made up of edges, vertices, and faces. There are no complex built-in 3D shape classes in the SketchUp Ruby API. Instead primitives are either grouped into Group class instances, or ComponentInstance class instances. (Each have a defining ComponentDefinition class instance.) These mentioned classes are all sub-classes of Entity, and inherit it's functionality (as well as the intermediate Drawingelement class functionality.) Any Entity subclass instance can have any number of AttributeDictionary instances attached to them. You can put whatever custom data you wish into attributes in a custom dictionary, usually named the same as your plugin. (Ex: "Ruts_Shaper_Properties") Back to the grouped 3D shape. Groups and components have a built-in definition name and each instance of them can have a separate more unique instance name. Group and component instances have built-in transformation property, from which you can query all the translational, rotational, scaling and axial subproperties. See the Geom::Transformation class. All Drawingelement subclasses (the objects that can be seen in the model,) have an invisible boundingbox, from which you can get the corners and the center. See the Geom::BoundingBox class. It would be more efficient to create the basic shapes as an external SKP component library, and insert them into the model, rather than draw each using code, but drawing them adhoc can be done. You should most likely install the SketchUp Team's example Shapes plugin, and study the code. http://extensions.sketchup.com/en/search/site/Shapes
  • Variable values in attribute dictionaries

    8
    0 Votes
    8 Posts
    909 Views
    Dan RathbunD
    @ssunderland said: ` n=0 i=0 Sketchup.active_model.selection[n].set_attribute("Bubble","id",i); n+=1; i+=1` You are missing some basic knowledge of Ruby. Most of the API collection classes have the library module Enumerable mixed into them. http://ruby-doc.org/core-2.0.0/Enumerable.html It is usually safer (to avoid fencepost errors, etc.) to use the built-in block form iterator methods. Sketchup.active_model.selection.each_with_index {|ent,idx| ent.set_attribute("SSU_Bubble","id",idx) } If you want to process in reverse order, make an array copy of the selection, using to_a and the Array#reverse method: Sketchup.active_model.selection.to_a.reverse.each_with_index {|ent,idx| ent.set_attribute("SSU_Bubble","id",idx) } However, there is one major rule. Do not delete collection members while iterating the collection. The loop will lose it's place, and strange results occur. In that case, always iterate an array copy of the collection, if your loop must remove or add collection members. This is most often seen while modifying Entities collections.
  • Saving all instance variables of an object

    14
    0 Votes
    14 Posts
    1k Views
    A
    Bug posted in the GitHub Issues field!
  • Change color entity group

    3
    0 Votes
    3 Posts
    551 Views
    Y
    Excelente! Thanks very much!
  • This tripped me up (again) today

    25
    0 Votes
    25 Posts
    4k Views
    A
    Back to TIG's comment about plural vs. singular names for arrays, here is the way I'm naming things. In this context, the singular terms seem to work better for me, probably because I think of it as the mathematical notation P[sub:2dctu78y]0[/sub:2dctu78y], P[sub:2dctu78y]1[/sub:2dctu78y], ... P[sub:2dctu78y]N[/sub:2dctu78y]. =begin point[N] x-------------x point[0] angle[0] = angle_between vector[N], vector[0] vector[N] \ vector[N] = point[N], point[0] \ \ vector[0] \ vector[0] = point[0], point[1] \ x point[1] angle[1] = angle_between vector[0], vector[1] / vector[1] / vector[1] = point[1], point[2] / / / x point[2] angle[2] = angle_between vector[1], vector[2] =end

Advertisement