πŸ”Œ Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download
  • Add_face gives error duplicate point in array

    16
    0 Votes
    16 Posts
    3k Views
    G
    In this example I increased the width of the stringer which results in a small triangle that you can see. Width is 304 mm. Where the sketchup error occurs the stringer width was 300 mm and the small triangle would not be visible at this zoom. What I have done for now, which works in these type of situations, is simply use a rescue block. I would normally consider this bad form as it can hide errors. This code only works on the last section when the stair has a heel and when we should have a triangle. The sketchup error was misleading and cost me a bit of time trying to track this down. begin # try to add the face ent.add_face( pts ) rescue puts( pts ) if ( debug_level > 0 ) end Any thoughts on this? [image: EYAC_collinearissue.JPG]
  • Variables - issue

    7
    0 Votes
    7 Posts
    383 Views
    artmusicstudioA
    @massimo said: Moved to developers forum. Hi Stan, would you mind to post such threads in developers section of the forum? Usually the newbie section is about SU's usage. Thanks. hi massimo, sorry, of course, didn't think about that , i'll be carefull in the future! stan
  • Soften-Edges using by ruby

    23
    0 Votes
    23 Posts
    5k Views
    TIGT
    The unexpected reversion of smoothed edges to solid is a known bug. Never save when in a edit session. Even an auto-save can trigger this, so never stay inside an edit session for longer than you need to...
  • Error in 'require' when running via Sketchup Bridge

    11
    0 Votes
    11 Posts
    1k Views
    P
    You're not going to believe me, but the puts wasn't working in the Ruby console for the past 2 days, but it just started working right now. Ghost in the machine I guess. I'm still getting a crash when I run the motion_sample.rb script I mentioned above. I think it might have to do with not being able to access the gems, although there is no error message. I'm investigating it and will get back with any questions. Thanks again!
  • Find the location of an object using Ruby

    20
    0 Votes
    20 Posts
    3k Views
    Dan RathbunD
    You should study the drawline.rb in the "Examples" sub-dir.
  • Detect update scene

    34
    0 Votes
    34 Posts
    5k Views
    TIGT
  • Selection order

    2
    0 Votes
    2 Posts
    256 Views
    TIGT
    The native 'select' tool will often return its array in the order of picking, BUT this is not guaranteed, and of course if you pick a curve, then all of its edges are added in the curves edges' order... You can make a Tool class... where the selection is initially cleared and the user is prompted to select things - these can be added to the model.selection, and also in that case each selected object can be pushed into your own array, so you can be sure of the order of that array's order of picking... What is it exactly your seek to achieve ?
  • Load text file and assign to variables

    7
    0 Votes
    7 Posts
    996 Views
    artmusicstudioA
    hi tig, that's it . my logic was ok, your tip for the conversion of string to float was the point. basicly it works like this: i have menues for parameters then the geometry is created before the end of the ruby i save all parameters to a text file (by the way still looking for the syntax to save more of them line by line) then the user can recall the ruby and select -my last parameters -defaults and so on and so on again another step!!!! regards stan ( i'll report , when i get further)
  • PROBLEM WITH PUSHPULL VECTOR

    3
    0 Votes
    3 Posts
    322 Views
    artmusicstudioA
    hi tig, you are the greatest, as always. it works. it's funny, that "my" wrong syntax works at the beginning of the ruby...god knows....will correct all of them. again a step nearer to my first ruby (for everyone then, of course) regards and thax stan
  • Creating revenue from plugins

    9
    0 Votes
    9 Posts
    849 Views
    renderizaR
    Hi, With the introduction of 'PluginStore' and 'Extension Warehouse' it has become more accessible for developers to share plugins and maybe in the near future these platforms will allow authors to sell them as well. (fingers crossed) As of right now donations are a welcome addition to 'PluginStore' and even though there are people who have generously donated, this kind of appreciation is considered a rare event. Most of them will thank you by leaving a nice comment and this can be very rewarding as well. Selling plugins will hopefully inspire developer to increase the production value of their plugins so they can have an edge vs competitors. Not only the code should improve but also the interface, graphics, documentation, ect... On the other hand I am afraid to see the dark side of competition which I am sure you guys can think of a few. Cheers!
  • Angles to vector

    4
    0 Votes
    4 Posts
    361 Views
    TIGT
    There is no inbuilt method... but this will do it [flattened to Z-plane] def flat_angle(vector) vec=Geom;;Vector3d.new(vector.x, vector.y, 0) if vec.y < 0 return (2*Math;;PI)-(vec.angle_between(X_AXIS)) elsif vec.y > 0 return vec.angle_between(X_AXIS) elsif vec.y == 0 if vec.samedirection?(X_AXIS) return 0 else return Math;;PI end end end it's easy to make methods for X & Y planes - just adjust vec= to suit those other planes and adjust the tests from vec.y & _AXIS etc...
  • What's the :: symbol on Geom::....

    3
    0 Votes
    3 Posts
    387 Views
    Dan RathbunD
    @abakobo said: what's behind the :: symbol in Geom ? It is called the scope operator. :: with nothing to the left of it means the top level scope (aka TOPLEVEL_BINDING,) which is "a particular instance of Object called 'main'". But it's use that way is optional. Ruby always checks the current scope first, then the top level scope if it needs to. But this is also why you should always be executing YOUR code inside a toplevel module, with some unique name that you invent. like module Abakobo So Geom::Point3d is referring to the Point3d class, within the Geom module scope. @abakobo said: and when do we use :: and/or . to call a method It's style, but many people only use the . for ALL methods. Some people use :: for calling module functions and class methods (which the new constructor is,) and then use . to call only instance methods. (Some of the older examples, from the days when SketchUp was owned by Google or @Last Software, use this latter convention. I guess they wanted to emphasize the calling of class methods or module functions.)
  • Mac Scrambler for 2013

    11
    0 Votes
    11 Posts
    1k Views
    tt_suT
    Can you send me the RB and RBS file you are working with? I'd like to hook this up to our own debugger.
  • Remove_observer bug?

    3
    0 Votes
    3 Posts
    379 Views
    fuzzybroF
    It's a pseudo-code. The actual code implies that observer object is a class instance variable: class Scene attr_accessor(;observer) def initialize @observer = MyEntitiesObserver.new end def observe Sketchup;;active_model.definitions.each do |definition| definition.entities.add_observer @observer end end def unobservre Sketchup;;active_model.definitions.each do |definition| definition.entities.remove_observer @observer end end end
  • Is it possible to reset a transformation in loop?

    5
    0 Votes
    5 Posts
    417 Views
    2
    Oups! you're right. that's the problem! I am trying to make a dragon curve.
  • Rotation unexepected result

    3
    0 Votes
    3 Posts
    302 Views
    jolranJ
    Transform! executes/calls the method wheras transformation = is assigning it. tested your code and transformation = , did give me a same result as transform! The principle still is call method with object.method. Oh, and to answer the question. In this case were dealing with Geom::Transformation object. So were not calling a method directly(I think..).So its more like Group.Geom::Transformation = myspecial.Geom::Transformation I hope I explained it correctly.. If you test t0.class you will see it's a Geom::Transformation.object
  • How to store web-dialog parameters/settings?

    5
    0 Votes
    5 Posts
    809 Views
    renderizaR
    It works! Did simple test that saved some of the web-dialog settings. def activate @@check = "start" end def deactivate(view) @@check = "end" end def push_frame(dialog,data) params = query_to_hash(data) ################ ## START ## ################ if @@check == "start" @@check = "no" saved = Sketchup.read_default("canvas_panel", "store_dlg") UI.messagebox saved #Will prompt last selected value before closing from web-dialog end ################ ## END ## ################ if @@check == "end" @@check = "no" inp = params['sel_ip'].to_s #This is value from web-dialog Sketchup.write_default("canvas_panel", "store_dlg", inp) end end Need to do what TIG suggested which was to make array into string to store multiple web-dialog settings. After that will have to use that data to make web-dialog use the settings last used when it was last closed.
  • [code] ruby-dxf-reader

    15
    0 Votes
    15 Posts
    4k Views
    DavidBoulderD
    @jim said: Hi David, I put it up on GitHub. Thanks!! I'll check it out this weekend. David
  • SketchUp Dev Camp 2013 - A Developer Conference

    3
    0 Votes
    3 Posts
    606 Views
    G
    See you at Lisbon
  • Rotate and Intersect a plane

    7
    0 Votes
    7 Posts
    542 Views
    TIGT
    Please stop calling them 'lines' - I know that's the CAD name but in SketchUp Ruby code they are best called 'edges' - I know some SketchUp tools refer to drawing 'lines' and there's even an API method add_line() that adds an edge BUT when we are talking code - especially if we are taking about edge.line - it's a recipe for confusion to muddle up the two terms... I tried to explain the difference between an edge and a line [edge.line]... The two perpendicular edges you drew will only return a point with the intersect_line_line() IF they intersect - i.e. they are 'coplanar'... looking down 'in plan' does not mean they do intersect if their 'z' values not equal... Assuming they do return a point, then my previous post explains how you can then tell if that point falls 'in space', or either of the edges' vertices, or on an edge in between its start/end... It'd be quite possible to slide your example edges around so that they then return a point 'in space' that is on neither edge...

Advertisement