@alexmozg said:
… Ask me, and I shall try to answer.
Here is my »Fahrstuhl«, english elevator.
My script selects the "Fahrstuhl“, puts it to another position (here position 1 and 2), and then clears the selection:
select_comp_by_name("Fahrstuhl")
Morisdov.transf_get("transf1")
UI.start_timer(1, false) {Sketchup.active_model.selection.clear}
Position 1
select_comp_by_name("Fahrstuhl")
Morisdov.transf_get("transf2")
UI.start_timer(1, false) {Sketchup.active_model.selection.clear}
Position 2
To get the script work, the following .rbs must be installed:
- select_com_by_name.rb
def select_comp_by_name(comp_name)
model = Sketchup.active_model
sel = model.selection
sel.clear
if compdef = Sketchup.active_model.definitions[comp_name]
sel.add(compdef.instances)
else
Sketchup.active_model.active_entities.each do |d|
if d.typename == "ComponentInstance"
sel.add d if d.name==comp_name
end
end
if sel.count == 0
UI.beep
else
UI.messagebox(sel.count.to_s + " gesuchte Dinger gefunden.")
end
end
end
- proper_animation.rb
My question is, how to select the "Fahrstuhl/elevator" without selection marks.
So I tried to use the following script:
def self.timer(proc, time_limit=1)
$val_time = Time.now
$timer = UI.start_timer(0, true) do
if Time.now - $val_time >= time_limit
UI.stop_timer $timer
proc.call
$val_time = $timer = nil
end
end
end
select_comp_by_name("Fahrstuhl")
Morisdov.transf_get("transf2")
self.timer(proc{Sketchup.active_model.selection.clear})
Would be a wonder to get the arrows in model be buttons, which start the elevator scripts.
Fahrstuhl = Elevator