LayOut C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
ruby_api.h File Reference

Interfaces for exchanging data between SketchUp's Ruby API and C API. More...

#include <SketchUpAPI/common.h>
#include <SketchUpAPI/model/defs.h>

Go to the source code of this file.

Macros

#define RUBY_VALUE   unsigned long
 This macro is defining a type matching Ruby's own VALUE type and can be used interchangeably. More...
 

Functions

SU_RESULT SUEntityToRuby (SUEntityRef entity, RUBY_VALUE *ruby_entity)
 Converts a C API entity to a Ruby API entity. More...
 
SU_RESULT SUEntityFromRuby (RUBY_VALUE ruby_entity, SUEntityRef *entity)
 Converts a Ruby API entity to a C API entity. More...
 
SU_RESULT SUImageRepToRuby (SUImageRepRef imagerep, RUBY_VALUE *ruby_imagerep)
 Converts a C API entity to a Ruby API imagerep. More...
 
SU_RESULT SUImageRepFromRuby (RUBY_VALUE ruby_imagerep, SUImageRepRef *imagerep)
 Converts a Ruby API imagerep to a C API imagerep. More...
 

Detailed Description

Interfaces for exchanging data between SketchUp's Ruby API and C API.

Note
This is for use only within the SketchUp application.

Macro Definition Documentation

#define RUBY_VALUE   unsigned long

This macro is defining a type matching Ruby's own VALUE type and can be used interchangeably.

Function Documentation

SU_RESULT SUEntityFromRuby ( RUBY_VALUE  ruby_entity,
SUEntityRef *  entity 
)

Converts a Ruby API entity to a C API entity.

Since
SketchUp 2020.2, API 8.2
Parameters
[in]ruby_entityThe Ruby API entity reference.
[out]entityThe retrieved C API entity reference.
See Also
SUModelRef
Returns
SU_RESULT SUEntityToRuby ( SUEntityRef  entity,
RUBY_VALUE ruby_entity 
)

Converts a C API entity to a Ruby API entity.

Since
SketchUp 2020.2, API 8.2
Parameters
[in]entityThe C API entity reference.
[out]ruby_entityThe retrieved Ruby API entity reference.
See Also
SUModelRef
Returns
SU_RESULT SUImageRepFromRuby ( RUBY_VALUE  ruby_imagerep,
SUImageRepRef *  imagerep 
)

Converts a Ruby API imagerep to a C API imagerep.

Note
Ruby retains the ownership of the object it should not be released by SUImageRepRelease.
Warning
The returned C API reference points to an object that is owned by the Ruby runtime and it may be garbage collected. To avoid this, ensure that the Ruby API reference has a longer lifetime than the C API reference.
Since
SketchUp 2020.2, API 8.2
Parameters
[in]ruby_imagerepThe Ruby API imagerep reference.
[out]imagerepThe retrieved C API imagerep reference.
See Also
SUModelRef
Returns
SU_RESULT SUImageRepToRuby ( SUImageRepRef  imagerep,
RUBY_VALUE ruby_imagerep 
)

Converts a C API entity to a Ruby API imagerep.

Note
Ruby takes ownership of the object it should not be released by SUImageRepRelease. It will be released when Ruby garbage collects the Ruby references to it.
Since
SketchUp 2020.2, API 8.2
Parameters
[in]imagerepThe C API imagerep reference.
[out]ruby_imagerepThe retrieved Ruby API imagerep reference.
See Also
SUModelRef
Returns