SuDCL dialog box in SketchUp

SuDCL is a dialog interface language for SketchUp Ruby Developers.
(Note: SuDCL is only available for the Windows platform. There is no MAC version at this time.)

It is used in the SketchUp add-on RpTools .

Developers who utilize Render Plus RpReports , or who wish to create their own SketchUp applications, can take advantage of SuDCL to customize some dialogs and add their own dialogs to their RpReports application.


Sample Usage

These examples make this look easier than it actually is. (It is easy, but as you try to do special things, it takes more and more work to get them right)

Loading the DLL to process dialog boxes

You compile a Visual C++ project to load and execute DCL files.

- You don't have to add anything the C++ DLL. But you can modify it if desired.

- If you don't modify it then then the ruby commands:

#load DLL
dll_name = $rptools_release_folder + "/RpTools.dll"
require (dll_name)

Load the DLL for the dialogs.

Loading a dialog box

To load a modeless dialog, such as the RpTools move dialog, you use this command:


A modal dialog box is slightly different, because it can often return OK or CANCEL. (SketchUp is suspended while a modal dialog is active)

Here is a sample which loads a modal dialog:

iret = load_dialog('rptools_support')	
return if iret != IDOK	
# if user clicked OK, then get a global value from the dialog box		
brptools_write_debug_file = get_global_bool("brptools_write_debug_file")

Here is a more complex example, where we get the current SketchUp material and place it in a global, so the material name can be displayed on the dialog box:

model = Sketchup.active_model
materials = model.materials
if (materials == nil || materials.current == nil)
	smaterial = "No Material Selected"
	smaterial =
set_global_String("snpr_current_material", smaterial)
iret = load_dialog('nprtools_shadows')
return if iret != IDOK

Test with RpTools

Putting a value box in a dialog and getting its global value:

1. Load RpTools. 2. Locate the file RpTools_support.dcl and add a value box to it in front of the ok_cancel line:

		label = "Test";
		global = rtest;

3. open the Ruby Console, and type in:

iret = $rptools.load_dialog('rptools_support')	

4. Note the value box labeled Test. Use the up and down arrows to change it.

5. Click OK

6. In the ruby console type in:

rtest = $rptools.get_global_double('rtest')

You now have fetched the global 'rtest' from the dialog and stored it in a ruby variable.

7. Try setting a different value for the global, and loading the dialog again:

$rptools.set_global_double('rtest', 21)

The new value should show in the dialog.

Adding a ruby command to a push button in the dialog:

1. add a push button to the support dialog:

		label = "Run Ruby Command";
		command = rb_test1("test1");

2. Create a file called test1.rb which looks like this:

class RpTools
        def rb_test1(sss)

3. Load test1.rb into Su ruby. e.g.:

load '/tmp/test1.rb'

4. Load your dialog:


5. Push the button on the dialog.

- It should run the command rb_test1 and print out 'test1' each time you push the button.

DCL/Ruby and C++ Interface


The DCL/Ruby includes DCL Dialog Boxes and Ruby funtions functions for:

  1. row and columns
  2. group rows and columns (with text labels)
  3. value boxes with labels and sliders
  4. edit boxes
  5. image boxes - contain images or icons
  6. list boxes and combo boxes
  7. global variable support for interaction between ruby and the dialog
  8. tabbed dialog and sub-dialog support

C++ Interface

The C++ interface allows you to link the DLL using custom routines of your own. This includes

  1. dc_xxx() functions which are called directly from the DCL dialogs (without needing to call ruby functions)
  2. dll_call_xxx() functions - which are C++ functions called directly from ruby.

Ruby, DCL dialogs, and the C++ code can communicate using the global variables. In addition, C++ code can access SketchUp Ruby classes directly or as passed parameters.

Development Platform and Caveats

You will be using the same software and documentation used by Render Plus to develop its SketchUp applications. In some cases the documentation will be incomplete, and some functions may not work properly. We will work with you to make the feature you need work properly.

Bug Splats
We are not able to create code which never causes SketchUp to occasionally Bug Splat. But we do a pretty good job.

However, during development you may get lots of Bug Splats - particularly if you are writing your own C-code, or are writing routines which thread back and forth or recurse between the DLL SketchUp functions. Usually when the code is written correctly, we are able to avoid these Bug Splats.

Purchasing Options

SuDCL is available in two versions:

  1. DCL/Ruby interface $1,950.00
  2. DCL/Ruby support contract $795.00 for first 15 months and then per year includes email support and new product versions.
  1. DCL/Ruby plus C++ interface $2,950.00
  2. DCL/Ruby plus C++ support contract $995.00 for first 15 months and then per year includes email support and new product versions.

The DCL/Ruby Interface support DCL dialogs, global variables and executing ruby commands from DCL dialogs.

The C++ interface allows you to define dc_xxx() C++, functions to be called by dialogs, and dll_call_xxx() C++ functions to be called from ruby which are then run in C++. You are also able to call SketchUp functions and access SketchUp classes from C++ using standard Ruby calls.

In both cases you receive a customized DLL which can be loaded into SketchUp using require(). The DLL is customized with the name of your company or application so that you can define function calls, etc. which are unique from other developers.

You will receive all product updates for 12 months, an unlimited application distribution license for your clients, and 8 hours of support to get you started. If you require additional support, you will need to purchase a support license. The initial support contract is for 15 months.

See Also