ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Plugin DLL

    29
    0 Votes
    29 Posts
    7k Views
    Dan RathbunD
    New 'old' info. I found the old thread where we discussed this over on the Ruby Installer forum. Luis says on Windows that .so files are just renamed .dll files. See: ruby uses .so files?
  • How do I move a Group of entities on their own?

    5
    0 Votes
    5 Posts
    437 Views
    S
    Now the Penny is dropping! Slowly... After a day going round in circles, I've had a productive evening... For absolute Newbies, here are some Group transformations (thanks yet again TIG): # 30/04/2011 SJH_Groups_Add_v03.rb puts "Running... SJH_Groups_Add" require 'sketchup.rb' model = Sketchup.active_model entities = model.entities #entities = model.active_entities selection = model.selection # Set some length variables rl = 1 gl = 1 bl = 1 rlmid = rl*0.5 glmid = gl*0.5 blmid = bl*0.5 # To convert to SU current Model units rl = rl.to_s.to_l gl = gl.to_s.to_l bl = bl.to_s.to_l rlmid = rlmid.to_s.to_l glmid = glmid.to_s.to_l blmid = blmid.to_s.to_l # Create Face points array fpts = [] fpts[0] = [0, 0, 0] fpts[1] = [rl, 0, 0] fpts[2] = [rl, gl, 0] fpts[3] = [0, gl, 0] # Create String and counter for incrementing group names sjhname = "SJHGroup" groupcount = 0 # ---------- Start Main Code ---------- groupcount+= 1 groupname = sjhname + groupcount.to_s # Create a Group - mygroup1 mygroup1 = [] # Create an empty array to prevent Bug Splat! mygroup1 = entities.add_group # Make the array a Group Entities class gentities1 = mygroup1.entities # Create an array of the Entities in mygroup mygroup1.name = groupname # Change the Group name face = gentities1.add_face fpts # Add a face to gentities1 pullface = face.pushpull -bl # Do a push/pull to the face tcoordinates = [rlmid, glmid, blmid] # Set coordinates for text tpoint = Geom;;Point3d.new tcoordinates # Create a 3d point for text mytext = gentities1.add_text "#{groupname}", tpoint # Add a text label model.close_active # Close mygroup1 # Closed the Group UI.messagebox("mygroup1 added. What's next?") # User Message to see what happened! # Move everything in the model entlen = entities.length transform = Geom;;Transformation.new([(rl*2),0,0]) for e in (0... entlen) entities.transform_entities(transform, entities[e]) end # Select mygroup1 #selection.add(mygroup1) UI.messagebox("All entities moved. What's next?") # User Message to see what happened! groupcount+= 1 groupname = sjhname + groupcount.to_s # Create a Group - mygroup2 mygroup2 = [] # Create an empty array to prevent Bug Splat! mygroup2 = entities.add_group # Make the array a Group Entities class gentities2 = mygroup2.entities # Create an array of the Entities in mygroup mygroup2.name = groupname # Change the Group name face = gentities2.add_face fpts # Add a face to gentities2 pullface = face.pushpull -bl # Do a push/pull to the face tcoordinates = [rlmid, glmid, blmid] # Set coordinates for text tpoint = Geom;;Point3d.new tcoordinates # Create a 3d point for text mytext = gentities2.add_text "#{groupname}", tpoint # Add a text label model.close_active # Close mygroup2 # Closed the Group UI.messagebox("mygroup2 added. What's next?") # User Message to see what happened! # Move everything in the model entlen = entities.length transform = Geom;;Transformation.new([(rl*2),0,0]) for e in (0... entlen) entities.transform_entities(transform, entities[e]) end # Select mygroup #selection.add(mygroup2) UI.messagebox("All entities moved. What's next?") # User Message to see what happened! # Move (mygroup1) ONLY # Try making it as a proper transformation (TIG 30/04/2011) pt=Geom;;Point3d.new(rl*2, 0, 0) tr=Geom;;Transformation.new(pt) mygroup1.transform!(tr) UI.messagebox("mygroup1 moved by Point3d. What's next?") # User Message to see what happened! # Move (mygroup2) ONLY # To move by a set vector use (TIG 30/04/2011) vt=Geom;;Vector3d.new(-rl*2, 0, 0) tr=Geom;;Transformation.translation(vt) mygroup2.transform!(tr) UI.messagebox("mygroup2 moved by Vector3d. What's next?") # User Message to see what happened! # Rotate (mygroup1) along Red axis pt=Geom;;Point3d.new(0, 0, 0) vt=Geom;;Vector3d.new(rl, 0, 0) an=45.degrees tr=Geom;;Transformation.rotation(pt,vt,an) mygroup1.transform!(tr) UI.messagebox("mygroup1 rotated along Red axis. What's next?") # User Message to see what happened! # Rotate (mygroup1) along Green axis pt=Geom;;Point3d.new(rl*6, 0, 0) vt=Geom;;Vector3d.new(0, gl, 0) an=45.degrees tr=Geom;;Transformation.rotation(pt,vt,-an) mygroup1.transform!(tr) UI.messagebox("mygroup1 rotated along Green axis. What's next?") # User Message to see what happened! # Scale (mygroup2) uniform about origin x3 tr=Geom;;Transformation.scaling(3) mygroup2.transform!(tr) UI.messagebox("mygroup2 scaled uniform from origin. What's next?") # User Message to see what happened! # Scale (mygroup2) uniform about origin tr=Geom;;Transformation.scaling(0.3) mygroup2.transform!(tr) UI.messagebox("mygroup2 scaled uniform from origin. What's next?") # User Message to see what happened! # Scale (mygroup2) non-uniform about origin tr=Geom;;Transformation.scaling(3, 2, 1.5) mygroup2.transform!(tr) UI.messagebox("mygroup2 scaled non-uniform from origin. The End! ;o\)") # User Message to see what happened! # ---------- End Main Code ---------- puts("\n END \n..........") # end of SJH_Groups_Add.rb Attached is a pic of my moved, rotated and scaled Groups. Doesn't seem much but this morning that would have been a pic of a Bug Splat! Happy, happy! [image: wfVi_20110430_Capture4-Rotate-Scale.JPG]
  • Logging SketchUp events?

    2
    0 Votes
    2 Posts
    301 Views
    thomthomT
    Use the tools observer: http://code.google.com/apis/sketchup/docs/ourdoc/toolsobserver.html and selection observer: http://code.google.com/apis/sketchup/docs/ourdoc/selectionobserver.html to gather the information of the user's interaction.
  • Help in SketchUp UI research

    3
    0 Votes
    3 Posts
    323 Views
    A
    Thanks Jim, Web dialogues worked great! Thank you!
  • Multi-language plugin

    6
    0 Votes
    6 Posts
    486 Views
    TIGT
    Sketchup tried it... BUT many of us prefer our own methods...
  • Plugins menu not shown or in different language

    2
    0 Votes
    2 Posts
    169 Views
    thomthomT
    Yes - one always use the English names regardless of what locale the user might have. The Plugins menu is only mission when no plugins has added any menus to it.
  • How to select without using the mouse

    6
    0 Votes
    6 Posts
    692 Views
    M
    MAN U R Genius
  • How to scale a face nested in component

    4
    0 Votes
    4 Posts
    231 Views
    B
    http://code.google.com/intl/zh-CN/apis/sketchup/docs/ourdoc/entities.html Important note: If you apply a transformation to entities that are not in the current edit context (i.e. faces that are inside a group), SketchUp will apply the transformation incorrectly, since the geometry has one origin and the current edit context has another. You can correct for this by watching the Model.edit_transform and Model.active_path. See ModelObserver.onActivePathChanged for more information. I put it in the origin and tried, there still is a problem ,the side face of the tube come out of the group(component) with the top and bottom face being still in the group
  • Determine OS bit version with ruby

    8
    0 Votes
    8 Posts
    3k Views
    Dan RathbunD
    @unknownuser said: as I dont have 64bit Windows to test it up, take in account this as well - "The %ProgramFiles% itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit" %ProgramFiles% = ENV['ProgramFiles'] But I told him to use %ProgramFiles(x86)% (which is ENV['ProgramFiles(x86)'],) and should not be present on 32bit systems. On a 64bit system, running a 32bit process (in this case 32bit Sketchup, running 32bit Ruby as a subprocess,) a copy of the enviroment is created for the process. Both the vars ENV['ProgramFiles'] and ENV['ProgramFiles(x86)'] should contain a pathstring that points at the same 32bit localized "program files" directory.
  • Ruby can't connect MS access

    3
    0 Votes
    3 Posts
    985 Views
    B
    thank you, yes you are right, I used ASP grammar here:( but I find I also used wrong database driver provider, anyway ,I have worked it out.
  • Deleting entities on a layer doesn't work

    12
    0 Votes
    12 Posts
    570 Views
    K
    I study civil engineering and the script is some kind of homework. I'll talk to my tutor in two days. After that I'll know wether I'm allowed to give you the code. Thanks so far. Tim
  • Good way to test a script

    8
    0 Votes
    8 Posts
    557 Views
    liquid98L
    @pixero said: Here's a topic I started with some good info about debugging scripts: http://forums.sketchucation.com/viewtopic.php?f=180&t=34052 That's a really useful thread indeed, thnx
  • Evaluate expression as input to input form

    11
    0 Votes
    11 Posts
    1k Views
    thomthomT
    @ktkoh said: The problem was that some entries were interpreted as strings. UI.inputbox returns values in the same class as you feed the defaults. So if you feed it Lengths it returns lengths.
  • [Code Snippets]

    4
    0 Votes
    4 Posts
    43k Views
    Dan RathbunD
    (No longer Maintained due to lack of donations.) Platform Issues / Differences / Specifics Platform Differences Bugs / Issues When do Tools.active_tool_id return 0 ? GUI UI.show_model_info() w/ no args X-Mouse Window Focus for Mac OSX ?? Misc. Help with Mac compatibility? Ruby [FAQ] Detect if plugin is running on the Mac vs PC ? Ruby (versions) Sketchup.send_action arguments: Mac vs PC WebDialog WebDialog - hide scrollbars WebDialog (resizing windows) WebDialogs - The Lost Manual — R1 2009NOV09 WebDialog set_file WebDialog.set_html() Gotchas Webdialogs and Javascript void [FIXED!!!] Anyone seen this web dialog bug? System / OS [Code] Sketchup Safe Shutdown method [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=24327:1a2mqsys]onKeyDown repeat parameter problem[/url:1a2mqsys] Mac / OSX Specific Bugs / Issues [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=35959:1a2mqsys]SU 8 Mac & strange content[/url:1a2mqsys] (memory leak?) GUI [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=33888:1a2mqsys]Mac Toolbars Editable?[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=34002:1a2mqsys]My Apple Keyboard VK_KEYS[/url:1a2mqsys] Misc. Ruby [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=34219:1a2mqsys]Ruby Version for Sketchup 8.0 M1 on Mac ??[/url:1a2mqsys] WebDialog [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=30127:1a2mqsys]JS loading problem under Mac OS X SU[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=29751:1a2mqsys]PC v MAC webdialog populate[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=26927:1a2mqsys]Sketchup use of WebKit[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=32415:1a2mqsys]Webdialog position not preserved across session on MAC[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=25865:1a2mqsys]WebDialogs are caching and not refreshing images[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=39842:1a2mqsys]WebDialog.set_html fails under Safari 5.0.6[/url:1a2mqsys] System / OS [url=http://forums.sketchucation.com/viewtopic.php?f=15%26amp;t=29330:1a2mqsys]Auto-running a Mac '.command' File from Sketchup?[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=30314:1a2mqsys]"Mac32API.so" ?[/url:1a2mqsys] PC / Win Specific Bugs / Issues Files [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=43007:1a2mqsys][Code] PCFileTools[/url:1a2mqsys] - Support UTF8 (TIG) GUI [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=29970:1a2mqsys]Windows: Moving Floating Toolbars[/url:1a2mqsys] Misc. Ruby [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=16574:1a2mqsys]Win32API vs DL lib[/url:1a2mqsys] WebDialog [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=27594:1a2mqsys]Web dialog browser version[/url:1a2mqsys] System / OS [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=36772:1a2mqsys]Determine OS bit version with ruby[/url:1a2mqsys] [url=http://forums.sketchucation.com/viewtopic.php?f=180%26amp;t=18488:1a2mqsys]Sketchup registry key ?[/url:1a2mqsys] (No longer Maintained due to lack of donations.) COMMUNITY CONTENT Moderators may edit post / add links at will.
  • Input and Output files in Ruby

    4
    0 Votes
    4 Posts
    361 Views
    J
    Just another thought (while browsing around the forums..) depth = width = length = nil File.open("My Documents\\slabout.text") { |fp| depth, width, length = fp.gets, fp.gets, fp.gets }
  • Deleting a layer

    3
    0 Votes
    3 Posts
    1k Views
    Dan RathbunD
    The erase!() method is defined in class Sketchup::Drawingelement Sketchup::Layer is a subclass of Sketchup::Entity, NOT a subclass of Sketchup::Drawingelement, so it does not inherit a erase!() method. You will need to move all entities off of the layer, then use Layers.purge_unused() BTW.. Layers is a C++ collection, not a Ruby Array.
  • Writing a C extension

    3
    0 Votes
    3 Posts
    257 Views
    Dan RathbunD
    @ishboo said: Nobody have experience with this? We have discussed this in previous topics... ... we currently have an active topic going on C/C++ Plugins: Plugin DLL Other threads on this issue: Getting Started with C++ and Sketchup Ruby extension module using C/C++ (mostly about using SWIG) Example of Compiled Extension with SWIG and CMake Ruby C++ extension crashes SketchUp Re: Optimization Tips (discussing Ruby vs C speed) Programming in C, C++ for Mac and Windows? Are Swig generated Ruby bindings compatible with Sketchup? Examples: TBD's SUExt extension example
  • Does Sketchup has a threading mechanism

    3
    0 Votes
    3 Posts
    315 Views
    Dan RathbunD
    You could also try to see if using the UI.start_timer block method works for you. This with execute the block immediately, and not repeat: UI.start_timer(0.0,false) { my_calc_method() }
  • Browserscope

    2
    0 Votes
    2 Posts
    265 Views
    thomthomT
  • Transformation Newbie...

    4
    0 Votes
    4 Posts
    350 Views
    thomthomT
    InputPoint.transformation http://code.google.com/intl/no/apis/sketchup/docs/ourdoc/inputpoint.html#transformation Gives you the transformation for the input point. Will probably be useful to you for converting between local and model co-ordinates.

Advertisement