Arkitera Forum  
Geri Git   Arkitera Forum > Mimarlık ve Bilişim > Yazılımlar > SketchUp

Yanıt
 
Konu Araçları Modları Görüntüle
Eski 08-06-2008, 01:20   #1
Arkitera Üyesi
 
kentli'in Avatar'ı
 
Kayıt Tarihi: 12-01-2007
Mesaj: 46
Make Face

# Copyright 2004, Todd Burch - Burchwood USA www.burchwoodusa.com - /

# Permission to use, copy, modify, and distribute this software for
# any purpose and without fee is hereby granted, provided that the above
# copyright notice appear in all copies.

# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

# Name : makefaces.rb 1.1
# Description : Creates faces only on selected objects that could potentially receive a face.
# Author : Todd Burch www.burchwoodusa.com - /
# Usage : 1. select all elements for which you want a face.
# 2. Run "Make Faces" from the Tools menu.
# Date : 17.Jul.2004
# Type : Tool
# History: 1.0 (17.Jul.2004) - first version
# 1.1 (23.Aug.2004) - Add text-based percentage complete progress messages
# - Move statistics to a pop-up messagebox from the Ruby Console.
#
#-----------------------------------------------------------------------------

require 'sketchup.rb'

#-----------------------------------------------------------------------------
#
# The following method will format the elapsed time when passed the total seconds
# elapsed for a process.
#
# To use the routine, at the start of your script, issue: t1 = Time.now
# That is the start time.
#
# When your script is about finished, call this method while issueing
# the Time.now method again, and subtracting the initial time like this:
# elapsed_time = seconds_2_dhms(Time.now-t1).
#
# A formatted string is returned, in the format:
#
# "W Days, X Hour(s), Y Minute(s), and Z Seconds."
#
# If only seconds had elapsed (a quick running process), then only "Z Seconds." will be
# returned. If the process lasted over a minute, "Y Minute(s), Z Seconds." will be returned,
# and so on.
#
#
#-----------------------------------------------------------------------------

def seconds_2_dhms (secs) # Input is seconds: Time2 - Time1
seconds = secs % 60 # Calcuate whole and fractional seconds.
time = secs.round # Round to nearest whole second.
time /= 60 # Divide by 60 to remove seconds.
minutes = time % 60 # Calculate portions of a hour.
time /= 60 # Remove any portions of an hour
hours = time % 24 # Calculate portions of a day in hours
days = time / 24 # The remainder is days

if (days > 0) then days = days.to_s<<" Day(s), " else days = " " end
if (hours > 0) then hours = hours.to_s<<" Hour(s), " else hours = " " end
if (minutes > 0) then minutes = minutes.to_s<< " Minute(s), " else minutes = " " end
seconds = seconds.to_s<< " Second(s)."
return (days<<hours<<minutes<<seconds).strip!
end # seconds_2_dhms

#-----------------------------------------------------------------------------
# This tellPctComplete method will display a text-based progress bar in the status bar.
#
# It is passed two values. The first is the iteration count of your loop. The
# second value is the magnitude of your loop.
#
# Nothing is returned to the caller, but the status bar will have been updated.
#
# Using the default characters, "-" and ">", the line will look similar to the following:
#
# --------------->---------------- 50%
#
#-----------------------------------------------------------------------------

def tellPctComplete(iteration,total)
linechar = "-" # Set default line building character.
progresschar = ">" # Set default moving indicator.
pct = (iteration*100)/total # Calculate percentage complete.
pct = 1 if pct <= 0 # round up to 1% if anything less than 1%.
initial_block = linechar * 100 # Default progress bar line sequence.
current_block = initial_block[0,pct-1] << progresschar << initial_block[pct,initial_block.length]
Sketchup.set_status_text(current_block << " " << (pct.to_s)<<"%.")
return
end # tellPctComplete


#-----------------------------------------------------------------------------
#
# This routine creates faces from lines that make up closed sections.
#
#-----------------------------------------------------------------------------

def makeFaces11
t1 = Time.now
Sketchup.active_model.start_operation "Make Faces"
#Get the current selection
ss = Sketchup.active_model.selection
total_items = ss.count # Total count of all selected entities.
x = 0 # faces-added accumulator
z = 0 # loop count
notAnEdge = 0 # Accumulator for non-Edges
ss.each {|e|
if e.typename == "Edge" then # find_faces only works on edges.
x += e.find_faces # This creates faces if they can created. Returns # faces created.
else notAnEdge+=1 # Keep track of selections that were not an edge.
end
z+=1 # bump loop counter
tellPctComplete z,total_items # Report Progress.
}
Sketchup.active_model.commit_operation # "Make Faces"

# Calculate the time that has elapsed in seconds.
elap = seconds_2_dhms(Time.now - t1)
UI.messagebox("makefaces.rb: Copyright 2004 Burchwood USA." <<
"\nVersion 1.1 August 23,2004." <<
"\n\nThere were " << total_items.to_s << " selected items." <<
"\n\nThere were " << notAnEdge.to_s << " non-Edge selected items." <<
"\nThere were " << (total_items-notAnEdge).to_s << " Edges selected." <<
"\n\nThere were " << x.to_s << " face(s) added." <<
"\nThe process lasted: "<< elap, MB_MULTILINE, "Make Faces Statistics")
end # makeFaces11


