ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Escaping out of editing a component

    4
    0 Votes
    4 Posts
    340 Views
    tt_suT
    Note that if only close the currently open instance. If you are deeply nested you need to loop until you are back in the root - (if that's what you desire). And before SU2014 the method was bugged and could mess up geometry if the close was undone. (The method actually creates an undo item)
  • How to judge whether a 3D point is visible or not

    6
    0 Votes
    6 Posts
    374 Views
    lbsswuL
    @sdmitch said: @lbsswu said: Hi everyone, Suppose I have opened the Sketchup software, I want to know whether a 3D point is visible or not in current view. For example, the 3D point may locate on the back of a person, thus we can't see it when the person facing to us. This should be done by Sketchup ruby code.Could anyone help me? I placed a construction point, the little black dot just below the horizon, and "Nancy" in the model. I then used the following code to test if the point was visible. mod = Sketchup.active_model > ent = mod.active_entities > sel = mod.selection > vue = mod.active_view > eye = vue.camera.eye > cp = ent.grep(Sketchup;;ConstructionPoint)[0] > pt = cp.position > vec = pt.vector_to(eye) > hit = mod.raytest([pt,vec]) > if hit > puts "pt is not visible" > else > puts "pt is visible" > end > Hi, sdmitch. Thank you very much. It works!
  • How to get the projected coordinate of a 3D point?

    5
    0 Votes
    5 Posts
    372 Views
    lbsswuL
    @tig said: view.screen_coords returns the point in the Model as X,Y coords - screen value. But you must ensure that the exported image used the same size as the window, otherwise there is no direct relationship between the point and the image's pixels... Got it! Thanks for your help!
  • Component axis problem

    18
    0 Votes
    18 Posts
    1k Views
    PixeroP
    I just thought I'd post this snippet in case it will help someone with a similar problem. def set_origin(compdef, compinst, pt0, pt1, pt3) tr1 = compinst.transformation rotvector = pt1-pt0 originvector = Geom;;Vector3d.new(1,0,0) org = pt3 angle = rotvector.angle_between originvector if angle < 90.degrees angle2 = -angle elsif angle > 90.degrees angle2 = angle end #if if angle == Math;;PI/2 angle2 = -90.degrees end if pt0.y > pt1.y && angle == Math;;PI/2 #Check if it's drawn at 90 degrees but in opposite direction angle2 = 90.degrees end compinst.transform! tr1.inverse tr2 = Geom;;Transformation.rotation(org, Z_AXIS, angle2) tr3 = Geom;;Transformation.new(org) compdef.entities.transform_entities(tr2, compdef.entities.to_a) compdef.entities.transform_entities(tr3.inverse, compdef.entities.to_a) compinst.transformation = compinst.transformation * tr3 compinst.transform! tr1 * tr2.inverse compdef.invalidate_bounds end #def
  • Replace component and set dynamic attributes?

    3
    0 Votes
    3 Posts
    750 Views
    G
    There are a few things that I had to deal with. I found it easier to put the dynamic attributes in a nested group as opposed to the outside group. This way you can rotate the entire door and jamb to fit it into the door opening and you don't have to keep changing the dynamic rotz. These doors can be copied, flipped and or rotated while preserving the desired angles of rotation. 4 doors.skp [image: COJv_4doors.PNG]
  • Key combinations

    5
    0 Votes
    5 Posts
    345 Views
    S
    @cadfather said: Thanks Guys, i'll have a look at Jan's table. can't believe it's so messy working with the keyboard. Yes, messy - but the mess originates in the OS, not SketchUp!
  • Fixing the Undo-stack (and others!)

    13
    0 Votes
    13 Posts
    789 Views
    J
    Got it, thanks Thom. I realised that I could have optimised it to recurse fewer times, but at some point with increasingly complex surfaces it will run into a stack overflow again. I had a little read elsewhere and found that there are workarounds (ulimit and altering the interpreter, sounds like a bit of a dodgy hack to me..), but eventually it's always got an upper limit. I very much like the idea of a Geometry walker traversing geometry, and ended up using a solution very similar to yours. Cheers! -CJ
  • OnKey_Downer!

    7
    0 Votes
    7 Posts
    426 Views
    CadFatherC
    i guess one workaround is to make a webdialog tiny enough not to intrude but able to 'catch' the keystrokes repeating...
  • Plugins Locations

    19
    0 Votes
    19 Posts
    1k Views
    Dan RathbunD
    .. and the nested module definition has no end closure.
  • Odd behavior of Draw

    17
    0 Votes
    17 Posts
    645 Views
    S
    @sdmitch said: Well I have tried all the suggested combinations and nothing seems to solve the "problem". Perhaps it is just my 7 year old laptop!!!!! Since these draw operations go directly to OpenGL, this explanation seems quite possible! There could be a bug in either your laptop's OpenGL drivers or an incompatibility in how SketchUp uses OpenGL.
  • Save thumbnails components

    2
    0 Votes
    2 Posts
    256 Views
    thomthomT
    http://www.sketchup.com/intl/en/developer/docs/ourdoc/componentdefinition#save_thumbnail
  • I have a question, about Model.import of sketchup API

    8
    0 Votes
    8 Posts
    645 Views
    Y
    @thomthom said: Do you get any errors? What format are you trying to import? .skp? I import a dae file to sketchup by api. but i need to click to position. is there a way to position it automatically?
  • SVG file Import (importing)

    20
    0 Votes
    20 Posts
    24k Views
    M
    @catalyst said: Hi danbig, You need to open your SVG file with inkscape. Go into Inskcape's preferences Under "Tools" select "SVG output" Under "Path data" - uncheck "Allow relative coordinates" Right below that - check "Force repeat commands" Be sure to save the new preferences by hitting the little triangle-in-a-box button in the top right corner of the preferences window. Once you do that, you can save Plain SVG files and import them successfully into Sketchup for further manipulation. I HAVE NOT BEEN ABLE TO SUCCESSFULLY IMPORT A PLAIN SVG FILE INTO SKETCHUP MAKE 2014 USING THIS METHOD. IS THERE ANY ADDITIONAL STEPS I NEED? GOAL IS TO INPUT A SVG FILE (THE WORDS "PEACE" "ON" AND 'EARTH" WHICH HAVE BEEN TRACED AND WELDED TOGETHER IN TO THREE INDIVIDUAL SVGS.) OF A WELDED WORD INTO SKETCHUP AND EXTRUDE IT TO MAKE A 3D 'BOX' ABOUT 2" THICK.
  • Change of style in undo stack?

    7
    0 Votes
    7 Posts
    550 Views
    Dan RathbunD
    @xorunison said: This is a smaller but somewhat annoying problem. The situation is this: I have a few Plug-Ins which allow the user to switch between different working modes. To do so each Plug-In with its own button does 2 things: 1: Change the current style (between my predefined styles Construction and Display) 2: Turn on/off certain layers This sounds like a perfect job for scenepages. One for display, one for work. Each has their own styles set, and each has their own set of off layers, and on layers. The button(s) could simply switch between the pages (if you did not want to waste the space for page tabs.) The scenes could be preset into a template model.
  • Returning a value from a Class method

    17
    0 Votes
    17 Posts
    738 Views
    Dan RathbunD
    @johnwmcc said: If you are storing Point3d objects, would you need @contents.to_a first, before .max.y or min.y? The min and max methods come from the Enumerable mixin module. Enumerable is mixed into Array, but not Geom::Point3d, nor Geom::Vector3d. To see what modules may be mixed into a class, use *Classname*.ancestors So to answer the question, yes, or if using your own collection class, you might mix in the Enumerable module into it. @johnwmcc said: It does, for me. It was intended to select out the y coordinate (a scalar) from the point coordinates. ary = [pt1, pt2, pt3, pt4, ... ] To select the point which has the minimum y value, from an array of points, do this: miny_pt = ary.min {|a,b| a.y <=> b.y } To select the point which has the maximum y value, from an array of points, do this: maxy_pt = ary.max {|a,b| a.y <=> b.y } ... then get your thickness: thickness = maxy_pt.y - miny_pt.y To translate: [ruby:247d5h9w]ary.max {|a,b| a.y <=> b.y }[/ruby:247d5h9w], into plain English: "iterate [ruby:247d5h9w]ary[/ruby:247d5h9w], each loop compare the current member ([ruby:247d5h9w]a[/ruby:247d5h9w])'s y value, against the next member ([ruby:247d5h9w]b[/ruby:247d5h9w])'s y value, and return the member that resolves to the maximum." The comparison is defined using Ruby's comparison operator, [ruby:247d5h9w]<=>[/ruby:247d5h9w]. Remember that the entire member is returned, so later you still need to ask for just the y value. @johnwmcc said: I wasn't sure if the [ruby:247d5h9w].x[/ruby:247d5h9w] and [ruby:247d5h9w].y[/ruby:247d5h9w] methods would work on arrays, but they seem to in my example code. Because the SketchUp API adds those methods to the Ruby Array class. (It is part of making Ruby arrays compatible with API points and vectors.) @johnwmcc said: I'm unclear about the near-but-not-complete equivalence between SU [ruby:247d5h9w]Point3d(x, y, z)[/ruby:247d5h9w] and [ruby:247d5h9w]Array[x, y, z][/ruby:247d5h9w]- it seems I can use either a lot of the time, but not quite always! Read the API regarding how it adds to Array class: http://www.sketchup.com/intl/en/developer/docs/ourdoc/array
  • &lt;canvas&gt;

    19
    0 Votes
    19 Posts
    751 Views
    D
    @Greg updated script runs from the top... @TT please right up the debug info... The biggest hassle I find is injecting Web Inspector on jQ UI's [especially from .rbs files]... john
  • Problem installing joint push pull

    6
    0 Votes
    6 Posts
    3k Views
    K
    thanks for (jointpushpull) cause i have the this problem....but i want a resolve for( tools on surface) as fast as you can ....pleassssssssssse cause i have Graduation project and i use sketchup to do it cause sketchup is wonderfull....thanks
  • SketchUp and Rubies on Linux (yes, it works)

    71
    0 Votes
    71 Posts
    39k Views
    bomastudioB
    @aerilius said: In the meantime Wine has reached a state where SketchUp can be used without Microsoft's Internet Explorer, but with Wine's own opensource Internet Explorer replacement that is based on Firefox/Gecko. This means we can have all the goodness of Gecko in WebDialogs! [attachment=0:3k7jewnp]<!-- ia0 -->wine-explorer.png<!-- ia0 -->[/attachment:3k7jewnp] How to force to use Gecko instead of IE?
  • Firing Button with Modifier Key

    11
    0 Votes
    11 Posts
    568 Views
    CadFatherC
    didn't notice the thread had progressed... @tig said: You could probably also write an AutoHotKeys snippet [PC only!] which would spot a click in SketchUp with a key etc, BUT it'd be mucho complicado... ahk is quite good, i can see it possible but not too good for public consumption - with compatibility etc.. @driven said: if the button you click is a tool, you can watch for modifier keys? I assume [due to lack of use case] that you want one button for 3 tools [as example]... create a simple tool with one button... on click, [activating your tool] start a timer and watch for modifier keys... if key = a activate x if key = b activate y if you run out of time if activate z is that the sort of thing your after? or have I completely misunderstood yet again... john yes, exactly that. @jim said: There's this, but Windows only and not up-to-date and needs compiled, etc. https://code.google.com/p/eventrelay/ will have a look, thanks Jim @anton_s said: There is a way, thought it will require that your extension to require AMS Library. Easy to implement. Here is a snippet: very interesting Anton, will look into it (where's a Christmas holiday when you need it?!)
  • Catch Load Errors

    5
    0 Votes
    5 Posts
    241 Views
    tt_suT
    One thing to beware of is that Sketchup::require/load annoyingly doesn't raise ruby errors - but instead just output the error text. So you might want to hook into $stdout and $strerr to catch that as well. (This is something I suggest only because you mention it was for a personal tool.)

Advertisement