⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Name of texture

    6
    0 Szavazatok
    6 Hozzászólások
    359 Megtekintések
    G
    Thank you, TIG ! it works.
  • Set_position for modal dialog

    6
    0 Szavazatok
    6 Hozzászólások
    506 Megtekintések
    tt_suT
    I know that under OSX there are issues if you use the body.load event to modify the webdialog. It appear white until you click in the window - but I've not seen that under Windows. For the OSX issue the solution is to use the event that trigger when the DOM is ready. All though, I use jQuery to take care of cross-compatibility issues.
  • Functions in 'require' are not updated till restart..

    4
    0 Szavazatok
    4 Hozzászólások
    270 Megtekintések
    Dan RathbunD
    You should NOT be including ANY module like Math into the global objectspace, which is actually class Object. Everyone else's classes and modules will then inherit any change YOU make to the global objectspace! It does not matter whether you will be distributing or not. There is a right way to code. It is more about not corrupting other people's plugins. There is NO reason whatever for you to run code outside YOUR OWN module namespace. So pick a unique toplevel module name, like Guida or RG or whatever, and then define ALL your plugins as sub-modules of YOUR toplevel modulespace. Within each plugin module, define nested modules and / or classes, as needed by each plugin.
  • Building C extension compatibility

    13
    0 Szavazatok
    13 Hozzászólások
    945 Megtekintések
    tt_suT
    @anton_s said: [*]Modify LongDouble.c in ffi: Replace RSTRING_PTR(s) with (RSTRING(s)->ptr) in line Easier and more maintainable to add the macros if they are undefined: https://bitbucket.org/thomthom/tt-library-2/src/be17bac137aa5421323733cc206d80b9ff885dc4/Ruby%20C%20Extensions/win32-api/ext/tt_api.c?at=Version%202.9#cl-5
  • Retrieve the size of bounding box of selection

    23
    0 Szavazatok
    23 Hozzászólások
    3k Megtekintések
    M
    Nice all this but, i am new in ruby, how can i retrieve the size of all component... including sub-component? ` mod = Sketchup.active_model # Open model ent = mod.active_entities # All entities in model message = "" ent.each { |e| n = e.name scale_x = ((Geom::Vector3d.new 1,0,0).transform! e.transformation).length scale_y = ((Geom::Vector3d.new 0,1,0).transform! e.transformation).length scale_z = ((Geom::Vector3d.new 0,0,1).transform! e.transformation).length bb = nil if e.is_a? Sketchup::Group bb = Geom::BoundingBox.new e.entities.each {|en| bb.add(en.bounds) } elsif e.is_a? Sketchup::ComponentInstance bb = e.definition.bounds end if bb dims = [ width = bb.depth * scale_x, height = bb.width * scale_y, depth = bb.height * scale_z ] message = message + "Cabinet: " + n + "\nHeight: #{dims[0].to_l}\tWidth: #{dims[1].to_l}\tDepth: #{dims[2].to_l}" end } UI.messagebox(message, MB_MULTILINE)` I would like to have dimensions of all pieces of the cabinet. I know Cutlist. But i only need name of piece and dimensions. And Cutlist script is to complicated for me. Someone can help me with this? PLZ
  • Round corners and CSS3

    15
    0 Szavazatok
    15 Hozzászólások
    2k Megtekintések
    L
    More about CSS round corners....http://www.corelangs.com/css/box/round.html lynda
  • Selection !

    2
    0 Szavazatok
    2 Hozzászólások
    266 Megtekintések
    A
    The simplest way is to allow the user to select any entities. Just care only about those selected entities that are edges: edges = Sketchup.active_model.selection.grep(Sketchup::Edge) Let's say you now need to be sure there is a minimum of edges: return UI.messagebox("You need to select two or more edges.") if edges.length < 2 The cleanest way would be to implement your own tool class for selecting entities. You would use a PickHelper to get whatever is below the point that the user clicked, and only if it is an edge you would add it to an array or selection (actually you do not really need to add it to the real selection), and then draw/highlight what is selected. Don't do this until you have enough experience. If something does not work, please give complete (and minimal!) examples and say what does not work. All I could say about Sketchup.active_model.selection.each is that it raises an error because it is an iterator method with missing block ("each" is not "edge").
  • Observer interface (best practices?)

    9
    0 Szavazatok
    9 Hozzászólások
    1k Megtekintések
    A
    Hmm, thats a good example. Now, I won't have to use variables to tranfer data between two different class instances. Simply having 'em all in one class is good implementation. This is how I think Sketchup Observers work. <span class="syntaxdefault"><br />class Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Selection<br /><br />  def initialize<br />    </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">observers </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[]<br /></span><span class="syntaxdefault">  end<br /><br />  def add_observer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">obj</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">observers </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> obj<br />    true<br />  end<br /><br />  def remove_observer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">obj</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">observers</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">delete</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">obj</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> true </span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> false<br />  end<br /><br />  </span><span class="syntaxcomment"># Some method triggered by SketchUp private API.<br /></span><span class="syntaxdefault">  def _trigger_selection_added</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">sel</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> element</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">observers</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">obj</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">      next unless obj</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">onSelectionAdded</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">      begin<br />        </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">obj</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">onSelectionAdded</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">sel</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> element</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">      rescue Exception </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> e<br />        puts </span><span class="syntaxstring">"#{e}\n#{e.backtrace.first}"<br /></span><span class="syntaxdefault">      end<br />    </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">  end<br /><br />  </span><span class="syntaxcomment"># ...<br /></span><span class="syntaxdefault">end<br /></span> I think the event is called only if the tool contains that method. This might tell us that you tool isn't event supposed to be an instance. It may be a module as well. As long as the methods are accessible ( self.onSelectionAdded) your good to go.
  • A small &quot;entity to group&quot; problem

    4
    0 Szavazatok
    4 Hozzászólások
    382 Megtekintések
    Dan RathbunD
    @artmusicstudio said: ..., is there a code for deliting an array of edges directly ? or do i have to iterate thru the array and erase one after another? use Entities.erase_entities() The argument can be a single entity, or an array of entities. ALSO... Ruby has an "accordian operator" the * that can be used to expand an array into a argument list, or compress arguments in an array. IF erase_entities also takes a list of multiple entities, you could convert the aray to a list like: my_ents.erase_entities( *my_edge_array )
  • Basic understanding of instances ???

    6
    0 Szavazatok
    6 Hozzászólások
    694 Megtekintések
    tt_suT
    A couple of years ago I wrote an overview of definitions and instances in SketchUp: http://www.thomthom.net/thoughts/2012/02/definitions-and-instances-in-sketchup/
  • [plugin] xml parser

    2
    0 Szavazatok
    2 Hozzászólások
    294 Megtekintések
    Dan RathbunD
    Export / Import DAE files are XML. You can select what you wish to save, and call: model.export( "some/path/filename.dae", optshash ) Create the options hash first with :selectionset_only => true Then import them using model.import
  • C API unresolved external symbol

    3
    0 Szavazatok
    3 Hozzászólások
    762 Megtekintések
    G
    Thank you AdamB. I did add the path of the downloaded .dll and .lib to the VS library search path. Somewhere I read that character encoding differences could cause such error messages. So I also tried to change the project's encoding settings without any luck.... EDIT: Thank you. SUCCESS!!! (Well it was a missing reference to the lib... )
  • Drawing images to the SketchUp viewport

    9
    0 Szavazatok
    9 Hozzászólások
    911 Megtekintések
    tt_suT
    And this is how it looks like on nVidia with AA enabled: [image: MGOD_2014-07-02_23h02_32.png] [image: hDJx_2014-07-02_23h04_12.png] [image: VzoD_2014-07-02_23h04_33.png]
  • Encode in 2014 again.

    12
    0 Szavazatok
    12 Hozzászólások
    829 Megtekintések
    Q
    Thanks for all. The problem is done. The solution is to use ultraedit convert function(convert ascii to utf-8(unicode edition)). Originally, i use the notepad++ to convert utf-8 without BOM, and it seems not work as expected. Now, the split function can work correctly without any force_encoding, but the input from html should be converted using force_encoding("UTF-8"). Thanks again for TIG.
  • Array.uniq! for a 3d-point array ???

    6
    0 Szavazatok
    6 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    @aerilius said: Geom::Point3d.== method checks for example if all coordinates (x, y, z) are equal, and then says two points are equal. uniq appears to check for identity and not for equality. In Ruby 2.x (SketchUp 2014+,) where we now have a block form of the uniq method, that we can tailor to override C internals of the uniq! method, and tell it what and how to do the comparison. Ex: pts = roof.uniq {|a,b| a.==(b) } or: pts = roof.uniq {|pt| pt.to_a } In the future, perhaps, custom uniq methods could be added to a new PointArray subclass of Array., for the API. Of course any author could create such a custom class within their own namespace(s). ALSO.. the many od the API classes should have had their eql?() method aliased as the overridden ==() method. The uniq methods want to call eql?() instead of ==().
  • [solved] &quot;movin&quot; group into another group (in ruby)

    7
    0 Szavazatok
    7 Hozzászólások
    594 Megtekintések
    artmusicstudioA
    hi, thanx! work like a dream, as soon as i found out, that a ng - group must be created before calling the method, then it moves both groups into it. fantastic! THANK YOU !!!!! stan result: g0 = @group_floors #COMES FROM ANOTHER METHOD g1 = @facade_group #COMES FROM ANOTHER METHOD ng = model.entities.add_group self.insert(ng, g0, g1) ##*************************************************************************** def self.insert(ng, g0, g1) ##*************************************************************************** ng.entities.add_instance(g0.entities.parent, g0.transformation) ng.entities.add_instance(g1.entities.parent, g1.transformation) g0.erase! g1.erase! #ng.name = "master house group created" count = 1 entities3 = ng.entities entities3.each { |entity| if entity.is_a?(Sketchup;;Group) entity.explode if count == 1 #SO GROUPS ELEMENTS ARE AGAIN AT LEVEL 1, as needed count = count + 1 end } end
  • [solved] submenue in a submenue ??

    4
    0 Szavazatok
    4 Hozzászólások
    395 Megtekintések
    artmusicstudioA
    got it! thanx, works perfectly... stan
  • [solved] a simple UI.inputbox problem

    3
    0 Szavazatok
    3 Hozzászólások
    384 Megtekintések
    artmusicstudioA
    hi tig, understood and done, works perfect, the combi-version is very nice and confortable and i can pass arguments to it from any method. you will then see it in the finished ruby! thanx a lot for the explanation. stan
  • Retrieve a value from status bar input box

    5
    0 Szavazatok
    5 Hozzászólások
    395 Megtekintések
    TIGT
    You have to make a 'class'. SketchUp recognizes it as a 'Tool' from the way it is made into a command... Special 'Tool' methods can be used in that class... Go to the Extension-Warehouse and find the Examples - the 'draw box' example shows how to set up a Tool... https://extensions.sketchup.com/en/content/example-ruby-scripts
  • Modifying TIG's Archiver

    3
    0 Szavazatok
    3 Hozzászólások
    258 Megtekintések
    M
    @tig said: ...an older version... BLAST! Thanks TIG. Started a while ago and completely forgot about the updates. Starting over LOL

Advertisement