🏒 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Small script that deletes all text in a drawing

    4
    0 Votes
    4 Posts
    368 Views
    Didier BurD
    Hi, Alternatively, you could use my "quick selection" script: it can filter objects by type in the drawing to make a selection. Here: http://www.crai.archi.fr/RubyLibraryDepot/Ruby/EM/quick_selection.zip Regards,
  • Point to point move?

    11
    0 Votes
    11 Posts
    817 Views
    JClementsJ
    Builder, In case you are not aware, there is a Glue feature in SU. If a selection is giving me problems while trying to move it, I'll right click on it to see if "UNGLUE" is available in the context menu. If so, then I'll do an Unglue. ===================================== Moving or drawing geometry across large distances can be tedious. A method I often forget to practice, but which is very helpful, is to zoom into the "target point", then Zoom to Extents, then zoom to your "start" point, select your geometry or intiate a drawing tool, then utilize the "Zoom Next" and "Zoom Previous" functions available in the Camera Toolbar.
  • Is it possible to retrieve the font settings using Ruby?

    3
    0 Votes
    3 Posts
    277 Views
    A
    Todd, There is a lot about colors in the hash but, alas, nothing about font attributes.
  • Combo Ruby for Reveals

    5
    0 Votes
    5 Posts
    1k Views
    D
    BooTools at work Thanks to EarthMover for the boulders. Exploded and then grouped. Union and re-texture from boulder material list. Good way to build a large rock form for we the lazy.[image: sjPj_HappyBoulderIsland-2.jpg] dtr
  • Frontface&subsmooth on Mac ( solved )

    17
    0 Votes
    17 Posts
    1k Views
    ton baetenT
    Edson, Well, maybe that is correct, but my SU6 folder is about 16MB (138 files), includes almost all big ones (alvailable for mac) and many, many smaller ones. My SU7 folder is still rather empty, only a few rubies, since I have decided to check them all, get rid of duplicates, the once a hardly ever use and to get back any overview, before moving them to SU7. I will see whatever happens to my user/etc....folders, no big deal for me. I will keep you informed if I encounter a ruby making an extra unexpected ruby-folder.
  • Specify Font Size of Leader Text or Screen Text?

    3
    0 Votes
    3 Posts
    315 Views
    daikuD
    Thanks, Todd. I'll add it to Scott's wish list.
  • Run windows .exe and wait for completion

    3
    0 Votes
    3 Posts
    522 Views
    Al HartA
    I was finally able to do this using Win32API and a function I call "call_and_wait". def self;;call_and_wait(scommand_line) cp_params = 'LPLLLLLLPP' create_process = Win32API.new('kernel32','CreateProcess', cp_params, 'I') startinfo = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].pack('LLLLLLLLLLLLSSLLLL') # place holder for results procinfo = [0,0,0,0].pack('LLLL') trace("scommand_line; %s", scommand_line) cp = create_process.call(0, scommand_line, 0, 0, 0, 0, 0, 0, startinfo, procinfo) trace("create_process returned; %s", cp) if (cp == 0) return end#if # get process if of process we created hProcess = procinfo.unpack("LLLL")[0] trace("hProcess; %s waiting...", hProcess) if (hProcess == 0) return end#if waitForSingleObject = Win32API.new("kernel32","WaitForSingleObject",['L','L'],'L') a = waitForSingleObject.Call( hProcess, 0xFFFFFFFF ) # wait forever trace("waitForSingleObject returned; %s", a) end#def The WaitForSingleObject waits for the task to complete without using up resources. The ruby command system(command_line) runs the commands and waits for it, but uses up 1/2 of the resources of the machine in a tight loop checking to see if the command is done yet.
  • Activate toolbars automaticly

    5
    0 Votes
    5 Posts
    488 Views
    dazzaD
    @sepo said: I don't know if making new template will solve your problem but I have managed to sort out toolbars randomly moving with making new template. This was on PC though. I agree with Sepo, arrange your toolbars as needed and then save as a template. Worked like a charm!!!
  • Something like SubdivideAndSmooth

    3
    0 Votes
    3 Posts
    1k Views
    R
    Here you go: http://www.smustard.com/script/Subdivide Like i said before, its pretty buggy. If you want to do any real work with subd stuff youd be a lot better of buying whaats script.
  • Calling all plug-in developers!

    6
    0 Votes
    6 Posts
    476 Views
    GaieusG
    Yes, it was but due to some privacy policy demands,this is not possible any longer. You can see all that is displayed there (with one exception) here, on the right anyway.
  • MaterialsObserver

    3
    0 Votes
    3 Posts
    378 Views
    A
    So I checked the instance methods, to see if the exposed methods correspond to the API. I'm not sure if it should or not, my ruby knowledge is thin here for sure (extending classes where methods may get called but are / aren't defined in the base class). However, I checked the instance methods of every single observer class and they match the API exactly (some have additional methods, but all have at least what the API says. Except MaterialsObserver. Sketchup;;MaterialsObserver.instance_methods ["MaterialUndoRedo", "onMaterialRemoveAll", "MaterialSetCurrent", "MaterialChange", "onMaterialAdd", "MaterialRefChange", "MaterialRemove"] Sorry, but this is a serious "what the hell?!" moment. Most of the methods completely lack the "on" part. Yet, onMaterialChange does get called rarely, so the method is being used, even if the base material observer doesn't define it. Attempting to override "MaterialChange" instead of "onMaterialChange" never gets called. Am I off base or is this a Google Fubar? None of the other observers have any methods that don't start with "on", or differ at all from the API.
  • Regex selection filter?

    3
    0 Votes
    3 Posts
    262 Views
    thomthomT
    Yea, it'd be a simple loop. Just wasn't sure if there was a plugin out there already. If not I'll add one to my selection plugin. Found the use for it today when I imported a revit model using the DWG format. There's no material applied so I have to add that manually. But I noticed that similar element had the same name prefix followed by a number. So I figured I could greatly speed up the process of adding materials by doing a regex selection.
  • Raytest

    8
    0 Votes
    8 Posts
    780 Views
    chrisglasierC
    @unknownuser said: Silly me... I thought you wanted to learn how to use raytest! You want to know how to do collision detection in 3D. If I knew, I'd tell. I presume raytest would be a piece of that somewhere. Todd I am sorry Todd if you think I misled you. Yes, I do want to learn how to use raytest and I believe what I am thinking about is simple clash detection in the XY plane. If you have time any snippets you feel may be appropriate would be well received. Thanks Chris
  • Texture.size= ??

    3
    0 Votes
    3 Posts
    317 Views
    A
    I have. It didn't have any effect. A previous post here implied that invalidate only works somehow in the context of a tool. Even if it did work outside of a tool, I don't think it would help here; you can use the mouse to move the 3D view around as much as you want (which assumably refreshes and invalidates the view repeatedly) and it doesn't fix it. So it's not an issue with updating the display, but more somehow updating the material, visually. As soon as you modify the geometry or make changes in the material dialog, the texture updates correctly, but not until then.
  • Question - A way to allow user to change ruby menu location?

    2
    0 Votes
    2 Posts
    253 Views
    A
    Difficult. You can't change it while Sketchup is running -> restart. But you can try to override the Sketchup methods for adding (sub) menus and menu items keeping the old methods with alias names. Your methods "hook" into the old methods, before they perform their action - short IRB session explaining what I'm talking about: irb(main);001;0> class A irb(main);002;1> def a irb(main);003;2> puts "a" irb(main);004;2> end irb(main);005;1> end => nil irb(main);006;0> class A irb(main);007;1> alias ;old_a ;a irb(main);008;1> def a irb(main);009;2> puts "b" irb(main);010;2> old_a irb(main);011;2> end irb(main);012;1> end => nil irb(main);013;0> A.new.a b a => nil Your method could read the correct menu structure i.e. from a text file. But you have to make sure, that your script is eval'ed by Sketchup before another script adds menus or menu items. azuby
  • Drop.rb doesn't work

    3
    0 Votes
    3 Posts
    358 Views
    W
    AHA !!! thank you
  • CALLING ALL MATRIX GURUS, HELP! , please :)

    11
    0 Votes
    11 Posts
    1k Views
    J
    jzer7, Thanks so much, but no luck. I going to post a section of the script i am parsing this data from, maybe it will help... import Blender from Blender import Camera, Object, Scene, NMesh from Blender import Mathutils from Blender.Mathutils import * cur = Scene.getCurrent() #Camera Parameters c0001 = Camera.New('persp') c0001.lens = 49.739047 o0001 = Object.New('Camera') o0001.name = "voodoo_cam1" o0001.setMatrix(Mathutils.Matrix([0.999938,0.001129,-0.011103,0.000000], [0.001072,-0.999986,-0.005202,0.000000], [-0.011108,0.005189,-0.999925,0.000000], [1.054297,1.571880,-8.966838,1.000000])) o0001.link(c0001) cur.link(o0001) c0002 = Camera.New('persp') c0002.lens = 49.739047 o0002 = Object.New('Camera') o0002.name = "voodoo_cam2" o0002.setMatrix(Mathutils.Matrix([0.999943,0.001132,-0.010635,0.000000], [0.001076,-0.999985,-0.005294,0.000000], [-0.010641,0.005282,-0.999929,0.000000], [1.071295,1.559580,-8.822482,1.000000])) o0002.link(c0002) cur.link(o0002) ################################################## # [snip] # many, many more cams are created and then comes # some IPO curve data ################################################# #Render camera animated with IpoCurves crender = Camera.New('persp') crender.lens = 35.0 crender.setDrawSize(1.0) orender = Object.New('Camera') orender.name = "voodoo_render_cam" orender.link(crender) cur.link(orender) cur.setCurrentCamera(orender) ipo = Blender.Ipo.New('Object','render_cam_objipo') orender.setIpo(ipo) locx = ipo.addCurve('LocX') locx.setInterpolation('Linear') locy = ipo.addCurve('LocY') locy.setInterpolation('Linear') locz = ipo.addCurve('LocZ') locz.setInterpolation('Linear') rotx = ipo.addCurve('RotX') rotx.setInterpolation('Linear') roty = ipo.addCurve('RotY') roty.setInterpolation('Linear') rotz = ipo.addCurve('RotZ') rotz.setInterpolation('Linear') camipo = Blender.Ipo.New('Camera','render_cam_camipo') crender.setIpo(camipo) lenscurve = camipo.addCurve('Lens') lenscurve.setInterpolation('Linear') locx.addBezier((1,o0001.LocX)) locy.addBezier((1,o0001.LocY)) locz.addBezier((1,o0001.LocZ)) rotx.addBezier((1,o0001.RotX*18/3.141593)) roty.addBezier((1,o0001.RotY*18/3.141593)) rotz.addBezier((1,o0001.RotZ*18/3.141593)) lenscurve.addBezier((1,c0001.lens)) locx.addBezier((2,o0002.LocX)) locy.addBezier((2,o0002.LocY)) locz.addBezier((2,o0002.LocZ)) rotx.addBezier((2,o0002.RotX*18/3.141593)) roty.addBezier((2,o0002.RotY*18/3.141593)) rotz.addBezier((2,o0002.RotZ*18/3.141593)) lenscurve.addBezier((2,c0002.lens)) ############################################ # [snip] # many more lines of IPO # the only thing left is "point cloud" data # which i am leaving out. # The last thing in the script is this... ########################################### # Scene Helper Object scene_dummy= Object.New('Empty','voodoo_scene') scene_dummy.setLocation(0.0,0.0,0.0) cur.link(scene_dummy) scene_dummy.makeParent([orender,ob]) scene_dummy.setEuler((-3.141593/2, 0.0, 0.0)) scene_dummy.SizeX=0.2 scene_dummy.SizeY=0.2 scene_dummy.SizeZ=0.2 Maybe this helps, maybe not ?? the lines don't wrap correctly in the code tags so it mucks up the code a bit
  • Get current OS information

    3
    0 Votes
    3 Posts
    221 Views
    F
    Tks, worked fine. Fernando.
  • Must Have Plugin

    10
    0 Votes
    10 Posts
    2k Views
    K
    Fantastic Thread! We can all learn from this. By the way, I think we need to say a big 'Thank You' to Didier Bur , as Sketchup wouldn't be the same without the Crai.fr ruby resource website. Next to 3D warehouse, it is one of the best features of Sketchup. Really! It is strange that Google themselves never set up their own ruby resource site, or did I miss that?
  • Screen won't update

    4
    0 Votes
    4 Posts
    280 Views
    T
    Yes, view.invalidate is designed to work with Tools.

Advertisement