⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • [Code] (Iterating) Finding Definitions

    4
    0 Votes
    4 Posts
    649 Views
    Dan RathbunD
    Yes it should, and now is. Updated the code. (I was uniq!'ing in the calling methods, and at the last moment replaced several in those methods, by adding the .uniq! to the return statement. I did think about which uniq to use, for a split-second, and didn't want to create a new array object, so I added ! to the end. That's what happens when ya' rush.) Thanx for the check TIG!
  • Developing a plugin/macro for orbiting based on input

    6
    0 Votes
    6 Posts
    177 Views
    Dan RathbunD
    Did you read the "linetool.rb" file in the "Examples" directory ??
  • Question about order in selection

    20
    0 Votes
    20 Posts
    2k Views
    Dan RathbunD
    Here's a start. Rename the module or cut & paste the proxy class block into one of your modules. module Sort class << self def sort_faces_by_vertex() @sel = Sketchup.active_model.selection.to_a @sel.delete_if {|e| not e.is_a?(Sketchup;;Face) } @sel.sort! {|a,b| ([a.vertices.min{|v1,v2| v1.position.x <=> v2.position.x }.position.x, a.vertices.min{|v1,v2| v1.position.y <=> v2.position.y }.position.y] <=> [b.vertices.min{|v1,v2| v1.position.x <=> v2.position.x }.position.x, b.vertices.min{|v1,v2| v1.position.y <=> v2.position.y }.position.y] ) } end def assign_room_nums_to_faces() sbv = sort_faces_by_vertex() sbv.each_with_index {|face,i| dict = face.attribute_dictionary('Properties',true) dict['name']= "Room #{(i+1).to_s}" } end end # proxy class end # module Sort
  • Creating components from existing objects

    12
    0 Votes
    12 Posts
    485 Views
    A
    @sdmitch said: There is always a way but at what cost. The code would no doubt expand from 3 lines to 3000. I'm on a framerate sensitive medium, so anything I can do to improve frame rate would be useful. It would be great if you have any tips on how to set the LOD for the miniature.
  • Toggle Dimmensions?

    11
    0 Votes
    11 Posts
    294 Views
    Dan RathbunD
    @thomthom said: @dan rathbun said: So mitcorb, no you can NOT edit them by accident when they are hidden (singly or globally.) All though they still update. Yes.. if associative and their anchor points are moved or changed. I'm not sure about styling fonts, etc. I suppose you can still access them via an entities collection... and I wonder if you could FORCE them into the selection set without crashing the application.
  • What's the difference.

    5
    0 Votes
    5 Posts
    179 Views
    KrisidiousK
    so I take it I'm covered with Your cleanup tools... kool.
  • Get last image export settings?

    4
    0 Votes
    4 Posts
    120 Views
    Dan RathbunD
    FYI... I have a bug issue logged that Sketchup::read_default() cannot return DWORD values. Basically the method assumes anything you want to read was written with Sketchup::write_default(), which inspects objects into evaluatable strings before storing them. So.. Sketchup::read_default() is stupid and always tries to run the stored values back through Ruby's eval() without Type checking. When a error occurs it seems the method's rescue block just returns nil. So you'll need to use the WIN32OLE class ("win32ole.so" file,) and the Windows Scripting Host interface to read registry values. See: [Plugin Library] Win32API and Win32OLE so files
  • Toggle Construction geometry?

    7
    0 Votes
    7 Posts
    409 Views
    Dan RathbunD
    I note there are 7 other settings that are positive, and begin with the prefix "Display".. and one positive that begins with the prefix "Show"... The lack of convention is annoying.
  • Sketchup::load under different binding?

    7
    0 Votes
    7 Posts
    214 Views
    Dan RathbunD
    @thomthom said: That seem to work perfectly! Excellent! 4 trys is the charm. Man, I love Ruby's flexibility!
  • Naming an entity

    4
    0 Votes
    4 Posts
    1k Views
    S
    Thank you very much TIG for the prompt and in depth reply. There is a lot of info to digest and I will try it out. Thank you again.
  • Sharing variables between functions

    3
    0 Votes
    3 Posts
    194 Views
    K
    amazing how easy things are sometimes. guess i have a long way to go thanks! D
  • JetBrain/RubyMine Support for SketchUp Ruby Class, Method an

    10
    0 Votes
    10 Posts
    3k Views
    Dan RathbunD
    Probably will.. when I get back a Win7 notebook that needs to go back to Dell for a HD replacement & OS reimage.
  • Namespace question on noob level

    16
    0 Votes
    16 Posts
    563 Views
    liquid98L
    Off topic: @unknownuser said: (1) The word useful has only 1 "L", by the way. thanx for your correction, the English language is not my mother language as you might have noticed.. /Off topic All code is safe now and my code works like a charm, so thanx for your help. And yes I SHALL read the book before I come here and ask questions like this..
  • Get points from a Sketchup object

    3
    0 Votes
    3 Posts
    2k Views
    A
    An object of what you mean is a Sketchup Drawingelement. If the Drawingelement is a Face, Edge, ArcCurve or Curve, it will have a method to get all vertices, and for each vertex you can get the position (which is what you want): positions = face.vertices.map{|v| v.position} If the Drawingelement is a Group, ComponentInstance of Image, it is "a model" in the model any you have to loop over the contained entities: group.parent.entities.find_all{|e| e.respond_to?(:vertices) }. map{|e| e.vertices.map{|v| v.position} }.flatten or with component.definition.entities
  • Get points from a Sketchup object

    2
    0 Votes
    2 Posts
    100 Views
    TIGT
    Why are you asking again? I already responded a week or so ago... http://forums.sketchucation.com/viewtopic.php?f=180&t=47043
  • Array of loaded rbs files?

    3
    0 Votes
    3 Posts
    129 Views
    thomthomT
    So there is none? I tried to reload an .rbs (I mean, why not) and the only way so far was to make a temp file and load that...
  • Return values

    14
    0 Votes
    14 Posts
    1k Views
    thomthomT
    @dan rathbun said: And the API needs these, and the app needs to use them. Yes - agree. Your idea about multiply two Length to get and Area, and Area with Length to get a Volume is very elegant. I'd very much like to see this into SU9.
  • Creating faces from points or edges fails

    7
    0 Votes
    7 Posts
    585 Views
    thomthomT
    @tafkab76 said: That could quite easily be solved by an own "uniq"-method for Point3d-objects Actually - no. #uniq will not compare Geom::Point3d against their positions - but rather if they are the same object instance.
  • [Logic emerged] Articulation in animation

    10
    0 Votes
    10 Posts
    755 Views
    Dan RathbunD
    NO problem. Chewin' on it helps. Sleeping on it helps. Brainstormin' helps.
  • Zoom in on object

    7
    0 Votes
    7 Posts
    3k Views
    Al HartA
    Here is the code which makes this work. If points to the center of the first item in the selection set, then uses SketchUp zoom to selection to do the zoom. It zooms to the third, desired, image in the post previous to this one. def zoom_selection # zoom to selection by rotating camera first model = Sketchup.active_model entity = model.selection[0] if (!entity) do_error("Nothing selected") return end#if view = model.active_view camera = view.camera eye = camera.eye target = camera.target up = camera.up target = entity.bounds.center camera.set(eye, target, up) # point to selection view.zoom(model.selection) # then zoom end#def

Advertisement