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

    3
    0 Votes
    3 Posts
    421 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
    318 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
    898 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
    372 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
    295 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
    392 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
    265 Views
    F
    Tks, worked fine. Fernando.
  • Must Have Plugin

    10
    0 Votes
    10 Posts
    3k 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
    320 Views
    T
    Yes, view.invalidate is designed to work with Tools.
  • Odd Ruby Error

    6
    0 Votes
    6 Posts
    460 Views
    T
    Since you are getting it when right clicking on a axis, then the failing code is most assuredly a proc for displaying a right click context menu for a script. You can narrow your search down to any scripts you have that generate context menu selections.
  • Double rotations

    3
    0 Votes
    3 Posts
    559 Views
    chrisglasierC
    Fixed [flash=425,344:3qp1491i]http://www.youtube.com/v/TL8q17qSKrk[/flash:3qp1491i]
  • SU script / Ruby book for beginners

    8
    0 Votes
    8 Posts
    826 Views
    A
    @remus said: I had a quick look at the website, and the rd edition deals with ruby 1.9, perhaps SU uses 1.8? Exactly. Sketchup uses a real old Ruby (1.8.0). Most of the Ruby programmers use 1.8.6 (or 1.8.7) at the moment. Betwenn 1.8.6 and 1.8.7 they made some changes influenced by the development of 1.9.0 (and 1.9.1). But alos betwenn 1.8.7 and 1.9.0 (1.9.1) there are a lot changes. azuby
  • Coming Soon:Profile Builder

    97
    0 Votes
    97 Posts
    15k Views
    P
    It's released. http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=15538&p=120193#p120193
  • File dialog

    3
    0 Votes
    3 Posts
    387 Views
    thomthomT
    errh... The what what? ... ...can't believe I didn't notice those methods...
  • LOOP SELECTION PLUGIN?

    16
    0 Votes
    16 Posts
    3k Views
    Y
    Wow visit.
  • Looking for Extrude Line.rb

    2
    0 Votes
    2 Posts
    934 Views
    J
    Didier Bur posted his Extrude Line plugin here: http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=1523 (Thanks, Extension Index!)
  • Grouping a selection of component instances

    4
    0 Votes
    4 Posts
    308 Views
    chrisglasierC
    Yes the explode works as well. Thanks Chris
  • Create and move between muti cameras

    8
    0 Votes
    8 Posts
    735 Views
    J
    Thanks a lot Phil, Although i may try to write a flight path script myself. I am very interested in completing my study of the Ruby API, and things are coming along faster every day! I love this program!
  • Fxruby

    2
    0 Votes
    2 Posts
    741 Views
    J
    Hi and Welcome italian, Is this for a SketchUp extension? I didn't know you could use FxRuby for SketchUp dialogs. Why not use a WebDialog, or wxSU?

Advertisement