ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Geometry, Transformation, and Scaling

    5
    0 Votes
    5 Posts
    524 Views
    A
    Tnks! All logical and useful
  • BitBucket Basics / Git Tips

    6
    0 Votes
    6 Posts
    576 Views
    Dan RathbunD
    Great Idea, I was wondering how to do that. Done.
  • How to rotate an object in ruby?

    2
    0 Votes
    2 Posts
    113 Views
    thomthomT
    Geom::Transformation.new( origin, zaxis ) <- that isn't a rotation transformation. To rotate you must use one of these formats. Geom::Transformation.new( pt, axis, angle ) Geom::Transformation.rotation( point, vector, angle ) https://developers.google.com/sketchup/docs/ourdoc/transformation#rotation But what is not clear is this: "how to rotate an object in the direction of the cursor" What do you mean by this?
  • Can Sketchup receive Window message?

    7
    0 Votes
    7 Posts
    202 Views
    thomthomT
    @debbie said: @thomthom said: Maybe you can make a Ruby C Extension work for you? Ruby C extension? seems useful! thanks. I made a Hello World project for getting Ruby C Extensions to work under SketchUp: https://bitbucket.org/thomthom/sketchup-ruby-c-extension
  • Complete Crash?

    4
    0 Votes
    4 Posts
    89 Views
    A
    OK...it doesn't crash if just before showing the savepanel I put a line of code to show a simple messagebox: then the savepanel shows. Although the messagebox is nowhere to be seen. Then I tried this code: if UI.messagebox("Save results to file?", MB_YESNO) == 6 savePath = UI.savepanel("Save results file",model.path,"Sunlight analysis.csv") # If the user doesn't press cancel; if savePath outfile = File.new(savePath, "w") outfile.write(allResults) outfile.close() end end Now when the execution reaches this point SU suddenly switches program, i.e. as if someone had pressed Alt+Tab. It's still there, but I have to reopen it. And the messagebox still isn't anywhere, hence neither is the savepanel. I just seem to have gotten the UI very confused in general.
  • Overflow bug?

    2
    0 Votes
    2 Posts
    98 Views
    daikuD
    Probably the result of dividing by "almost zero". Which in turn could result from a floating point roundoff error.
  • Intersect_with problems

    3
    0 Votes
    3 Posts
    795 Views
    sdmitchS
    Weird indeed but moving the prism up 1mm solves the problem.
  • .edges returns a face

    9
    0 Votes
    9 Posts
    230 Views
    K
    Dan - the bug came immediately after: if e.is_a? Sketchup::Edge ... it was very strange, and as I said, happened once in a great while - I couldn't figure out how to make it happen on command.
  • Basics - creating components and pushpull direction

    8
    0 Votes
    8 Posts
    250 Views
    TIGT
    Getting there... When you make a new definition add geometry to it immediately. Empty definitions/groups don't survive in code... Try something like: unless unit_block=def_list["unit_block"] unit_block=def_list.add("unit_block") ### add geometry to unit_block.entities ### add description to unit_block.description ### etc end ### now add instance, knowing the definition exists and has geometry which might be clearer? You don't need to add geometry to the component if it already exists ! Another tip - use Timber.new(bPD,bPW,bPL) not Timber.new (bPD,bPW,bPL) don't leaves a space in front of the arguments' ()
  • Puzzling position of axes when inserting a component

    9
    0 Votes
    9 Posts
    220 Views
    Dan RathbunD
    @tim said: ..., for this case as an example, one could actually create a blank page and set it up as needed rather than having a rather cockeyed 'new' message that actually creates, does setup that isn't wanted and then leaves one to work out how much to undo… right now it isn't 'new' but 'copy'. Well we are supposed to be able to do this with the flags argument in the add() method. see page.update() for an explanation of the flags. What it is missing, is a camera argument. It assumes you wish to copy the current view.camera So you have to modify the new page's view / camera after it is created. (It gets set to the current selected page, whether you want this or not.)
  • Curved surfaces with Ruby

    8
    0 Votes
    8 Posts
    959 Views
    thomthomT
    @alexmojaki said: Also glad to understand what soft and smooth edges are. For a detailed breakdown of what each property does (soft and smooth has very distinct functions) check out this article: http://www.thomthom.net/thoughts/2012/06/soft-vs-smooth-vs-hidden-edges/
  • Multiple attribute dictionaries created

    6
    0 Votes
    6 Posts
    614 Views
    Dan RathbunD
    @archidave said: ... Since I was thinking along these lines, I was expecting the attribute dictionaries to behave in a similar way to creating instance variables; ... Nothing is stopping you from doing so. You can create a custom class (within your plugin namespace module,) for a Wall, that has instance variables, that are loaded from an entity's attribute dictionary. If you just save the values as an array, into a single attribute, you can use Ruby's iterator loops or methods, to load the values into instance variables. So the names of instance variables, are defined by a literal array inside your class, an the initialize method iterates this array, matching it's indexes, with the indexed values in the dictionary array. module ACME module BIMinator DictName = 'ACME_BIMinator' class Wall Atts = [;area,;thickness,;paint] attr_accessor( *Atts ) # expand array Atts to parameter list def initialize(entity) @prop = entity.get_attribute(ACME;;BIMinator;;DictName, 'properties') Atts.each_with_index {|att,i| method("#{att.to_s}=").call(@prop[i]) } end end # class end # BIMinator end SO.. the actual attribute names are defined in ONE place, your custom class.
  • Vertical anchoring of 3D text

    6
    0 Votes
    6 Posts
    2k Views
    A
    @tig said: The text-string affects the result. "V\nE\nR\nT\nI\nC\nA\nL" V E R T I C A L That did it! thank you so much!
  • How to get entities from selection?

    11
    0 Votes
    11 Posts
    591 Views
    thomthomT
    Sample test model?
  • Get Current Axes Position/Orientation

    10
    0 Votes
    10 Posts
    2k Views
    thomthomT
    @dan rathbun said: Just a note, that in playing around (I did not realize this before,) that custom "User" Axes can be saved within a ScenePage. Yea, I often set up Scenes that adjust just the axis. All though, with SU8 now automatically adjusting the model axis to match component axis there's less need of it for my use. Works well when you have a building with axis in various directions.
  • Calculate edge &quot;profiles&quot;?

    3
    0 Votes
    3 Posts
    755 Views
    A
    TIG, your profetional! Everything works, the way you said [attachment=1:ylsl8vni]<!-- ia1 -->SelectEdgesInProfiles.png<!-- ia1 -->[/attachment:ylsl8vni] Here's a little plug I've got for a little testing. [attachment=0:ylsl8vni]<!-- ia0 -->SelectEdgesInProfiles.rb<!-- ia0 -->[/attachment:ylsl8vni] %(#00BF00)[Select Edges in Profiles Date - Monday, July 16, 2012 Version 1.0.1 Main thing on how to locate the edges in profiles is by TIG Written by Anton Synytsia Not a plugin, but written for simple use of testing Menu Location: UI_menu:plugins/selectEdgesInProfiles Usage: Select grp(s) or/and component instance(s) and then select the menu item Yet, Unsolved bugs: Selects edges that camera doesn't sees. TIG.getEdges function doesn't yet search the group for edges found inside the parent group.] Changes: Fixed the selection of edges behind the faces, the edges that camera doesn't even sees. Save to Plugins directory
  • Find point, axis and a rotation angle

    11
    0 Votes
    11 Posts
    740 Views
    TIGT
    There are several Examples of Tool .rb files shipped with Sketchup - e.g. LineTool. These will show how to construct and then call a Tool class, which then has access to lots of methods relating to user input - mouse, keys etc - without you having to reinvent them from scratch... Also see the API docs... https://developers.google.com/sketchup/docs/ourdoc/tool
  • How to add an entity to entities?

    3
    0 Votes
    3 Posts
    68 Views
    lbsswuL
    @thomthom said: You're aware of the API documentation, right? https://developers.google.com/sketchup/docs/classes The Entities class has many method to add entites - depending what you want to add: https://developers.google.com/sketchup/docs/ourdoc/entities You're not talking about adding an existing entity to a different Entities collection? I am sorry I made a mistake about the concepts of Sketchup::Entity and Sketchup::ComponentInstance. I have two car models, and I should use entities.add_instance to add a car.
  • How to get the center of a ComponentDefinition array?

    5
    0 Votes
    5 Posts
    101 Views
    lbsswuL
    @tig said: If you meant ComponentInstance then they each have bounds. Make a new empty bounding-box object [ bb], and then add each of the instance.bounds to that bb.add(instance.bounds). The center is bb.center......... Thanks for your tip. I will test the code.
  • VCB greyed out

    3
    0 Votes
    3 Posts
    293 Views
    Dan RathbunD
    Duke, ya need to get your files and folders organized (so you stop using global variables.) Separate the code into 3 files, thus: file: "Plugins/CKD_Thicken_ext.rb" ### # "Plugins/CKD_Thicken_ext.rb" require('sketchup.rb') require('extensions.rb') module CKD module Thicken @@plugin = SketchupExtension.new "Thicken", "CKD/Thicken/CKD_Thicken.rb" @@plugin.version = '1.0' @@plugin.creator = 'CKD (aka "Duke")' @@plugin.copyright = '2012, CKD' @@plugin.description = 'Uses JPP to thicken the select face/s directly or inside the selected groups' Sketchup.register_extension( @@plugin, true ) end # module Thicken end # module CKD file: "Plugins/CKD/CKD_module.rb" # ------------------------------------------------------------------------- # "Plugins/CKD/CKD_module.rb" module CKD @@topmenu = UI.menu('Plugins') @@submenu = @@topmenu.add_submenu('CKD') @@menuitem = {} def self.menuitem() return @@menuitem end def self.submenu() return @@submenu end def self.topmenu() return @@topmenu end end # module CKD file: "Plugins/CKD/Thicken/CKD_Thicken.rb" # ------------------------------------------------------------------------- # "Plugins/CKD/Thicken/CKD_Thicken.rb" require('sketchup.rb') require('jointpushpull.rb') require('CKD/CKD_module.rb') module CKD;;Thicken @@tool = nil class ThickenTool def initialize(caller_class) @caller = caller_class @thickness = 100.mm end def activate @model = Sketchup.active_model @selected = @model.selection Sketchup.set_status_text("Thickness", SB_VCB_LABEL) Sketchup.active_model.active_view.invalidate end def deactivate(view) view.invalidate @model = nil @selected = nil end def resume(view) @model = Sketchup.active_model @selected = @model.selection Sketchup.set_status_text("Thickness", SB_VCB_LABEL) Sketchup.active_model.active_view.invalidate end def suspend(view) nil end def onUserText(text, view) UI.messagebox("what") # call method thicken() here ? end def enableVCB? return true end def thicken model.start_operation("Thicken") # # change model here # model.commit_operation rescue Exception => e model.abort_operation puts("Thicken Error!\n#{e.message}") puts(e.backtrace) end end #Class ThickenTool class << self # Proxy class def tool() if @@tool.nil? @@tool = CKD;;Thicken;;ThickenTool.new(self) end # return @@tool # end end # Proxy class # RUN ONCE unless file_loaded?( 'CKD;;Thicken' ) CKD;;menuitem["Thicken"]= CKD;;submenu.add_item("Thicken") { Sketchup.active_model.select_tool( CKD;;Thicken;;tool ) } file_loaded( 'CKD;;Thicken' ) end end # module CKD;;Thicken

Advertisement