ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • RBeautify - Ruby Code Beautifier

    8
    0 Votes
    8 Posts
    2k Views
    Al HartA
    I found a different problem. I was using this code to set a string: (This loads all text up to the word HERE into a string with new lines, etc.) ` smess = <<HERE This face will not render in the material you have created, since it is on placed the reverse side of a face. Use "Setup Options/Special/Process 2 Sided Faces" to allow materials on reverse faces to be rendered. HERE` and the beautifier indented the last line (HERE) which cause the ruby to fail
  • Edge.all_connected to curve

    2
    0 Votes
    2 Posts
    269 Views
    D
    have a look at TIG_weld.rb, you can even run it from your own script using require...
  • Auto show plugin window at startup

    9
    0 Votes
    9 Posts
    1k Views
    Dan RathbunD
    @sawdust_online said: Tell me, can we deal with sketchup API and another language than Ruby? ... is there any other way ? You can write extensions in C & C++. @sawdust_online said: I use it for about a week but I'm not sure to go deeper. At first it looks as a strongly typed language easy to use for developers but this doesn't turn real. How a language could be easy if it requires two keys for commenting a single line? it's the first time I meet such odd thing! It would be better to start a new topic about the Ruby language. Or repost your thoughts to one of the old topics... Should we / could we learn Ruby? Where to Start with Ruby?
  • Questions on Styles and Rendering options

    12
    0 Votes
    12 Posts
    741 Views
    CadFatherC
    api definitely needs some development here, you cannot even do a style.erase command. (just purge) i looked inside a *.style file (aka zip), hoping to find some hints. some obscure numbers which surely must be pointing to the settings like face colours etc, but too cryptic. not to mention watermarks.
  • Transformation.x/y/zaxis and transformation.axes

    4
    0 Votes
    4 Posts
    376 Views
    Dan RathbunD
    @oajfh said: Perhaps there's an implicit point to vector conversion or vice-versa, but in that case the API makes no mention of it. In mathematics, both are represented as arrays. @unknownuser said: ** class](http://www.sketchup.com/intl/en/developer/docs/ourdoc/array.php)":1hykbm7x] Introduction The SketchUp Array class adds additional methods to the standard Ruby Array class. Specifically, it contains methods allowing an array to behave just as a Vector3d or Point3d object (which can be thought of as arrays of 3 coordinate values.) Therefore, you can use the Array class in place of a Point3d or Vector3d as a way to pass coordinate values. The opposite is also often true, as well. The API docs need updating in regard to allowable parameter types. P.S. - The docs are misleading when it says "The SketchUp Array class ..." There is only one Array class. The SketchUp API just modifies the Ruby Array base class.
  • Make SketchUp API to recognize System PATH

    3
    0 Votes
    3 Posts
    446 Views
    G
    Thanks, Dan! Your answer does give A LOT of food for thought. I will try someof these and let you know. Regards
  • Get the coordinates of the corners of the viewport

    31
    0 Votes
    31 Posts
    2k Views
    A
    I'm not sure if I used any C++ 11 syntax in that C++ extension, but Ruby C++ extensions as a whole give so much opportunities to writing great plugins in SU. I'm amazed that SU team chose Ruby over all available programming languages. Back then, when SU was first released, Ruby wasn't even popular, but SU team bypassed popularity and chose Ruby because Ruby was both simple and powerful due to a feature in supporting C extensions. Today, Ruby is becoming popular and is improving in performance and in features. Something tells me that SU had and still has really great minds behind it because choosing Ruby was the best path SU team could ever take. Imagine if they chose python or any other high level, limited programming language. SU would have been a totally different story from what it is today. Huge thanks goes to SU team for making SU a very great software for writing powerful plugins.
  • Transformation

    4
    0 Votes
    4 Posts
    358 Views
    tt_suT
    You might find it useful to use the Transformation Inspector to visualize the matrix: http://extensions.sketchup.com/en/content/transformation-inspector
  • HoloLens and SketchUp

    2
    0 Votes
    2 Posts
    2k Views
    Dan RathbunD
    Corrected link: http://www.engineering.com/DesignerEdge/DesignerEdgeArticles/ArticleID/10051/Microsoft-to-bring-Immersive-3D-to-AEC-Models-with-HoloLens-and-SketchUp.aspx
  • MySQL connexion

    3
    0 Votes
    3 Posts
    342 Views
    Dan RathbunD
    @inteloide said: Is there any way to link Sketchup to a MySQL database in pure ruby ? (1) I believe, You or whomever runs the Server still need to install MySQL: http://dev.mysql.com/downloads/windows/installer/ From Ruby Console: (2) Gem::install "ruby-mysql" (Pure-Ruby edition - C edition is "mysql" gem.) source: https://github.com/tmtm/ruby-mysql gem: https://rubygems.org/gems/ruby-mysql doc: http://www.rubydoc.info/gems/mysql/ (3) Gem::install "dbi" gem: https://rubygems.org/gems/dbi doc: http://www.rubydoc.info/gems/dbi (4) Gem::install "ruby-odbc" gem: https://rubygems.org/gems/ruby-odbc doc: http://www.rubydoc.info/gems/ruby-odbc
  • ID - Definition Name

    2
    0 Votes
    2 Posts
    283 Views
    TIGT
    You are asking about several different things... model = Sketchup.active_model defns = model.definitions ### the definitions in the model - components/groups/images p defns[0].methods.sort ### for list of a definition's available methods - also see API guide http://www.sketchup.com/intl/en/developer/docs/classes.php defns.each{|d| p d.name ### name of defn p d.instances[0].name if d.group? ### name if it's a group p d.get_attribute("dynamic_attributes", "_name", "???") ### if DC 'name' or '???' if not. p d.guid ### the unique GUID for the definition - Note: this only enduring across sessions in newer SketchUp version. }
  • Are any of you guys interested in programming work?

    9
    0 Votes
    9 Posts
    3k Views
    KrisidiousK
    And this post is from 3 years ago soooo... I think we could prolly just ditch it all together.
  • Import image (in padded cell..!)

    16
    0 Votes
    16 Posts
    629 Views
    Dan RathbunD
    @tig said: I assumed that if you stop a timer it's the same as ' break' in a block, so then it'd never get to image.erase!, but having tested it I see that it complete the entire iteration after the timer is stopped ! Of course it does. A timer just loops and calls the block on the set interval. (The setInterval timers in Javascript work the same way.) This why you should always stop the timer immediately when the condition is met. Otherwise the block gets queued up to be executed again, perhaps even before the first time is done doing it's work. @tig said: I don't immediately see the advantage of using @tid over tid - the block of code executed by the timer is referring back to itself, ... Sometimes it works. But I have experienced that in some situations, the ID reference becomes invalid (perhaps gets garbage collected.) And then the call to stop the timer does not work. [I remember having a discussion with Jim Foltz about timer IDs being invalid, or garbage collected.] The Ruby docs say a proc is supposed to have access to it's environment (like a snapshot,) when it is defined. But the API UI timer is implemented on the C++ side. @tig said: ... it's not like we are stopping it in another def method ? I always assume code samples are going to run in a method. It is rare that code is something that runs once at startup, (although we sometimes do post code like that.) THIS feature we are discussing, is something that will be used "on demand" (by a end user,) in a Tool class or a UI::Command, which means it'll likely be wrapped in a method. Bottom line, ... the above is my best advice on best practice. Believe or not, as you will. It is not arbitrary. I have had timer use fail in the past when using local var for the id. Perhaps under Ruby 2.0, things have changed with regard to the timer IDs, .. but I still always use a persistent reference for timer IDs on the Ruby side, until I know it is no longer needed. As far as using rescue in modifier position goes, that is a no brainer. (And is not a best practice rule I made up. I got it from one of the Style Guides or maybe the "Pick-Axe" book.) begin; statement; rescue; end is just plain uglier, and doesn't read as nice as: statement rescue nil
  • 2D Export &gt; Export All Scenes?

    20
    0 Votes
    20 Posts
    12k Views
    J
    Thanks for all the replies even though it sounds as though what I want isn't easily obtainable! Yes, I was talking about Didier's ADO plugin. I'll remove the files from my plugins folder as suggested though they didn't get loaded by SU 2015 at all that I could see. Jon
  • PLUGIN - some help please

    4
    0 Votes
    4 Posts
    391 Views
    xombie1912X
    @tig said: So, what I see is a parametric 'box', which is an effective 'wall'. What is it you are trying to do in a SketchUp Plugin ? There are already some examples of parametric forms - e.g. su_shapes available from the EW... THANKS TIG i want to do a block workflow this is a older research i made with autocad and sketchup http://www.youtube.com/watch?v=Q4hqt_aNuog sorry its in spanish language because its an older research i made its like revit or archicad the problem i have in this research its the time for export and the materials and my new research i want to do its make a plugin can swap 1 component and other instances for other component with no exactly the same name example in autocad i use component bed-A if i export to sketchup i want to select and replace for bed-B or bed-C bed-A its a line block in autocad bed-B its model for sketchyp in the same folder the bed-A is and the bed-C its proxy the final result you can swap or replace every autocad blocks you work for sketchup 3d models or proxys with a few clicks in sketchup
  • Delete hidden geometry

    3
    0 Votes
    3 Posts
    1k Views
    B
    Ok found it, I installed the thomthom's CleanUp toolset and using the "merge faces" did the trick (5119 faces merged). Saved me a lot of work thanks for the suggestion! Regards, Boein
  • Test Comp to see if it has Nested Components

    4
    0 Votes
    4 Posts
    371 Views
    Dan RathbunD
    A bit shorter ...more brute force. The any? enumerable method returns boolean and stops on the first true result: return unless obj.respond_to?(;manifold?) ents = obj.entities rescue obj.definition.entities any = ents.any? {|e| e.is_a?(Sketchup;;ComponentInstance) } exp = any ? "Yes" ; "No"
  • PolygonMesh triangulation... ?

    23
    0 Votes
    23 Posts
    2k Views
    thomthomT
    IN Ruby 1.8 for loops used to be faster - at least in the tests I performed on my extensions. But Ruby 2.0 swapped that around. In any case - you don't really know until you profile your specific case.
  • Plane

    3
    0 Votes
    3 Posts
    351 Views
    S
    As happens too often in the API docs, they give a technically correct but superficial definition and expect you to figure it out on your own. If you care, when a plane is represented as [Point3d, Vector3d] The point is a location on the plane, and the vector is the normal to the plane. When a plane is represented as a four-element array, the first three values are the x,y,z components of the normal vector to the plane, and the fourth value is the distance from the origin to the plane along the normal vector. Face#plane returns this version.
  • Passing instructions to active tools

    4
    0 Votes
    4 Posts
    353 Views
    thomthomT
    Yea, even the Line tool has a lot of details. I've been replicating Rotate and Move in Vertex Tools. So much more than I originally though. Recently I started on a custom version of PushPull - it's giving me nightmares...

Advertisement