Module: TT
- Defined in:
- TT_Lib2/core.rb,
cext/tt_lib2/tt_lib2/src/extension.cpp,
TT_Lib2/debug.rb,
TT_Lib2/win32_shim.rb,
TT_Lib2/c_extension_manager.rb
Overview
Defined Under Namespace
Modules: Arc, Attributes, Bezier, Binary, BooleanAttributes, Bounds, Color, Cursor, Definition, Edge, Edges, Entities, Face, Faces, GUI, Geom3d, Gizmo, Image, Instance, Javascript, Length, Lib, Locale, Material, MetaClass, Model, Plugins, Point3d, Point3d_Ex, Selection, SketchUp, System, UVQ, Win32 Classes: Babelfish, CExtensionManager, Debug, DeferredEvent, Dimension, DrawCache, GL_Image, JSON, Profiler, Progressbar, Ray, Settings, SimpleTask, UV_Plane, Version, WebDialogPatch
Constant Summary
- CEXT_VERSION =
The build version of the TT_Lib binary library.
GetVALUE("1.1.0")
- BB_LEFT_FRONT_BOTTOM =
BoundingBox Constants
0
- BB_RIGHT_FRONT_BOTTOM =
1
- BB_LEFT_BACK_BOTTOM =
2
- BB_RIGHT_BACK_BOTTOM =
3
- BB_LEFT_FRONT_TOP =
4
- BB_RIGHT_FRONT_TOP =
5
- BB_LEFT_BACK_TOP =
6
- BB_RIGHT_BACK_TOP =
7
- BB_CENTER_FRONT_BOTTOM =
8
- BB_CENTER_BACK_BOTTOM =
9
- BB_CENTER_FRONT_TOP =
10
- BB_CENTER_BACK_TOP =
11
- BB_LEFT_CENTER_BOTTOM =
12
- BB_LEFT_CENTER_TOP =
13
- BB_RIGHT_CENTER_BOTTOM =
14
- BB_RIGHT_CENTER_TOP =
15
- BB_LEFT_FRONT_CENTER =
16
- BB_RIGHT_FRONT_CENTER =
17
- BB_LEFT_BACK_CENTER =
18
- BB_RIGHT_BACK_CENTER =
19
- BB_LEFT_CENTER_CENTER =
20
- BB_RIGHT_CENTER_CENTER =
21
- BB_CENTER_FRONT_CENTER =
22
- BB_CENTER_BACK_CENTER =
23
- BB_CENTER_CENTER_TOP =
24
- BB_CENTER_CENTER_BOTTOM =
25
- BB_CENTER_CENTER_CENTER =
26
- BB_CENTER =
26
- MB_ICONHAND =
UI.messagebox Constants
0x00000010
- MB_ICONSTOP =
0x00000010
- MB_ICONERROR =
0x00000010
- MB_ICONQUESTION =
0x00000020
- MB_ICONEXCLAMATION =
0x00000030
- MB_ICONWARNING =
0x00000030
- MB_ICONASTERISK =
0x00000040
- MB_ICONINFORMATION =
0x00000040
- MB_ICON_NONE =
80
- MB_DEFBUTTON1 =
0x00000000
- MB_DEFBUTTON2 =
0x00000100
- MB_DEFBUTTON3 =
0x00000200
- MB_DEFBUTTON4 =
0x00000300
- MESH_SHARP =
PolygonMesh
0
- MESH_SOFT =
4
- MESH_SMOOTH =
8
- MESH_SOFT_SMOOTH =
12
- POINT_OPEN_SQUARE =
view.draw_points
1
- POINT_FILLED_SQUARE =
2
- POINT_CROSS =
3
- POINT_X =
4
- POINT_STAR =
5
- POINT_OPEN_TRIANGLE =
6
- POINT_FILLED_TRIANGLE =
7
Class Method Summary collapse
- .array_to_hash(array) ⇒ Hash
-
.debug(data) ⇒ Nil
Outputs debug data.
-
.defer(time = 0) ⇒ Nil
Defers execution of the given block.
- .even?(number) ⇒ Boolean
- .format_time(time) ⇒ String
- .lib2_update ⇒ Object
- .lib2_update=(window) ⇒ Object
-
.m2(area_meters) ⇒ Numeric
Returns the given square meters
area_meters
in square inches. -
.menu(name) ⇒ Sketchup::Menu
If TT's Menu is installed this method will return a custom Menu item instead of the requested root menu.
- .object_id_hex(object) ⇒ String
- .odd?(number) ⇒ Boolean
-
.to_m2(area_inches) ⇒ Numeric
Returns the given square inches
area_inches
in square meters.
Class Method Details
.array_to_hash(array) ⇒ Hash
475 476 477 478 479 480 481 |
# File 'TT_Lib2/core.rb', line 475 def self.array_to_hash( array ) h = {} for key, value in array h[ key ] = value end h end |
.debug(data) ⇒ Nil
Outputs debug data.
Under Windows the data is sent to OutputDebugString and requires a utility like DebugView to see the data. Without it the call is muted.
Under other platforms the data is sent to the console.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'TT_Lib2/debug.rb', line 26 def self.debug(data) if data.is_a?( String ) str = data else str = data.inspect end if TT::System.is_windows? TT::Win32::OutputDebugString.call( "#{str}\n\0" ) else puts data end nil end |
.defer(time = 0) ⇒ Nil
Defers execution of the given block.
387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'TT_Lib2/core.rb', line 387 def self.defer( time = 0 ) done = false timer = UI.start_timer( time, false ) { # (i) Unless the timer is stopped before the messagebox it will # continue to trigger until the frist messagebox is closed. unless done done = true yield end } nil end |
.even?(number) ⇒ Boolean
404 405 406 |
# File 'TT_Lib2/core.rb', line 404 def self.even?(number) number % 2 == 0 end |
.format_time(time) ⇒ String
424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'TT_Lib2/core.rb', line 424 def self.format_time( time ) time = (time.finite?) ? time : 0.0 hours = (time / 3600).to_i minutes = (time/60 - hours * 60).to_i seconds = (time - (minutes * 60 + hours * 3600)).to_i if hours > 0 && minutes > 0 "#{hours}h #{minutes}m #{seconds}s" elsif minutes > 0 "#{minutes}m #{seconds}s" else "#{seconds}s" end end |
.lib2_update ⇒ Object
101 |
# File 'TT_Lib2/core.rb', line 101 def self.lib2_update; @lib2_update; end |
.lib2_update=(window) ⇒ Object
102 |
# File 'TT_Lib2/core.rb', line 102 def self.lib2_update=(window); @lib2_update = window; end |
.m2(area_meters) ⇒ Numeric
Returns the given square meters area_meters
in square inches.
445 446 447 448 |
# File 'TT_Lib2/core.rb', line 445 def self.m2( area_meters ) ratio = 1.m ** 2 area_meters * ratio end |
.menu(name) ⇒ Sketchup::Menu
If TT's Menu is installed this method will return a custom Menu item instead of the requested root menu.
354 355 356 357 358 359 360 |
# File 'TT_Lib2/core.rb', line 354 def self.( name ) if global_variables.include?( :$tt_menu ) && $tt_menu $tt_menu else UI.( name ) end end |
.object_id_hex(object) ⇒ String
467 468 469 |
# File 'TT_Lib2/core.rb', line 467 def self.object_id_hex( object ) "0x%x" % (object.object_id << 1) end |
.odd?(number) ⇒ Boolean
413 414 415 |
# File 'TT_Lib2/core.rb', line 413 def self.odd?(number) number % 2 > 0 end |
.to_m2(area_inches) ⇒ Numeric
Returns the given square inches area_inches
in square meters.
457 458 459 460 |
# File 'TT_Lib2/core.rb', line 457 def self.to_m2( area_inches ) ratio = 1.0 / self.m2(1) area_inches * ratio end |