Documente Academic
Documente Profesional
Documente Cultură
INTRODUCERE ÎN DRAFTING
47
Proiectarea asistată de calculator a echipamentelor UIP
a) Standard Toolbar
Uneltele barei standard sunt (fig. 4.2): 1 – New Drawing; 2 – Open
Drawing; 3 – Save Drawing; 4 – Cut; 5 – Copy; 6 – Paste; 7 – Print; 8 – Insert
Model (Ctrl+M); 9 – Exchange Model; 10 – Model Information; 11 – Verify.
48
Lucrarea nr. 4
b) Controls Toolbar
Uneltele barei de control (de opţiuni) sunt (fig. 4.3): 1 – Operation
Complete (RETURN); 2 – Quit (F9); 3 – Cancel (ESC); 4 – Options (F10); 5 –
All (F11); 6 – Repaint (Ctrl+R); 7 – Zoom Auto (Ctrl+A); 8 – Zoom In
(Ctrl+I); 9 – Zoom Out (Ctrl+U); 10 – Zoom Previous (Ctrl+E); 11 – Select
Window; 12 – Pan (Ctrl+W).
c) Geometry Toolbar
Uneltele barei de generare a geometriilor sunt (fig. 4.4): 1 – Virtual
Geometry Mode; 2 – Insert Point; 3 – Insert Line; 4 – Insert Arc; 5 – Insert
Poly Line; 6 – Insert Conic; 7 – Insert Spline; 8 – Insert Rectangle; 9 – Insert
Square; 10 – Insert 2D Primitive; 11 – Insert Parallel Curve.
d) Vitesse Toolbar
Uneltele barei de programare sunt (fig. 4.5): 1 – Vitesse; 2 – Edit
script; 3 – Run selected; 4 – Selceted Script to Run; 5 – Debugger; 6 – Vitesse
log; 7 – Reload modules; 8 – Terminate current script.
49
Proiectarea asistată de calculator a echipamentelor UIP
f) Lock Toolbar
Uneltele barei de blocare sunt (fig. 4.7): 1 – Lock U; 2 – Lock V.
g) Transformation Toolbar
Uneltele barei de transformări sunt (fig. 4.8): 1 – Scale; 2 – Move
Delta; 3 – Move Two Positions; 4 – Rotate Delta; 5 – Rotate Two Positions; 6
– Rotate 45 Degrees; 7 – Rotate 90 Degrees; 8 – Rotate 180 Degrees; 9 –
Rotate -90 Degrees; 10 – Mirror V; 11 – Mirror U; 12 – Mirror any line; 13 –
Parallel; 14 – Four Positions; 15 – Same as; 16 – Along Curve; 17 – Snap; 18
– Lock U; 19 – Lock V; 20 – Centre; 21 – For Detection.
50
Lucrarea nr. 4
i) 3D Request Toolbar
Uneltele barei de opţiuni 3D sunt (fig. 4.10): 1 – Key In; 2 – Event; 3 –
Offset Current; 4 – Lock U; 5 – Lock V; 6 – Lock View; 7 – Lock X; 8 – Lock
Y; 9 – Lock Z; 10 – Lock Event Plane; 11 – Lock XZ; 12 – Lock YZ; 13 –
Lock XY; 14 – Lock Event Line; 15 – Lock Any Line; 16 – Unlock; 17 – Set
Current; 18 – Add Offset; 19 – Verify.
j) Geometry 2 Toolbar
Uneltele barei de editare a geometriilor sunt (fig. 4.11): 1 – Transform
Geometry; 2 – Copy Geometry; 3 – Delete Geometry.
k) Shading Toolbar
Uneltele barei de umbrire sunt (fig. 4.12): 1 – Select; 2 – Auto Scale; 3
– Zoom Window; 4 – Zoom; 5 – Slide; 6 – Spin; 7 – Walk; 8 – Tilt; 9 – Top
View; 10 – Frame View-Looking Aft; 11 – Frame View-Looking Fwd.; 12 –
Side View-Looking Port; 13 – Isometric-Looking Aft; 14 – Isometric-Looking
Fwd.; 15 – Select Perspective Camera.
51
Proiectarea asistată de calculator a echipamentelor UIP
l) Dimension Toolbar
Uneltele barei de dimensionare sunt (fig. 4.13): 1 – Linear Dimension;
2 – Radius Dimension; 3 – Diameter Dimension; 4 – Angle Dimension; 5 –
Curved Dimension; 6 – Area Dimension; 7 – Distance Dimension; 8 – 3D
Linear Dimension; 9 – 3D Axis Parallel Dimension; 10 – 3D Co-ordinate
Dimension; 11 – 3D Curved Length Dimension; 12 – WCOG Dimension; 13 –
Shell Profile Mounting Angle Dimension; 14 – Dimension3D Ruler
Dimension; 15 – Note; 16 – Modify Dimension; 17 – Move Reference.
m) Subpicture Toolbar
Uneltele barei de subpicturi sunt (fig. 4.14): 1 – Current Subpicture; 2
– Transform Subpicture; 3 – Copy Subpicture; 4 – Delete Subpicture; 5 – Split
Subpicture; 6 – Regroup Subpicture.
52
Lucrarea nr. 4
o) Symbol Toolbar
Uneltele barei de simboluri sunt (fig. 4.16): 1 – Insert Symbol; 2 –
Move Symbol; 3 – Copy Symbol; 4 – Modify Symbol; 5 – Delete Symbol.
p) Text Toolbar
Uneltele barei de texte sunt (fig. 4.17): 1 – Insert Text; 2 – Edit Text; 3
– Move Text; 4 – Copy Text; 5 – Modify Text; 6 – Delete Text Line.
def post(*args):
try:
if kcs_util.app_basic_design():
basic_design_menu.add(10)
except:
print "Failed adding menu(s): ",kcs_gui.error
return kcs_util.trigger_ok()
def pre(*args):
return kcs_util.trigger_ok()
Tabel 4.2. Cod de definire a funcţionalităţii butoanelor din bara de instrumente personalizată
kcs_gui.toolbar_button_usr_add(Toolbar, Position, Script, ImageFile, Tooltip, Message)
def post(*args):
if (kcs_util.app_pipe()) or (kcs_util.app_ventilation()) or (kcs_util.app_drafting()):
try:
iconFolder = "C:\\tribon\\m3\\vitesse\\trigger\\iconFiles\\"
piping_toolbar_user = kcs_gui.toolbar_add("Piping Toolbar 1")
kcs_gui.toolbar_button_usr_add(piping_toolbar_user,0,"piping_function_1",iconFolder +
"piping_function_1.ico","Function 1","Function 1")
kcs_gui.toolbar_button_usr_add(piping_toolbar_user,1,"piping_function_2",iconFolder +
"piping_function_2.ico","Function 2","Function 2")
kcs_gui.toolbar_button_usr_add(piping_toolbar_user,2,"piping_function_3",iconFolder +
"piping_function_3.ico","Function 3","Function 3")
except:
print "Failed adding toolbar buttons: ",kcs_gui.error
Tabel 4.4. Cod de definire a funcţionalităţii butoanelor din bara de instrumente standardizate
kcs_gui.toolbar_button_std_add(Toolbar, Position, Function, ImageFile, Tooltip, Message)
def post(*args):
if (kcs_util.app_pipe()) or (kcs_util.app_ventilation()) or (kcs_util.app_drafting()):
try:
iconFolder = "C:\\ tribon\\m3\\vitesse\\trigger\\iconFiles\\"
piping_toolbar_std = kcs_gui.toolbar_add("Piping Toolbar 2")
kcs_gui.toolbar_button_std_add(piping_toolbar_std, 0, 33453, iconFolder +
"pipe_move.ico","Pipe Move")
kcs_gui.toolbar_button_std_add(piping_toolbar_std, 1, 33454, iconFolder +
"pipe_duplicate.ico","Pipe Duplicate")
kcs_gui.toolbar_button_std_add(piping_toolbar_std, 2, 33455, iconFolder +
"pipe_group_rename.ico","Pipe Group Rename")
except:
print "Failed adding toolbar buttons: ",kcs_gui.error
4.6. APLICAŢII
4.6.1. Crearea barelor de instrumente utilizator
Rezolvare:
57
Proiectarea asistată de calculator a echipamentelor UIP
def fd_change_text():
try:
confirm = "no"
answer = ["Change text without confirmation","Change text with confirmation"]
result, index = kcs_ui.choice_select("Text", "Answer", answer)
if result == kcs_util.ok():
while 1:
if index == 2: confirm = "yes"
text = KcsText.Text()
58
Lucrarea nr. 4
#Request the user to input the text to be search
note = kcs_ui.string_req("Text to be changed: ")
if note[0] != kcs_util.ok():
exit()
note_text = string.replace(note[1],"*","") # remove the wildcards since string.find()
function doesn't need it
#Request the user to input the new text
note_new = kcs_ui.string_req("Change with: ")
if note_new[0] != kcs_util.ok():
exit()
note_text_new = string.replace(note_new[1],"*","") # remove the wildcards since
string.find() function doesn't need it
region=KcsCaptureRegion2D.CaptureRegion2D()
region.SetInside()
if answer2 == kcs_util.cancel():
exit()
region.SetNoCut()
try:
# Identify all existing texts in the region
handle_Text = kcs_draft.text_capture(region)
except:
kcs_ui.message_noconfirm("No texts found!")
exit()
else:
59
Proiectarea asistată de calculator a echipamentelor UIP
# for each found texts in the region do loop:
for handle in handle_Text[1:]:
kcs_draft.text_properties_get(handle,text)
if string.find(text.GetString(),note_text ) >= 0:# if found continue
# if the text to be replaced is at the beginning
if string.find(text.GetString(),note_text ) == 0:
new_note_text = note_text_new + text.GetString()[len(note_text):]
# if the text to be replaced is at the end
if string.find(text.GetString(),note_text ) == len(text.GetString()) -
len(note_text):
new_note_text =
text.GetString()[:int(string.find(text.GetString(),note_text ))] + note_text_new
# if the text to be replaced is at the middle
if (string.find(text.GetString(),note_text ) > 0) and
(string.find(text.GetString(),note_text ) < len(text.GetString()) - len(note_text)):
new_note_text =
text.GetString()[:int(string.find(text.GetString(),note_text ))] + note_text_new +
text.GetString()[int(string.find(text.GetString(),note_text ))+len(note_text):]
if confirm == "no": #if no confirmation is set at the beginning
# delete the old text and set the properties of the new one
kcs_draft.element_delete(handle)
new_note_text1 = KcsText.Text()
#new_note_text1.SetFontId(text.GetFontId())
new_note_text1.SetLayer(text.GetLayer())
new_note_text1.SetHeight(text.GetHeight())
new_note_text1.SetRotation(text.GetRotation())
new_note_text1.SetPosition(text.GetPosition())
new_note_text1.SetColour(text.GetColour())
new_note_text1.SetString(new_note_text)
kcs_draft.text_new(new_note_text1)
else: # if confirmation is needed
rectangle = kcs_draft.element_extent_get(handle)
rectangle.Corner1.X = rectangle.Corner1.X - 20
rectangle.Corner1.Y = rectangle.Corner1.Y - 20
rectangle.Corner2.X = rectangle.Corner2.X + 20
rectangle.Corner2.Y = rectangle.Corner2.Y + 20
kcs_draft.dwg_zoom(rectangle) # zoom to the found text
answer = kcs_ui.answer_req("Replace?","Replace text?")
if answer == kcs_util.yes():
# delete the old text and set the properties of the new one
kcs_draft.element_delete(handle)
new_note_text1 = KcsText.Text()
#new_note_text1.SetFontId(text.GetFontId())
new_note_text1.SetLayer(text.GetLayer())
new_note_text1.SetHeight(text.GetHeight())
new_note_text1.SetRotation(text.GetRotation())
new_note_text1.SetPosition(text.GetPosition())
new_note_text1.SetColour(text.GetColour())
new_note_text1.SetString(new_note_text)
kcs_draft.text_new(new_note_text1)
if answer == kcs_util.cancel():
60
Lucrarea nr. 4
break
if index == 1 : question = "Continue searching without confirmation?"
if index == 2 : question = "Continue searching with confirmation??"
answer = kcs_ui.answer_req("Continue?",question)
if (answer == kcs_util.no()) or (answer == kcs_util.cancel()):
break
except:
pass
def run(*args):
fd_change_text()
7. Se lansează din nou aplicaţia Drafting (START > All Programs >
Tribon M3 > Drafting) şi se inspectează bara de instrumente, aflată sub bara
de meniuri (fig. 4.19);
61
Proiectarea asistată de calculator a echipamentelor UIP
barele de instrumente utilizator se adaugă automat barei principale
de meniuri, în meniul View, sub denumirea User Toobars, aşa cum se observă
în fig. 4.20.
Rezolvare:
Tabel 4.9. Program pentru plasarea unui text în desenul curent [3]
import kcs_draft
import kcs_ui
import kcs_util
import KcsPoint2D
import CommonSample
try:
kcs_ui.message_confirm('This script will create a text.')
62
Lucrarea nr. 4
text = ''
linenr = 1
while 1:
resp, line = kcs_ui.string_req('Enter text line %d, OC to complete:' % linenr, '')
if len(text) == 0:
text = line
else:
text = text + '\n' + line
if kcs_ui.answer_req('Text entering', 'Next line?') != kcs_util.yes():
break
elif resp == kcs_util.cancel():
text = ''
break
linenr = linenr + 1
point = KcsPoint2D.Point2D()
if len(text) > 0:
try:
resp, point = kcs_ui.point2D_req('Select insertion point', point)
if resp == kcs_util.ok():
try:
kcs_draft.text_new(text, point)
except:
CommonSample.ReportTribonError(kcs_draft)
except:
CommonSample.ReportTribonError(kcs_ui)
else:
kcs_ui.message_noconfirm('Text not defined!')
except:
pass
Bibliografie selectivă
[1] ***, Training Guide Tribon M3. Hull Drafting, Tribon Solutions Ltd., 2004
[2] ***, http://www.flowdesign.info/setting_custom_toolbars.php, FlowDesign Marine Soluti-
ons Ltd., (data accesării: 23.03.2016)
[3] ***, Tribon M3. Vitesse Examples, Tribon Solutions, 2004
64