SUalive makes easy Connecting to or Driving animation your way

SUalive provides a Ruby API - Application Programming Interface - aiming beginner, intermediate or advanced user. Plug your code in the first or drive the full animation. Note SUalive Full only can adjust frames per second.


Beginner 2.12 - Quickly connect short code
First way. Copy past the following method at top level which means before any 'module My_name' line. Not very neat but usefull for short code or debug or quick test. Method name must remain unchanged. Replace method content the code you wish then click 'run' drop down and 'Free Output' item.

						def
							watch_SUalive_in_YDco657479255(
							frame_current, frame_count)
						
#do my job frames 2 and 3 only
if frame_current > 1 and frame_current < 4
puts "current " + frame_current.to_s + "/" + frame_count.to_s + " count"
return false if frame_current == 3
end
return true
end
						1:
2:
3:
4:
5:
6:
7:
8:


Intermediate 2.12 - Drive your way
Aims plugin developers and advanced users as well. SUalive runs silently. You get all needed data from the current model in one shot - see line number 3. One more code line to tell SUalive animating the next frame - line number 6. Line number 8 restores your SketchUp model. Don't forget last call line number 9. If not SUalive window never shows after API use.

						SKETCHUP_CONSOLE.clear
							if defined?(
							SKETCHUP_CONSOLE.clear)
						
if defined?( YDco657479255::api_SUalive_get_model)
fix_err_code, cls_api_SUalive, fix_frame_count, ary_xtra_data =
YDco657479255::api_SUalive_get_model( fix_frame_per_second = 24)
if fix_err_code == 0
for i in 0..fix_frame_count - 1
fix_current_frame = cls_api_SUalive.frame_next()
end
cls_api_SUalive.model_restore( perform_undo = true) #SUalive Full feature
cls_api_SUalive.anim_clean_variables()
else
puts "error code = " + fix_err_code.to_s
end
else
puts "missing SUalive"
end

# puts "2.12 error code ------->" + fix_err_code.to_s
# puts "2.12 frame count ------>" + fix_frame_count.to_s
# puts "ary extraData length--->" + ary_xtra_data.length.to_s
# puts "2.12 Frame second --->" + ary_xtra_data[0].to_s
# puts "2.12 Duration ------->" + ary_xtra_data[1].to_s
# puts "2.12 Project path --->" + ary_xtra_data[2].to_s
# puts "2.12 Model filename ->" + ary_xtra_data[3].to_s
						1:
2:
3:

4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:


Advanced 2.30 - Class syntax
Same as just above but direct access to class methods and attributes . Some likes having straight and full control over API.

						SKETCHUP_CONSOLE.clear
							if defined?(
							SKETCHUP_CONSOLE.clear)
						
begin
if YDco657479255.const_defined?( 'SUalive_api')
my_clas = YDco657479255::SUalive_api.new()
my_clas.anim_get_model( frames_per_second = 24)
if my_clas.anim_err_code == 0
for i in 0..my_clas.anim_frames_count - 1
fix_current_frame = my_clas.frame_next()
end
my_clas.model_restore( perform_undo = true) #SUalive Full feature
cls_api_SUalive.anim_clean_variables()
else
puts "error code = " + my_clas.anim_err_code.to_s
end
end
rescue Exception => e
puts e
end

# Class read-only attributes
# my_clas.anim_err_code Fixnum error number - see below section
# my_clas.anim_frames_count Fixnum total number of frames
# my_clas.anim_frames_per_second Fixnum adjusted frames per second number
# my_clas.anim_duration Float animation duration seconds
# my_clas.anim_project_path String SUalive project full path
# my_clas.anim_model_filename String SketchUp model name
# Class methods
# my_clas.anim_get_model( anm_frames_per_second )
# Fixnum parameter anm_frames_per_second 2 minimum
# fill all class variables
# my_clas.anim_frames_per_second ajusted
# return nil
# my_clas.frame_next()
# show animation next frame
# return current frame number
# my_clas.model_restore( perform_undo = false, delay = 1.0)
# optional Boolean parameter perform_undo true or false
# optional Float parameter delay 0.25 second minimum
# restore SketchUp model - SUalive Full feature
# return nil
# my_clas.anim_clean_variables( anm_err_no = 9 )
# optional Fixnum parameter anm_err_no
# initialize all class variables
# return nil
							1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:


Errors Codes
						# Ver. name        Code --> Message? Info
# 2.12 fix_err_code = 0 --> can process? OK keep going!
# 2.12 fix_err_code = 1 --> User interface shown? close SUalive window
# 2.12 fix_err_code = 2 --> no model? load a saved model
# 2.12 fix_err_code = 3 --> not valid path? unexpected path
# 2.12 fix_err_code = 4 --> project is missing? not a SUalive project
# 2.12 fix_err_code = 5 --> no action? nothing to animate
# 2.12 fix_err_code = 6 --> no frame? nothing to animate
# 2.12 fix_err_code = 7 --> Frames/sec not valid? must be greater than 0
# 2.12 fix_err_code = 8 --> Frames/sec not Fixnum? 24 but not 24.25 or 24.0
# 2.30 fix_err_code = 9 --> Class initialized? all variables clean
# 2.30 fix_err_code =10 --> SUalive not running? accept license please
# 2.30 fix_err_code =99 --> Unknown error? error number set not valid