Version 5 (modified by 5 years ago) (diff) | ,
---|
SALOME SHAPER
SALOME je odprtokodno okolje, ki vsebuje več integriranih modulov, ter je namenjeno reševanju kompleksnih numeričnih problemov ter izvajanju simulacij. Ti numerični problemi bazirajo na začetnem CAD modelu. SALOME vsebuje tudi orodja, ki omogočajo delo s CAD modeli oz. z značilkami CAD modelov ter tako spremembo CAD modelov (poenostavitev) in pridobitev različnih podatkov iz CAD modelov.
V nadaljevanju so
Povezave:
- Predstavitev SHAPER modula
- SHAPER dokumentacija
- SHAPER dokumentacija (code source)
- SHAPER primeri na Youtube
- SHAPER interaktivni tutorial
Predstavitev SHAPER modula na primerih
Primer: Postopek izdelave primitivov
V SALOME Python konzolo vnesemo naslednje ukaze:
# Uvozimo potrebne knjižnice from salome.shaper import model # Inicializiramo model model.begin() mypartset = model.moduleDocument() # Kreiramo part Part = model.addPart(partSet) Part_doc = Part.document() # Dodamo kocko Box = model.addBox(Part_doc, 10, 10, 10) # Prikaži model model.do()
Primeri sintakse "Add" ukazov za izdelavo drugih primitivov, ki se jih lahko najde tudi na tej povezavi.
V SALOME Python shell vnesemo naslednje ukaze:
# Točka Point = model.addPoint(Part_doc, 10, 10, -10) # Kocka oz. kvader model.addBox(Part_doc, 10, 10, 10) # Stožec model.addCone(Part_doc, 20, 10, 10) # Valj model.addCylinder(Part_doc, 10, 10) # Krogla model.addSphere(Part_doc, 10) # Torus model.addTorus(Part_doc, 20, 10)
Primer: Postopek preprostega izvleka v prostor (Extrude)
V SALOME Python konzolo vnesemo naslednje ukaze:
Primer: Postopek preprostega izvleka v prostor (Extrude) z uporabo linij
# Uvozimo knjižnice from salome.shaper import model from salome.shaper import geom # Inicializiramo model model.begin() mypartset = model.moduleDocument() # Dodamo novi part mypart = model.addPart(mypartset).document() # Naredimo objekt - skico za našo osnovo kvadra mybase = model.addSketch(mypart, model.defaultPlane("XOY")) # Določimo točke p1 = geom.Pnt2d(0, 0) p2 = geom.Pnt2d(0, 25) p3 = geom.Pnt2d(25, 25) p4 = geom.Pnt2d(25, 0) # Iz točk tvorimo sestavljeno linijo - poligon line = model.addPolygon(mybase, p1, p2, p3, p4) # Line je seznam oz. niz štirih linij # Izpis točk, ki sestavljajo vsako izmed linij for i in range(len(line)): l = line[i] print("Linija #" + str(i) + ":") print("Začetna točka: X:", str(l.startPoint().x()), ", Y: ", str(l.startPoint().y())) print("Končna točka: X:", str(l.endPoint().x()), ", Y: ", str(l.endPoint().y())) # Prikaži dopolnjen model model.do() # Izdelava izvleka mybox = model.addExtrusion(mypart, mybase.selectFace(), 50) # Prikaži dopolnjen model model.do()
V SALOME Python konzolo vnesemo naslednje ukaze:
# Uvozimo potrebne knjižnice from salome.shaper import model # Inicializiramo model model.begin() mypartset = model.moduleDocument() # Dodamo novi part mypart = model.addPart(mypartset).document() # Naredimo skico, ki predstavlja osnovo za naš izvlek v prostor sketch_base = model.addSketch(mypart, model.defaultPlane("XOY")) # - Določimo štiri linije l1 = sketch_base.addLine(0, 0, 0, 50) # Linijo, ki leži v trenutni ravnini, se definira z dvema točkama na način (x1,y1, x2, y2) l2 = sketch_base.addLine(0, 50, 50, 50) l3 = sketch_base.addLine(50, 50, 50, 0) l4 = sketch_base.addLine(50, 0, 0, 0) # Prikaži dopolnjen model model.do() # Izvlek v prostor mybox = model.addExtrusion(mypart, sketch_base.selectFace(), 50) # Prikaži dopolnjen model model.do.()
Primer: Postopek izvleka v prostor z uporabo relacij med linijami
Ta primer je podoben prejšnjem z razliko da se bo uporabilo relacije med elementi (sovpadanje točk, vzporednost ipd.).
V SALOME Python konzolo vnesemo naslednje ukaze:
# Uvozimo potrebne knjižnice from salome.shaper import model # Inicializiramo model model.begin() mypartset = model.moduleDocument() # Dodamo novi part mypart = model.addPart(mypartset).document() # Naredimo skico, ki predstavlja osnovo za naš izvlek v prostor # V tem primeru bomo naredili "neustrezno" skico, v kateri nam linije ne bodo sovpadale. To se bo kasneje uredilo z relacijami sketch_base = model.addSketch(mypart, model.defaultPlane("XOY")) # - Določimo štiri linije v ravnini l1 = sketch_base.addLine(0, 0, 0, 50) l2 = sketch_base.addLine(0, 123, 50, 50) # neustrezna linija l3 = sketch_base.addLine(50, 50, 50, 0) l4 = sketch_base.addLine(50, 0, 123, 123) # neustrezna linija model.do() # Določevanje relacij med linijami v skici: # - fiksna pozicija točk linij. Linija l1 in l3 so v redu zato jih določimo kot fiksne sketch_base.setFixed(l1.startPoint()) sketch_base.setFixed(l1.endPoint()) sketch_base.setFixed(l3.startPoint()) sketch_base.setFixed(l3.endPoint()) # - stikanje koncev linij sketch_base.setCoincident(l1.endPoint(), l2.startPoint()) sketch_base.setCoincident(l2.endPoint(), l3.startPoint()) sketch_base.setCoincident(l3.endPoint(), l4.startPoint()) sketch_base.setCoincident(l4.endPoint(), l1.startPoint()) # Prikaži dopolnjen model model.do() # Izvlek v prostor mybox = model.addExtrusion(mypart, sketch_base.selectFace(), 50) # Prikaži dopolnjen model model.do()
Namesto sikanja koncev točk linij se lahko ureja druge relacije ter lastnosti. Pri tem je treba paziti, da se skico ne predefinira!
Spodaj je prikaz, kako se lahko določi druge relacije.
# - vzporednost sketch_base.setParallel(l1, l3) sketch_base.setParallel(l2, l4) # - pravokotnost sketch_base.setPerpendicular(l1, l4) - vertikalnost sketch_base.setVertical(l1) # - fiksna pozicija točk linij sketch_base.setFixed(l1.startPoint()) # Določitev širine linije mywidth = sketch_base.setLength(l1, 50) # Določitev dolžine skice mylength = sketch_base.setDistance(l1.startPoint(), l3.endPoint(), 50)
Primer: Polyline
# Uvoz potrebnih knjižnice from salome.shaper import model # Kreiranje modela model.begin() partSet = model.moduleDocument() # Kreiranje parta Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() # Definiranje tock Point_1 = model.addPoint(Part_1_doc, 10, 10, -10) Point_2 = model.addPoint(Part_1_doc, 70, 70, 50) Point_3 = model.addPoint(Part_1_doc, 100, 120, 100) # Definiranje linije, sestavljene iz treh točk Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")], False) # Prikaži dopolnjen model model.do()
Attachments (25)
-
test.step (19.3 KB) - added by 5 years ago.
Test STEP file used in the examples.
-
shaper_example_addBox_PythonShell.png (30.7 KB) - added by 5 years ago.
SHAPER addBox example: code entry in python shell.
-
shaper_example_addBox_result.png (5.5 KB) - added by 5 years ago.
SHAPER addBox result.
-
shaper_example_addBox_objectBrowser.png (15.1 KB) - added by 5 years ago.
SHAPER addBox example object browser at finish.
-
SALOME_SHAPER_empty_case.png (84.5 KB) - added by 5 years ago.
Updated again.
-
SHAPER_primitives_addPoint.png (5.6 KB) - added by 5 years ago.
Primitives: addPoint.
-
SHAPER_primitives_addBox.png (8.1 KB) - added by 5 years ago.
Primitives: addBox.
-
SHAPER_primitives_addCone.png (43.0 KB) - added by 5 years ago.
Primitives: addCone.
-
SHAPER_primitives_addTorus.png (62.7 KB) - added by 5 years ago.
Primitives: addTorus
-
SHAPER_primitives_addSphere.png (50.0 KB) - added by 5 years ago.
Primitives: addSphere.
-
SHAPER_primitives_addCylinder.png (10.2 KB) - added by 5 years ago.
Primitives: addCylinder.
-
SHAPER_example_extrude_1.png (7.5 KB) - added by 5 years ago.
SHAPER: extrude example1.
-
SHAPER_example_extrude_2.png (6.1 KB) - added by 5 years ago.
SHAPER: extrude example 2.
-
SHAPER_example_box_50x50.png (7.8 KB) - added by 5 years ago.
Better image.
-
SHAPER_example_3D_polyline.png (9.2 KB) - added by 5 years ago.
SHAPER: 3D polyline.
- SHAPER_UI_mouse_interaction_style_button.png (733 bytes) - added by 5 years ago.
- SHAPER_UI_fit_all_button.png (801 bytes) - added by 5 years ago.
- SHAPER_UI_3D_view_operations_buttons.png (800 bytes) - added by 5 years ago.
- SHAPER_UI_reset_view_button.png (1.0 KB) - added by 5 years ago.
-
SHAPER_example_cut.png (35.7 KB) - added by 5 years ago.
Result of example describing boolean cut method with Shaper module.
-
SHAPER_example_common.png (31.7 KB) - added by 5 years ago.
Image for SHAPER addCommon example.
-
SHAPER_example_fuse.png (24.2 KB) - added by 5 years ago.
Image for addFuse example.
-
SHAPER_example_makeFillet.png (58.5 KB) - added by 5 years ago.
Image showing the result of makeFillet.py example.
-
SHAPER_example_makeFillet_Z_aligned_edges.png (9.4 KB) - added by 5 years ago.
Image showing the result of makeFillet_Z_aligned_edges.py example.
-
SHAPER_STEP_import_with_QFileDialog.png (83.1 KB) - added by 5 years ago.
Image for SHAPER PyQt5 QFileDialog example for importing STEP file.
Download all attachments as: .zip