Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Ruby/1111
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
model = Sketchup.active_model
ents = model.active_entities
sel = model.selection

faces = sel.grep(Sketchup::Face)

if faces.empty?
UI.messagebox("هیچ Faceای انتخاب نشده")
return
end

model.start_operation("2mm Gold Polish Group", true)

# گروه‌کردن
group = ents.add_group(faces)
gents = group.entities

# ضخامت 2 میلی‌متر
faces.each do |f|
begin
f.pushpull(2.mm)
rescue
end
end

# ساخت متریال طلایی
mats = model.materials
gold = mats["Gold_Polished"] || mats.add("Gold_Polished")
gold.color = Sketchup::Color.new(212, 175, 55)
gold.shininess = 80

# اعمال متریال
group.material = gold

# نرم‌کردن لبه‌ها (حس پولیش)
edges = gents.grep(Sketchup::Edge)
edges.each do |e|
e.soft = true
e.smooth = true
end

model.commit_operation