🏒 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Replace components

    5
    0 Votes
    5 Posts
    578 Views
    liquid98L
    Hi Tig, Thanks I'll do some more study until I get what you suggested and come back here
  • How to identify buildings in Sketchup using ruby?

    2
    0 Votes
    2 Posts
    160 Views
    TIGT
    If you make them components you can find them by name, or attributes you might attached to the definition or instances etc... Using >=6 connected faces [as a 'solid'] could return almost anything from a box of paper-clips, through a TV set or Bed to a 20 storey office building ? Please be a bit more explicit with what is is you are trying to do...
  • Note to self: Array.to_a returns self

    7
    0 Votes
    7 Posts
    265 Views
    AdamBA
    @dan rathbun said: @tig said: a1=[1,2,3] both a2=a1 ### makes a new reference to the same array, 'a1' a2=a1.to_a ### makes 'a1' into an array [which it is already!] and then makes a new reference to the same array, 'a1' !! will still refer to a1, so consequently changing a2 changes a1 too ! BUT a2=a1.dup makes a separate copy of a1, as will a2=a1+[] as adding two arrays together produces a new array, even when the second one is empty; and now changing a2 leaves a1 alone To clarify, since "assignment creates references"...: a1=[1,2,3] ### creates a new array object referenced by a1 a2=a1 ### makes a new reference ( a2) to the same array object that a1 is pointing at. a2=a1.to_a ### a1.to_a returns *self* both references are pointing at the same array object, so consequently that object can be changed using either reference a2 or a1. BUT a2=a1.dup ### makes a new array object, (referenced by a2,) that is a copy of the array object that a1 is pointing at. Nice round-up.. But be aware #dup performs a shallow copy. So any proper objects (as opposed to simple numbers) in that array are copied by reference. So: a = [10, 20, [30,31,32]] c = a.dup a[2][0] = 'Tada!' c will print: [10, 20, ["Tada!", 31, 32]]
  • How to draw an edge with an angle and distance

    25
    0 Votes
    25 Posts
    1k Views
    M
    Mission accomplished Thanks to you all Geniuses
  • WebDialog.execute_script on OSX

    2
    0 Votes
    2 Posts
    364 Views
    thomthomT
    I use the jQuery .ready() event that loads when the DOM is ready to make a callback back to Ruby. Then I can 100% sure I can use execute_script. Works on both platforms. No need for sleep or timers. I've made a few notes about WebDialogs: http://forums.sketchucation.com/viewtopic.php?f=180&t=23445
  • I saw plugin for selecting objects with material

    9
    0 Votes
    9 Posts
    352 Views
    K
    @didier bur said: Besides all this, isn't it a built-in function ? This only captures elements in the currently active entities collection. My plugin also searches for that material in any sub-components or groups. EDIT: It also doesn't work on the default material. Karen
  • [Info] Transformation Matrix Link

    3
    0 Votes
    3 Posts
    472 Views
    thomthomT
    Cheers beans! Appreciate it.
  • [Code] Rantexpos

    9
    0 Votes
    9 Posts
    2k Views
    G
    figured it out. i just need to rotate my face/object to be oriented with the axis. then i can hit rantexpos and it aligns them in the other way. thanks again for your help. mo
  • [Code] New Material methods

    13
    0 Votes
    13 Posts
    3k Views
    TIGT
    Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701 The MAC jar execution issues have been addressed.
  • How to set length units in code

    3
    0 Votes
    3 Posts
    166 Views
    TIGT
    If you are getting the x/y/z values as strings [perhaps from an imported text file] then ` z=z+'.m' 4.5.m ### as a string eval(z) 177.165354330709 ### in inches [SUp's base units and used to position the point]if they are as floats then z=z.m` will work to convert it...
  • [Code]Transformation_Extensions 20110209

    3
    0 Votes
    3 Posts
    2k Views
    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 Votes
    6 Posts
    5k Views
    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 Votes
    6 Posts
    325 Views
    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 Votes
    4 Posts
    281 Views
    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 Votes
    5 Posts
    330 Views
    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 Votes
    14 Posts
    412 Views
    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 Votes
    6 Posts
    911 Views
    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 Votes
    3 Posts
    203 Views
    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 Votes
    9 Posts
    2k Views
    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 Votes
    5 Posts
    420 Views
    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.

Advertisement