# This will add an item called "Make Faces 1.1" to the Tools menu.

# First check to see if we have already loaded this file so that we only
# add the item to the menu once
if( not file_loaded?("makefaces11.rb") )
# This will add a separator to the menu, but only once
add_separator_to_menu("Tools")
UI.menu("Tools").add_item("Make Faces 1.1") { makeFaces11 }
end

#-----------------------------------------------------------------------------
file_loaded("makefaces11.rb")





bu ruby script ile autocadde çizip çağırdığımız projelerde
üstüne tekrar çizgi çizerek alan kapatmak yerine
tüm projeyi seçip otomatik alan kapatabiliyoruz
oldukça işime yaradı paylaşmak istedim
kolay gelsin
__________________
zaviyelerimin yekünü bir murabba kadar bile değil

En son kentli tarafından düzenlendi : 08-06-2008 01:26.
kentli offline   Alıntı Yaparak Yanıtla
Eski 08-06-2008, 12:54   #2
Arkitera Üyesi
 
süreyyarc'in Avatar'ı
 
Kayıt Tarihi: 27-02-2008
Mesaj: 36
Çok güzel bir özellik fakat daha açıklayıcı bir şekilde anlatırsanız faydalı olacak sanırım.Bunu nasıl uygulayacağımı anlamadım.
süreyyarc offline   Alıntı Yaparak Yanıtla
Eski 08-06-2008, 13:28   #3
Arkitera Üyesi
 
kentli'in Avatar'ı
 
Kayıt Tarihi: 12-01-2007
Mesaj: 46
bir not defterinden bu kodları makeface.rb olarak kaydedin
SU ın plugins klasörüne koyun
autocad çiziminizi çağırın ve tüm projeyi seçin
sonra tools altında makeface 1.1 gelecek
tüm çizgileriniz seçiliyken buna tıklayın
size bir reportta kaç alan oluşturuduğu, kaç çizgi olduğu felan verilecek
ve alanlarınızın hepsi kapalı olacak
__________________
zaviyelerimin yekünü bir murabba kadar bile değil
kentli offline   Alıntı Yaparak Yanıtla
Eski 08-06-2008, 13:31   #4
Arkitera Üyesi
 
süreyyarc'in Avatar'ı
 
Kayıt Tarihi: 27-02-2008
Mesaj: 36
Çok teşekkürler.
süreyyarc offline   Alıntı Yaparak Yanıtla
Eski 08-06-2008, 13:39   #5
Arkitera Üyesi
 
kentli'in Avatar'ı
 
Kayıt Tarihi: 12-01-2007
Mesaj: 46
yalnız tüm çizgilerin kapalı olması lazım
__________________
zaviyelerimin yekünü bir murabba kadar bile değil
kentli offline   Alıntı Yaparak Yanıtla
Eski 09-06-2008, 10:29   #6
Arkitera Üyesi
 
Ugar'in Avatar'ı
 
Kayıt Tarihi: 01-04-2004
Mesaj: 62
Eğrisel çizgilerde de işe yarıyor mu?
Ugar offline   Alıntı Yaparak Yanıtla
Eski 09-06-2008, 22:20   #7
Arkitera Üyesi
 
kentli'in Avatar'ı
 
Kayıt Tarihi: 12-01-2007
Mesaj: 46
2 boyut eğrisel çizgilerde oluyor
ama kot olan eğim çizgilerinde kapatmıyor zaten onu da sand boxtan kapatıyoruz
__________________
zaviyelerimin yekünü bir murabba kadar bile değil
kentli offline   Alıntı Yaparak Yanıtla
Eski 12-06-2008, 13:29   #8
Arkitera Üyesi
 
urbandesigner'in Avatar'ı
 
Kayıt Tarihi: 20-06-2006
Mesaj: 16
buna gerek yok, make face'in rubyleri hazır olarak var zaten...
urbandesigner offline   Alıntı Yaparak Yanıtla
Eski 01-07-2008, 20:55   #9
Arkitera Üyesi
 
Kayıt Tarihi: 25-11-2002
Mesaj: 54
Güzel paylaşım teşekkürler.
__________________
Simyacı
rzeytun offline   Alıntı Yaparak Yanıtla
Eski 01-08-2008, 12:05   #10
Arkitera Üyesi
 
Kayıt Tarihi: 27-02-2008
Mesaj: 6
autocadden attıktan sonra çizimin üzerine yüzey çizip soonra çizimi intersect ten with model deyip de yapabilirmiyiz. b bakın isterseniz
melikaydın offline   Alıntı Yaparak Yanıtla
Yanıt

Yerimi olarak kaydedin


Şu an bu konuyu izleyen aktif kullanıcılar: 1 (0 üye ve 1 misafir)
 
Konu Araçları
Modları Görüntüle

Mesaj Yazma Hakları
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Açık
[IMG] kodu Açık
HTML kodu Kapalı
Trackbacks are Açık
Pingbacks are Açık
Refbacks are Kapalı


Tüm saatler GMT +3. şu anda saat 10:22.


Powered by vBulletin® |Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177