Oké so let’s make the code easier also add the picture of the dialog. When you push the image the column will be placed.
But the @defn.set_attribute( 'dynamic_attributes', '_type_formula', "#{value}")
still doesn’t work.
def kolom
@mod = Sketchup.active_model
@ent = @mod.active_entities
@dlg=UI::WebDialog.new("Entresolvloer", false,"WDID",1000,1100,200,200,true)
@dlg.set_background_color("white")
html = <<-HTML
<html>
<head>
<meta charset="utf-8" />
<script>
function sendKolomChoice( value ) {
window.location = "skp:kolom@"+value;
alert: (value);
}
</script>
<body>
<form action='skp:kolom@'>
Select Column type:
<select id="this_drop_list" onchange="sendKolomChoice(this.value);">
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="600" selected>600</option>
</select>
<center><input type="image" src="C://Users/techniek/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/12.gif" alt="Build FLoor" width="95" height="80"/></center>
</form>
</body>
</html>
HTML
@dlg.set_html(html)
@dlg.add_action_callback("kolom") {|d,p|
@mod.start_operation "Create Kolom"
model = Sketchup.active_model
@defn = model.definitions
componentdefinition = @defn.load ( "Z:/Algemeen 2016/Systeemvloeren/Tekeningen/Sketchup/Enkelzijdige kolom C350.skp" )
@defn = componentdefinition
@defn = model.active_entities.add_instance( @defn, [0,0,0] )
@defn.set_attribute( 'dynamic_attributes', '_type_formula', "#{value}")
dcs = $dc_observers.get_latest_class
dcs.redraw_with_undo(@defn)
};
RUBY_PLATFORM =~ /(darwin)/ ? @dlg.show_modal() : @dlg.show();
end
kolom