-
Notifications
You must be signed in to change notification settings - Fork 10
[Request] Sketchup Dialog Box UI Methods #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you explain your scenario and use cases in more detail? Why do you need to drive the UI like this? |
First would be the ability to make a method to bulk rename selected layers not all layers. The following is a simplified versions of Bulk Rename All Layers. def self.bulk_rename_layers(find_txt:, add_txt: )
sel = Sketchup.active_model.layers.to_a
return if sel.empty?
layers_h = sel.map { |v| { e: v, txt: v.name } }
layers_h.select! { |v| v[:txt].include?(find_txt) }
return if layers_h.empty?
layer_h.each { |v|
v[:n] = v[:txt].gsub( /#{Regexp.quote(h_glb[:find_txt])}/, h_glb[:add_txt]
v[:target] = Sketchup.active_model.layers[v[:n]]
)
Sketchup.active_model.start_operation("Bulk Rename Layers")
layers_h.each { |e|
if v[:target].nil?
Sketchup.active_model.layers[v[:txt]].name = v[:n]
v[:target] = Sketchup.active_model.layers[v[:n]]
else
ents = Sketchup.active_model.entities
top = ents.select { |ent| ent.layer == v[:txt] }
dlist = Sketchup.active_model.definitions
reassign = top + dlist.flat_map do |cdef|
cdef.entities.select { |ent| ent.layer == v[:txt] }
end
next if reassign.empty?
reassign.each { |ent| ent.layer = v[:target] }
end
}
Sketchup.active_model.commit_operation
end I would change the first line of the method to something like. sel = Sketchup.active_model.tagdialog.selection.to_a Then at the end of the method after the commit I would add the following sel = Sketchup.active_model.tagdialog.selection.clear
sel_tags = layers_h.map { |v| v[:target] }
sel = Sketchup.active_model.tagdialog.selection.add( sel_tags ) |
The need to drive the UI is very little compared the need to read the UI. adding selection method is 90% of the need and easier to add to the api. Sketchup.active_model.tagdialog.selection 10% of the need is the other listed methods
|
Many of my ruby scripts have work arounds because there is no Api methods for interacting with the Dialog boxes.
Could not find an existing Request so here it is.
The highest priority Dialog Boxes are listed below
Specific Methods
I can break these out to separate requests if requested.
The text was updated successfully, but these errors were encountered: