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

    7
    0 Votes
    7 Posts
    297 Views
    jiminy-billy-bobJ
    @tig said: I did write a whole raft of 'missing' layer methods... I just thought I'd let you learn by doing... I learn by looking at what you wrote !
  • My senses are trimbleling!

    2
    0 Votes
    2 Posts
    153 Views
    thomthomT
    New working URL: http://sketchup.com/intl/en/developer/docs/classes.php Hope they fix this so the old URLs doesn't break permanently.
  • Load Newton.dylib file via Ruby

    14
    0 Votes
    14 Posts
    1k Views
    A
    @dan rathbun said: Yes. DL is Ruby bridge to using dynamic compiled libraries. On PC, before DL, we had to use the Win32API library. Interesting topic What about the win32-api 1.4.8 by Daniel J. Berger, Park Heesob? In dl you load the dll file once and then extern as many functions. <span class="syntaxdefault">dlload</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">find_support_file</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"NewtonServer3.dll"</span><span class="syntaxkeyword">,</span><span class="syntaxstring">"plugins\\SketchyPhysics3\\"</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault">extern </span><span class="syntaxstring">"void init()"<br /></span><span class="syntaxdefault">extern </span><span class="syntaxstring">"void stop()"<br /></span><span class="syntaxdefault">extern </span><span class="syntaxstring">"void update(int)"<br /></span><span class="syntaxcomment">#...<br /></span><span class="syntaxdefault"> </span> But, in win32api.so and win32-api you load the library every time you create a function, right? <span class="syntaxdefault">api </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> AMS</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Win32</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">API<br />newton </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">dir</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'lib/Win32/newton.dll'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  <br />Create  </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> api</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">'NewtonCreate'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'PP'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'P'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> newton</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">Destroy </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> api</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">'NewtonDestroy'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'P'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'V'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> newton</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">Update  </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> api</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">'Update'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'P'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'V'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> newton</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> </span> Am I thinking right? Which one is better dl or win32-api?
  • How to get x,y,z texture position of a face?

    3
    0 Votes
    3 Posts
    419 Views
    renderizaR
    Thank you TIG as always and I will look into your recommendation ASAP!
  • Help needed with intersecting geometry

    4
    0 Votes
    4 Posts
    201 Views
    TIGT
    Boolean / Oscoolean ?
  • Global Hash in module (solution without $ ) ?

    5
    0 Votes
    5 Posts
    188 Views
    jolranJ
    Thanks TIG. Your variant is probably more than I need for the moment, but still very clever. And I presume (since nobody mentioned it already) quite safe to use ?
  • Script calls script - how to click Ok to dialog boxes?

    3
    0 Votes
    3 Posts
    248 Views
    T
    Thanks TIG! I will give up on that idea and go # the second script! See you in a year! Thanks for the quick reply! Stuart
  • How to retrieve array of faces that are inside a group?

    14
    0 Votes
    14 Posts
    350 Views
    renderizaR
    Very grateful indeed!
  • [Idea] Storing parameters to model for easy changes

    5
    0 Votes
    5 Posts
    159 Views
    thomthomT
    For bezier curves, or surfaces it's easier - as the mesh is generated from a set of few control points. Round corners base itself on existing geometry - problem arise when you start manipulating the mesh after rounding it. For Bezier Surface I plan to implement a modifier stack.
  • SketchUp crashing on me with this code...why?

    8
    0 Votes
    8 Posts
    353 Views
    renderizaR
    Hi, Thank you guys so much could not do it without you guys!...Here is the latest update for Animatex; http://sketchucation.com/forums/viewtopic.php?f=323&t=52238 There is no scrambler for code so you guys can take a peek and will be grateful if you tell me any inefficiency in code so I can keep learning...cheers! New Web Dialog:: [image: animatex_dlg.jpg]
  • Hidden gemoetry being evil.

    3
    0 Votes
    3 Posts
    191 Views
    V
    @thomthom said: I see this from time to time. Usually it's a result of using imported geometry from for instance DWG/DXF files with some minor precision problems that appear to cascade throughout the model. Maybe CleanUp: http://sketchucation.com/forums/viewtopic.php?t=22920 But it won't prevent the problem from re-appearing. The root cause if probably precision problems. Use imported geometry as a guide, but don't model directly off it. Don't trust it to be square or parallel. Thank you so much for the input Thomthom. This is actually quite helpful. ^.^
  • Your thoughts - Trimble's Possible Extensions Warehouse?

    11
    0 Votes
    11 Posts
    682 Views
    renderizaR
    Understood!
  • Why can't Face not have names just like Groups and Comp?

    4
    0 Votes
    4 Posts
    177 Views
    jolranJ
    My pleasure. There may be more to it I'm not aware about. So don't forget to report back if you find something useful
  • Angle between north and face

    9
    0 Votes
    9 Posts
    493 Views
    K
    Thanks it was the thing I was looking for
  • Webdialog scripting issues

    9
    0 Votes
    9 Posts
    1k Views
    Dan RathbunD
    require('sketchup.rb') module SepulTribe module Sensor # RUN ONCE unless file_loaded?(__FILE__) MAC =( RUBY_PLATFORM =~ /(darwin)/i ? true ; false ) WIN = !MAC @@dialogs = {} # Hash to hold sensor dialog refs @@cmd_main = nil @@cmd_settings = nil @@dlg_settings = nil end # RUN ONCE class << self # proxy class def clear_dialogs() @@dialogs.each {|k,v| if v.is_a?(UI;;WebDialog) v.close if v.visible? end } @@dialogs.keys.each {|k| @@dialogs[k]=nil } GC.start # garbage collection end def create_sensor_dialog(obj) wd = UI;;WebDialog.new( "#{obj.name}'s Info", false, '', 200, 200, 500, 500, true ) main_html_path = File.join( File.dirname(__FILE__), "main.html" ) wd.set_file( main_html_path ) wd.set_position(800,600) wd.set_size(250,250) wd.add_action_callback("get_info") { |dlg, params| dlg.execute_script("show_selected('#{obj.name}', '#{obj.class}')") } return wd end # create_sensor_dialog() def create_settings_dialog() wd = UI;;WebDialog.new( "Main Settings", false, '', 200, 200, 500, 500, true ) settings_html_path = File.join( File.dirname(__FILE__), "settings.html" ) wd.set_file( settings_html_path ) wd.set_position(640,480) wd.set_size(500,300) return wd end # create_settings_dialog() def show_sensor_dialog(obj) # dlg = @@dialogs[obj.object_id] if dlg.nil? dlg = create_sensor_dialog(obj) @@dialogs[obj.object_id]= dlg MAC ? dlg.show_modal ; dlg.show else unless dlg.visible? MAC ? dlg.show_modal ; dlg.show end dlg.bring_to_front end # end # show_sensor_dialog() end # proxy class @@cmd_main = UI;;Command.new("Get Sensor Data") { selected = Sketchup.active_model.selection unless selected.empty? if selected.single_object? if selected[0].is_a?(Sketchup;;ComponentInstance) and selected[0].name.include?('Sensor') show_sensor_dialog( selected[0] ) else UI.messagebox('Selected entity is not a Sensor Component. ') end else UI.messagebox('You have selected multiple entities. ') end end # unless } @@cmd_settings = UI;;Command.new("Settings") { if @@dlg_settings.nil? @@dlg_settings = create_settings_dialog() end unless @@dlg_settings.visible? MAC ? @@dlg_settings.show_modal ; @@dlg_settings.show end @@dlg_settings.bring_to_front } # RUN ONCE unless file_loaded?(__FILE__) # Access SketchUp's Edit menu edit_menu = UI.menu "Plugins" sub_menu = edit_menu.add_submenu("xxx Plugin") item = sub_menu.add_item @@cmd_settings # Access SketchUp's context menu UI.add_context_menu_handler do |menu| selected = Sketchup.active_model.selection unless selected.empty? menu.add_separator menu.add_item @@cmd_main end end file_loaded(__FILE__) end # RUN ONCE end # close module Sensor end # close module SepulTribe FIXED lines : %(#000000)[**34**, **35**, **41** & **59**]
  • Find a component definition in a list

    4
    0 Votes
    4 Posts
    195 Views
    thomthomT
    A less verbose version:. <span class="syntaxdefault">result&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">references</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">find&nbsp;</span><span class="syntaxkeyword">{&nbsp;|</span><span class="syntaxdefault">string</span><span class="syntaxkeyword">|&nbsp;</span><span class="syntaxdefault">string</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">rstrip&nbsp;</span><span class="syntaxkeyword">==&nbsp;</span><span class="syntaxdefault">ref&nbsp;</span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">puts&nbsp;</span><span class="syntaxstring">'Hello'&nbsp;</span><span class="syntaxkeyword">if&nbsp;</span><span class="syntaxdefault">result</span>
  • Modifying Reporting Area Script

    2
    0 Votes
    2 Posts
    162 Views
    JQLJ
    Have you tried report label areas plugin by Fredo? http://sketchucation.com/forums/viewtopic.php?f=323&t=40025&p=471921&hilit=area#p376837
  • OnKeyDown not working when Web dlg is focuse...why?

    6
    0 Votes
    6 Posts
    379 Views
    D
    some reading http://unixpapa.com/js/key.html it's title JavaScript Madness: Keyboard Events trying to get my head around it at the moment...
  • How to distinguish face size

    11
    0 Votes
    11 Posts
    654 Views
    pingpinkP
    Thank you very much ! Actually , I refer "round_to" in a class Fixnum below my main codes. I don't see any error. It's my new knowledge about sprintf("%.2f", 1.23456) [ruby]class Fixnum def abs rx = self if rx < 0 rx = -rx end return rx end def to_meter ufactor = 1.m rx = (self) / ufactor return rx end def round_to(x) (self * 10**x).round.to_f / 10**x end def ceil_to(x) (self * 10**x).ceil.to_f / 10**x end def floor_to(x) (self * 10**x).floor.to_f / 10**x end def rad_to_deg (self / Math;;PI) * 180.0 end def deg_to_rad (self * Math;;PI) / 180.0 end def comma_format s = self.to_s if s.include? ?. pre, post = s.split '.' "#{pre.reverse.gsub( /\d{3}(?=\d)/, '\&,' ).reverse}.#{post}" else s.reverse.gsub( /\d{3}(?=\d)/, '\&,' ).reverse end end end [/ruby][/code]
  • Can't draw subclasses of Sketchup::Edge

    25
    0 Votes
    25 Posts
    672 Views
    thomthomT
    I hope we get to see your creation one day. It sounds interesting!

Advertisement