it works fine with El Capitan and SU v17 for me...
if the Finder icon size is set to small it will revert to the generic icon instead...
and it will show old files the same unless saved in v17...
are you seeing none?
john
it works fine with El Capitan and SU v17 for me...
if the Finder icon size is set to small it will revert to the generic icon instead...
and it will show old files the same unless saved in v17...
are you seeing none?
john
@dan rathbun said:
Let us try some tests to see if we can get Chrome to close the select drop lists.
using Enter or a Click closes them, if not, there is a javascript over-ride preventing default behaviour...
john
@garry k said:
I use JQuery - not JsFiddle.
JsFiddle is an online test environment...
you can even test your jQuery in it...
if you launch it from within SU it quickly shows if code works in the SU browser of your running [IE/Safari/CEF]...
to test you use set_url and add code too see what flies...
both your issues work in CEF using vanilla js inside SU, so are most likely jQuery needing updating...
john
Garry
I can color the backgrounds of input boxes with css...
and the Enter key works as well...
test this fiddle in a HtmlDialog...
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
(jsfiddle.net)
it works on a mac for CEF in SU...
are you trying with jQuery or another framework?
john
you must have changed something because it does work for me...
did you read the code?
it collects all nested materials from 'everything' before removing any materials...
click image to see gif:
attach your test code...
john
another way is to Hash the materials and set values for each...
def purge_comps_n_mats(*args)
model = Sketchup.active_model
defs = model.definitions
sel = model.selection
view = model.active_view
ents = model.active_entities
mats = model.materials
# add a hasj for materials and entities
mats_h = Hash[mats.zip([1] * mats.size)]
# this means you don't have to get Regexp right yourself
names = Regexp.union(args)
# this is similar to defs.to_a.dup.flatten
list = defs.find_all { |d| d }
# we will still only use one operation as v17 will error
model.start_operation('mats')
list.each do |defn|
defn.instances.each do |i|
######################
# optional 'showtime' for testing
sel.add(i)
view.refresh
sleep 0.2
######################
dents = defn.entities
if defn.name =~ names
# get rid of the comps checking their materials
mats_h[defn.material] = 3 unless defn.material.nil?
mats_h[i.material] = 3 unless i.material.nil?
dents.to_a.each do |item|
mats_h[item.material] = 3 if item.respond_to? ;material
mats_h[item.back_material] = 3 if item.respond_to? ;back_material
end
# delete the instance
ents.erase_entities(i)
else
mats_h[defn.material] = 2 unless defn.material.nil?
mats_h[i.material] = 2 unless i.material.nil?
dents.to_a.each do |item|
mats_h[item.material] = 2 if item.respond_to? ;material
mats_h[item.back_material] = 2 if item.respond_to? ;back_material
end
end
end
end
ents.to_a.each do |item|
######################
# optional 'showtime' for testing
sel.add(item)
view.refresh
sleep 0.2
######################
mats_h[item.material] = 2 if item.respond_to? ;material
mats_h[item.back_material] = 2 if item.respond_to? ;back_material
end
mats_h.each { |k, v| mats.remove(k) unless k.nil? || v != 3 }
model.commit_operation #
end
purge_comps_n_mats('CUBE', 'TOTO', 'LOLA')
john
edited my example...
line 55 i is now item...
john
it's basically TIG's code + a couple of tweaks, I made it 'visualised' to help you 'see' what's happening because I find it useful myself...
none of these are needed at all and the code will run faster...
sel.add(i)
view.refresh
sleep 0.2
so either comment them out or delete them for 'production code'...
any 'progress bar' will add even more overhead and can only slow the progress more...
john
you can do things by comparing instance scaling...
model = Sketchup.active_model
defs = model.definitions
insts = defs[0].instances
insts.each{|i| p (i.scaled_size - i.unscaled_size)[0].to_mm if i.scaled_size != i.unscaled_size}
john
sometime it's worth writing 'visual code' to see how the ruby works...
click to see gif...
this is based on Tigs example
def explode_named(*args)
model = Sketchup.active_model
defs = model.definitions
sel = model.selection
view = model.active_view
names = Regexp.union(args)
matches = defs.find_all{|d| d.name =~ names }
model.start_operation('Explode Inards')
matches.each{|match|
match.instances.each{|i|
sel.add(i)
view.refresh
sleep 0.2
i.explode
}
}
defs.purge_unused
model.commit_operation #
end
to run
explode_named("Sophie","Chris")
john
you can use a copy of raw geometry to remove it...
click image to see the gif...
john
I don't use win dose at all, but you could try fixing the ruby which is failing on line 86...
add this after the current line 85 and save...
next if addr.addr.nil?
re-start SU and
# required the gem
require 'macaddr'
# call the method
Mac.addr
john
that is copy pasted from Ruby Console in SU v17
# first I installed the two gems
Gem.install 'systemu'
Gem.install 'macaddr'
# then I required the gem
require 'macaddr'
# then I called the method
Mac.addr
# I left out the return as I don't want it public...
john
works on my mac...
you need to fill in your details...
> Gem.install 'systemu'
[#<Gem;;Specification;0x3fdf178087e4 systemu-2.6.5>]
> Gem.install 'macaddr'
[#<Gem;;Specification;0x3fdf1841b4c8 macaddr-1.7.1>]
> require 'macaddr'
true
> Mac.addr
john
the way it works in Preview.app would be good...
john
@tuna1957 said:
Why did this file import into SU at such an abnormal size?
you need to set the import units to match the files units...
I normally have it set to meters, but changed it to inches for this one...
john
Goldilocks needs a minor tweak to be better on a mac...
do a search and replace for the word 'show' and replace with 'show_modal'...
john
there is an error on the end and results depend on how you fix it...
john
have you tried setting your 'Viewport' to the same ratio as export?
i.e. make it square...
john