Another approach for copyying a compo in a loop - no success
-
hi,
sorry, i have to try again with another approach:this is , what ruby reports first:
FROM RUBY:
menues # my module running and ok
masterdefinitions set # my module running and ok
master-components defined # my module running and ok
start masterloop # my module running and ok
creating top-handrail tubes (followme)-beta # my module running : PROBLEM
Error: #<NoMethodError: undefined methoddefinition' for nil:NilClass> C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/01.rb:2440:in
top_handrails'
C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/01.rb:2404:ineach' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/01.rb:2404:in
top_handrails'
C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/01.rb:60
END REPORTthis ist the code
MODULE start_masterloop
....some other code
model = Sketchup.active_model entities = @group_handlauf_mitte1.entities entities.erase_entities entities[0] rl1 = [0, y1, 0] rl2 = [0, y2, z] group = @group_handlauf_mitte1 = entities.add_group entities2 = @group_handlauf_mitte1.entities for mth in 1..@podestnr group = @group_handlauf_mitte1 = entities.add_group entities2 = @group_handlauf_mitte1.entities new_line = entities2.add_line rl1, rl2 length = new_line.length pf[mth] = [0, 0 - @run+@run*@il*(mth-1)+@run*@la*(mth-1)+@ro.abs, (mth-1)*@il*@rise+@mr] #mitte if mth == 1 centerpoint = pf[mth] vector = new_line.line[1] vector2 = vector.normalize! edges2 = entities2.add_circle centerpoint, vector2, @thradius kreis2 = entities2.add_face edges2 status = kreis2.reverse! entity1 = entities[0] kurvem = entity1.all_connected status1 = kreis2.followme kurvem @group_handlauf_mitte1 = group.to_component defn = @group_handlauf_mitte1.definition defn.name = "@group_handlauf_mitte_compo" status = @group_handlauf_mitte1.explode # NOTE 1 elsif mth > 1 model = Sketchup.active_model entities2 = Sketchup.active_model.entities componentinstance = entities2.add_instance(@group_handlauf_mitte_compo.definition, pf[mth]) # NOTE 2 (= LINE 2440) puts mth # CONTROLL OUTPUT - WORKS end new_line.erase! end
END OF MODULE
what i want to achieve, is to create a component in step 1 of the loop and copy this component to points pf[mth] in the other steps of the loop.
i desperately try, but always get an error for copyying the component.
i also tried:
explode the group, in which the component is created, but then there is not the component left, but the group (no idea how)so maybe someone has an idea...
thank you
stan
Advertisement