⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • [Code]Transformation_Extensions 20110209

    3
    0 Szavazatok
    3 Hozzászólások
    2k Megtekintések
    TIGT
    I've updated this code as it was well out of date and new versions drifting around on the forums has typos etc - this is the definitive version [as of today at least ]
  • [code] intersect_with example

    6
    0 Szavazatok
    6 Hozzászólások
    5k Megtekintések
    TIGT
    I suggest you trap for non-groups selection.each { |entity| ### next if not entity.class==Sketchup;;Group ### entity.entities.intersect_with(true, entity.transformation, entity.entities.parent, entity.transformation, true, entity.parent.entities.to_a) } Also shouldn't entity.entities.parent be entity.entities.parent.entities
  • Get Group Owner

    6
    0 Szavazatok
    6 Hozzászólások
    397 Megtekintések
    thomthomT
    @cleverbeans said: I believe g3.parent.instances[0] gives you the correct group. Not if the group has instances, which it may have after copying a group and not editing it.
  • Google toolbar: get position

    4
    0 Szavazatok
    4 Hozzászólások
    314 Megtekintések
    Dan RathbunD
    No.. you cannot intercept the call. It is hard-coded into the Sketchup application on the C++ side, not on the Ruby side.
  • Loop.convex? question

    5
    0 Szavazatok
    5 Hozzászólások
    405 Megtekintések
    DavidBoulderD
    Thanks for the feedback. The data file that is drawing my geometry in the first place already has a smaller list of verticies that is clean. So I guess that is the best option, going back to that, drawing a temporary face to test, and throwing it away. I don't know how much of a performance hit that will be over testing an existing face. But what I can do is pre-test with the existing face, and then only create a temporary face to test on the ones that initially fail. David Below is the code I ended up with. My SketchUp objects are drawn from data in an external file. I could have drawn temporary faces for convex test for every surface but decided to do the initial test off of the existing SketchUp faces, and then do a second test on faces that fail the convex test to confirm that they really are non-convex. This second test goes back to the data file, draws a temporary surface, tests it, and throws it away. The data file is already fee of un-necessary stray points. if @hash['NON_CONVEX_SURFACES'] face = interior_partition_surfaces[index].entity loop = face.outer_loop status = loop.convex? # if face is convex skip over it if status next else # failed first convex test, run second one pointstemp = interior_partition_surfaces[index].model_object_polygon.points model = Sketchup.active_model entities = model.active_entities facetemp = entities.add_face pointstemp loop2 = facetemp.outer_loop status2 = loop2.convex? # erase facetemp facetempall = facetemp.all_connected entities.erase_entities facetempall if status2 # next statement skips the rest of this if face is convex next end end end
  • Face with 0.0 area

    14
    0 Szavazatok
    14 Hozzászólások
    619 Megtekintések
    TIGT
    I wasn't suggesting you remove a small face just merge its vertices so it vanishes...
  • MAC UI.show_model_info() w/ no args

    6
    0 Szavazatok
    6 Hozzászólások
    934 Megtekintések
    Dan RathbunD
    Need to know if this is a new v8 bug or not. Any one with Mac SU 7.x, could you try: UI.show_model_info nothing on PC (v7.x and v8.0,); nothing on Mac (v8.0) UI.show_model_info("") last used panel on PC (v7.x and v8.0,) and on Mac (v8.0) UI.model_info_pages PC output >> ["Animation", "Components", "Credits", "Dimensions", "File", "Geo-location", "Rendering", "Statistics", "Text", "Units"] UI.show_model_info("File") displays File panel on PC (v7.x and v8.0) regardless of what panel was previously shown. does not work on Mac (v8.0); only hilites the panel name in the selection box, and still displays the last panel that was used. ~
  • Help with Components and Blocks

    3
    0 Szavazatok
    3 Hozzászólások
    230 Megtekintések
    honoluludesktopH
    Didier, Yes, thanks. In Dxf, I think the entity Insert is used to apply transformation to a block (which is like a definition). Matching its name (I think) is what distinguishes it as a instance. Will test these assumptions tonight. If a SU Component is the equivalent of the Acad entity Insert, what Acad entity is the equivalent of a SU Group, if any. Or can I treat it as a Insert without additional instances? Sorry if I my question seems repetitious.
  • Ruby C++ extension crashes SketchUp

    9
    0 Szavazatok
    9 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    @exvion said: breton_nerd, i use this version of ruby http://rubyforge.org/frs/download.php/47082/ruby186-27_rc2.exe for compile C++ extension. And I comment lines //#if _MSC_VER != 1200 //#error MSC version unmatch //#endif in c:\Ruby186\lib\ruby\1.8\i386-mswin32\config.h I had failed with other versions. What version of ruby you use? Yes that is Ruby version 1.8.6-p287, the version of the interpreter that Google distro'd with Sketchup 8.x; (The 27_rc2 refers to the One-Click Ruby Installer release package.) Here is the Release Notes page link.
  • Messagebox of doom!

    5
    0 Szavazatok
    5 Hozzászólások
    455 Megtekintések
    thomthomT
    @tig said: t=UI.start_timer( 1, false ) { 1.times{UI.stop_timer(t); UI.messagebox('Hello World')}} works as you only make one instance ? What I think happens is: SketchUp stops non-repeating timers ( with the repeat flag to false ) after it processes the block given to UI.start_timer. Because the messagebox is modal it halts normal execution, but the timer stills runs because it hasn't been stopped yet. My workaround is to manually stop it before the messagebox is displayed. I'd expect to see the same behaviour from modal webdialogs.
  • Own Dynamic Component supported function

    6
    0 Szavazatok
    6 Hozzászólások
    372 Megtekintések
    T
    The @source_entity was the key. No echo! And get_attribute should only read values and not mess the dictionary.
  • Deflate compression - zlib?

    5
    0 Szavazatok
    5 Hozzászólások
    473 Megtekintések
    TIGT
    @thomthom said: @dahovey said: The ultimate thing I need to do is generate a PNG image file, being able to 'paint' each pixel. Already studied PNG documentation for what I need. That's simple enough. The compression seems to be the tough thing. Ditto - I was looking at it to read PNG data - easy up til the compression bit... A cross-platform Java .jar can read and write PNG file [or most other image formatf] pixel by pixel - that's how my ImageTrimmer and related tools work... My 'thumbnail' tools take the larger image and the JAR saves a PNG with the reduced size... ImageTrimmer reads the image's PNG pixels and if they are transparent it makes them white if they abut an 'edge' they become black, any other pixels become white - the bufferedimage is written to a new PNG; for the purposes of this tool a DAT file is also written containing 0/1 for white/black pixels this is read directly into SUp to make edges that are them 'simplified'... It's easy to see a converse operation where the RB writes a DAT file of pixel values and the JAR reads that and makes a PNG using those... I know it's clunky but until Ruby gets some decent image manipulation tools built in it works... If you'd like ideas on this please PM me...
  • Mercurial GUI for OSX?

    2
    0 Szavazatok
    2 Hozzászólások
    241 Megtekintések
    tbdT
    used Murky when I worked with Hg. and another one MacHg
  • Rounding

    6
    0 Szavazatok
    6 Hozzászólások
    2k Megtekintések
    TIGT
    If you want to round it as output [as astring] then you can use var_string = sprintf("%.1f", var) for 1 dp etc
  • Set.insert vs array << x unless array.include?(x)

    19
    0 Szavazatok
    19 Hozzászólások
    11k Megtekintések
    honoluludesktopH
    I probably don't know what I am doing, but I ran the following test, and obtained the attached results. I typically use array.push variable, and don't understand the situations when the other examples might be used. Btw, when I applied the other forms to my app, it failed in ways that leave me to believe that those forms are data sensitive. Can anyone explaine to a Ruby beginner what's up? t=Time.now a=[] 100000.times do r=rand(10000) a<<r end a.uniq! puts Time.now-t 0.125 t=Time.now a=[] 100000.times do r=rand(10000) a.push r end a.uniq! puts Time.now-t 0.141 t=Time.now a=[] 100000.times do r=rand(10000) a.push r end puts Time.now-t 0.094 t=Time.now a=[] 100000.times do r=rand(10000) a<<r end puts Time.now-t 0.093
  • What means "class" here?

    11
    0 Szavazatok
    11 Hozzászólások
    572 Megtekintések
    D
    Don't forget instance_of? when only looking for a specific class without regard to inheritance. As in <span class="syntaxdefault"><br />ss </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br />ss</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">  if e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">instance_of</span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ComponentInstance<br />    </span><span class="syntaxcomment">#other stuff<br /></span><span class="syntaxdefault">  end<br />end</span>
  • Extract !?

    3
    0 Szavazatok
    3 Hozzászólások
    201 Megtekintések
    L
    Thanks, the link you provided is straightforward.
  • [code] Menu Validation (MF_DISABLED bugged on PC?)

    12
    0 Szavazatok
    12 Hozzászólások
    3k Megtekintések
    thomthomT
    Possibly. Maybe it was in another language where you had to gray and disable. ...Visual Basic...? Can't think of anything else where I've dealt with menus...
  • Getting view near and far planes through ruby?

    6
    0 Szavazatok
    6 Hozzászólások
    409 Megtekintések
    AdamBA
    If you want worldspace near and far plane distances, just project the Model bounding box onto the lookat vector lookat = Sketchup.active_model.active_view.camera.target - Sketchup.active_model.active_view.camera.eye then project each corner of the model bounding box on this line. So: for i in 0...8 #enumerate all the corners x = i & 1 != 0 ? Sketchup.active_model.bounds.min[0] : Sketchup.active_model.bounds.max[0] y = i & 2 != 0 ? Sketchup.active_model.bounds.min[1] : Sketchup.active_model.bounds.max[1] z = i & 4 != 0 ? Sketchup.active_model.bounds.min[2] : Sketchup.active_model.bounds.max[2] build a corner point to test c = Geom::Point3d.new(x,y,z) how far a long the line of sight it is d = lookat.dot(c - Sketchup.active_model.active_view.camera.eye) track minimum and maximum value of d end
  • [SOLVED]accessing scene transitions

    8
    0 Szavazatok
    8 Hozzászólások
    680 Megtekintések
    AdamBA
    Is it a known bug that Sketchup.active_model.options["SlideshowOptions"]["LoopSlideshow"] appears to be totally ignored by SketchUp? I've checked back to SU6 and it is read/writable but the animation still loops if its set to false

Advertisement