H5.4. Giao diện chương trình thiết kế tự động

Một phần của tài liệu Đồ án tính toán thiết kế và mô phỏng tham số máy băm sắn bằng CATIA (Trang 68)

thông số đầu ra, tiếp tục sử dụng các nút lệnh “Bản vẽ lắp” mô hình máy băm sẽ hiện ra với kích thước yêu cầu. Tiếp theo ta có thể sử dụng các tiện ích khác của CATIA như: mô phỏng máy, xuất bản vẽ 2D...

Kết luận

KẾT LUẬN

Với việc áp dụng ngôn ngữ lập trình VBA trong CATIA về cơ bản đã giải quyết được bài toán tính toán thiết kế và mô phỏng máy băm sắn.

Trong đó phần quan trọng là thiết kế máy băm sắn có kích thước theo kiểu tham số đã được giải quyết. Với tất cả các chi tiết từ đơn giản đến phức tạp của máy băm ta đều có thể thiết kế theo kiểu tham số nhờ áp dụng VBA trong CATIA.

Phần bài toán lắp ghép các chi tiết để được sản phẩm hoàn thiện ta cũng hoàn toàn làm được bằng VBA trong CATIA.

Do không có điều kiện làm thí nghiệm, dẫn đến thiếu thốn các công thức thực nghiệm, vì thế module tính toán quan hệ các tham số đầu vào và đầu ra vẫn chưa hoàn thiện. Bên cạnh đó các đối tượng trong môi trường mô phỏng của CATIA chưa được rộng rãi nên bài toán mô phỏng ở đây còn hạn chế. Vì thế quá trình mô phỏng máy băm vẫn chưa thể giải quyết triệt để. Ngoài ra trong đồ án này, tác giả chỉ tiến hành truyền tham số vào các chi tiết một số tham số cơ bản, trong trường hợp tổng quát, tất cả các kích thước của máy đều phải được tham số hóa theo cách làm tương tự.

Hướng phát triển:

CATIA là một phần mềm mạnh trong CAD, CAM, CAE và bản thân nó chứa nhiều module được sử dụng và có thế mạnh trong rất nhiều lĩnh vực như: cơ khí gia công, mô phổng cơ học, mô phỏng robot, tính toán sức bền vật liệu... Việc khai thác các module của nó sẽ đem lại rất nhiều lợi ích thiết thực trong quá trình sản xuất.

Ngôn ngữ VBA trong CATIA cho phép người dùng lập trình để xây dựng các ứng dụng mang tính chất tự động hóa và chuyên môn hóa cao. Người sử dụng có thể dùng VBA trong CATIA để xây dựng thêm các module riêng biệt phục vụ cho công việc sản xuất. Ngoài ngôn ngữ VBA, trong CATIA còn tích hợp một số ngôn ngữ khác như C++, VB, VBScript, CATScript... ta có mở rộng thêm rất nhiều các tính năng của CATIA. Tóm lại CATIA là một phần mềm có tính mở, người sử dụng thông qua các ngôn ngữ lập trình được tích hợp sẵn trong CATIA can thiệp vào các đối tượng CATIA để giải quyết các bài toán đặt ra như:

Kết luận

• Xây dựng chương trình tính sức bền vật liệu của chi tiết.

• Xây dựng chương trình gia công chi tiết.

• Xây dựng chương trình mô phỏng robot.

Với ý tưởng phát triển đề tài như trên, tác giả rất mong muốn những bạn đọc quan tâm và các đồng nghiệp sẽ tiếp tục phát triển để sản phẩm được hoàn thiện và có hiệu quả cao trong thực tế.

Phụ lục A

PHỤ LỤC A: CÁC MODULE TRUYỀN THAM SỐ VÀO CÁC KHÂU

(Chú ý: Dòng in đậm là chỗ truyền tham số, câu lệnh sau dấu ‘ là chú thích lệnh)

1. Truyền tham số vào chi tiết vỏ máy băm:

Sub Vevomay(rong, cao, dai)

‘khai báo module Vẽ vỏ máy Dim documents1 As Documents Set documents1 = CATIA.Documents Dim partDocument1 As PartDocument

Set partDocument1 = documents1.Open("E:\Do Van Hieu\Vo may.CATPart") ‘Mở bản vẽ đã có từ trước

Dim part1 As Part

Set part1 = partDocument1.Part Dim bodies1 As Bodies

Set bodies1 = part1.Bodies Dim body1 As Body

Set body1 = bodies1.Item("PartBody") Dim shapes1 As Shapes

Set shapes1 = body1.Shapes Dim pad1 As Pad

Set pad1 = shapes1.Item("Pad.1")

Dim sketch1 As Sketch Set sketch1 = pad1.Sketch part1.InWorkObject = sketch1 Dim factory2D1 As Factory2D

Set factory2D1 = sketch1.OpenEdition() ‘Truy nhập vào Sketch1 để chỉnh sửa

Phụ lục A (adsbygoogle = window.adsbygoogle || []).push({});

Set geometricElements1 = sketch1.GeometricElements Dim point2D1 As Point2D

Set point2D1 = geometricElements1.Item("Point.1") point2D1.SetData 800#, 500#

Dim point2D2 As Point2D

Set point2D2 = geometricElements1.Item("Point.2") point2D2.SetData 800#, -500#

Dim line2D1 As Line2D

Set line2D1 = geometricElements1.Item("Line.1") line2D1.SetData 800#, 46.937195, 0#, -1#

Dim point2D3 As Point2D

Set point2D3 = geometricElements1.Item("Point.3") point2D3.SetData -800#, -500#

Dim line2D2 As Line2D

Set line2D2 = geometricElements1.Item("Line.2") line2D2.SetData -636.328934, -500#, -1#, 0# Dim point2D4 As Point2D

Set point2D4 = geometricElements1.Item("Point.4") point2D4.SetData -800#, 500#

Dim line2D3 As Line2D

Set line2D3 = geometricElements1.Item("Line.3") line2D3.SetData -800#, -500#, 0#, 1#

Dim line2D4 As Line2D

Set line2D4 = geometricElements1.Item("Line.4") line2D4.SetData -81.835533, 500#, 1#, 0#

Phụ lục A

Set constraints1 = sketch1.Constraints Dim constraint1 As Constraint

Set constraint1 = constraints1.Item("Length.7") Dim length1 As Length

Set length1 = constraint1.Dimension

length1.Value = rong

‘Truyền tham số chiều rộng vỏ ở đây Dim constraint2 As Constraint

Set constraint2 = constraints1.Item("Length.8") Dim length2 As Length

Set length2 = constraint2.Dimension

length2.Value = cao

‘Truyền tham số chiều cao vỏ ở đây sketch1.CloseEdition

Dim mirror1 As Mirror

Set mirror1 = shapes1.Item("Mirror.3") part1.InWorkObject = mirror1

part1.UpdateObject sketch1 Dim limit1 As Limit

Set limit1 = pad1.FirstLimit Dim length3 As Length

Set length3 = limit1.Dimension (adsbygoogle = window.adsbygoogle || []).push({});

length3.Value = dai

‘Truyền tham số chiều dài vỏ ở đây part1.UpdateObject pad1

part1.UpdateObject pad1 part1.Update

Phụ lục A

Dim pad2 As Pad

Set pad2 = shapes1.Item("Pad.5") Dim sketch2 As Sketch

Set sketch2 = pad2.Sketch Dim constraints2 As Constraints Set constraints2 = sketch2.Constraints Dim constraint3 As Constraint

Set constraint3 = constraints2.Item("Offset.27") Dim length4 As Length

Set length4 = constraint3.Dimension length4.Value = 145#

Dim constraint4 As Constraint

Set constraint4 = constraints2.Item("Length.28") Dim length5 As Length

Set length5 = constraint4.Dimension length5.Value = 20#

Dim pocket1 As Pocket

Set pocket1 = shapes1.Item("Pocket.1") Dim sketch3 As Sketch

Set sketch3 = pocket1.Sketch part1.InWorkObject = sketch3 Dim factory2D2 As Factory2D

Set factory2D2 = sketch3.OpenEdition()

Dim geometricElements2 As GeometricElements Set geometricElements2 = sketch3.GeometricElements Dim point2D5 As Point2D

Phụ lục A

point2D5.SetData 300#, 0# Dim circle2D1 As Circle2D

Set circle2D1 = geometricElements2.Item("Circle.1") circle2D1.SetData 300#, 0#, 100#

Dim constraints3 As Constraints Set constraints3 = sketch3.Constraints Dim constraint5 As Constraint

Set constraint5 = constraints3.Item("Radius.10") Dim length6 As Length

Set length6 = constraint5.Dimension length6.Value = 100#

Dim point2D6 As Point2D

Set point2D6 = geometricElements2.Item("Point.2") point2D6.SetData -300#, 0#

Dim circle2D2 As Circle2D

Set circle2D2 = geometricElements2.Item("Circle.2") circle2D2.SetData -300#, 0#, 100#

Dim constraint6 As Constraint

Set constraint6 = constraints3.Item("Offset.12") Dim length7 As Length

Set length7 = constraint6.Dimension length7.Value = rong - 1000 (adsbygoogle = window.adsbygoogle || []).push({});

sketch3.CloseEdition

part1.InWorkObject = mirror1 part1.UpdateObject sketch3 part1.Update

Phụ lục A

Dim limit2 As Limit

Set limit2 = pocket1.FirstLimit Dim length8 As Length

Set length8 = limit2.Dimension length8.Value = dai * 3

part1.UpdateObject pocket1 part1.UpdateObject pocket1 part1.Update

part1.InWorkObject = sketch2 Dim factory2D3 As Factory2D

Set factory2D3 = sketch2.OpenEdition() sketch2.CloseEdition

part1.InWorkObject = mirror1 part1.UpdateObject sketch2

Set partDocument1 = CATIA.ActiveDocument

partDocument1.SaveAs "E:\Do Van Hieu\Vo may.CATPart"

End Sub

2. Truyền tham số vào chi tiết đế máy:

Sub Vedemay(rong, cao, dai)

‘Dòng khai báo Module với 3 tham số: rộng, cao và dài Dim documents1 As Documents

Set documents1 = CATIA.Documents Dim partDocument1 As PartDocument

Phụ lục A

‘Mở bản vẽ đã có sẵn Dim part1 As Part

Set part1 = partDocument1.Part Dim bodies1 As Bodies

Set bodies1 = part1.Bodies Dim body1 As Body

Set body1 = bodies1.Item("PartBody") Dim shapes1 As Shapes

Set shapes1 = body1.Shapes Dim pad1 As Pad

Set pad1 = shapes1.Item("Pad.1") Dim sketch1 As Sketch

Set sketch1 = pad1.Sketch part1.InWorkObject = sketch1 Dim factory2D1 As Factory2D

Set factory2D1 = sketch1.OpenEdition()

Dim geometricElements1 As GeometricElements Set geometricElements1 = sketch1.GeometricElements Dim point2D1 As Point2D

Set point2D1 = geometricElements1.Item("Point.1") point2D1.SetData 1450#, 850#

Dim point2D2 As Point2D

Set point2D2 = geometricElements1.Item("Point.2") point2D2.SetData 1450#, -850 (adsbygoogle = window.adsbygoogle || []).push({});

Dim line2D1 As Line2D

Set line2D1 = geometricElements1.Item("Line.1") line2D1.SetData 1450#, 65.23999, 0#, -1#

Dim point2D3 As Point2D

Phụ lục A

point2D3.SetData -1450#, -850# Dim line2D2 As Line2D

Set line2D2 = geometricElements1.Item("Line.2") line2D2.SetData -1253.672134, -850#, -1#, 0# Dim point2D4 As Point2D

Set point2D4 = geometricElements1.Item("Point.4") point2D4.SetData -1450#, 850#

Dim line2D3 As Line2D

Set line2D3 = geometricElements1.Item("Line.3") line2D3.SetData -1450#, -850#, 0#, 1#

Dim line2D4 As Line2D

Set line2D4 = geometricElements1.Item("Line.4") line2D4.SetData -98.163933, 850#, 1#, 0#

Dim constraints1 As Constraints Set constraints1 = sketch1.Constraints Dim constraint1 As Constraint

Set constraint1 = constraints1.Item("Length.7") Dim length1 As Length

Set length1 = constraint1.Dimension

length1.Value = dai * 2 + 100

‘Chiều dài đế máy, tính tương ứng theo chiều dài vỏ máy

Dim constraint2 As Constraint

Set constraint2 = constraints1.Item("Length.8") Dim length2 As Length

Set length2 = constraint2.Dimension

length2.Value = rong + 100

Phụ lục A

sketch1.CloseEdition Dim pad2 As Pad

Set pad2 = shapes1.Item("Pad.6") part1.InWorkObject = pad2 part1.UpdateObject sketch1 Dim pad3 As Pad

Set pad3 = shapes1.Item("Pad.4") Dim limit1 As Limit

Set limit1 = pad3.FirstLimit Dim length3 As Length

Set length3 = limit1.Dimension

length3.Value = cao

‘Chiều cao đế máy part1.UpdateObject pad3 part1.Update

Dim sketch2 As Sketch Set sketch2 = pad2.Sketch Dim constraints2 As Constraints Set constraints2 = sketch2.Constraints Dim constraint3 As Constraint

Set constraint3 = constraints2.Item("Length.55") Dim length4 As Length (adsbygoogle = window.adsbygoogle || []).push({});

Set length4 = constraint3.Dimension length4.Value = 450#

Dim constraint4 As Constraint

Set constraint4 = constraints2.Item("Length.56") Dim length5 As Length

Phụ lục A

Set length5 = constraint4.Dimension length5.Value = 50#

Set partDocument1 = CATIA.ActiveDocument

partDocument1.SaveAs "E:\Do Van Hieu\De may.CATPart"

End Sub

3. Truyền tham số vào chi tiết phễu cấp:

Sub Vepheucap(dai, rong, cao)

‘Dòng khai báo module với 3 tham số: dài, rộng và cao

Dim documents1 As Documents Set documents1 = CATIA.Documents

Dim partDocument1 As PartDocument

Set partDocument1 = documents1.Open("E:\Do Van Hieu\Pheu cap.CATPart")

Dim part1 As Part

Set part1 = partDocument1.Part Dim bodies1 As Bodies

Set bodies1 = part1.Bodies

Dim body1 As Body

Set body1 = bodies1.Item("PartBody")

Dim shapes1 As Shapes Set shapes1 = body1.Shapes

Phụ lục A

Dim pad1 As Pad

Set pad1 = shapes1.Item("Pad.1")

Dim sketch1 As Sketch Set sketch1 = pad1.Sketch part1.InWorkObject = sketch1

Dim factory2D1 As Factory2D

Set factory2D1 = sketch1.OpenEdition()

Dim geometricElements1 As GeometricElements Set geometricElements1 = sketch1.GeometricElements

Dim point2D1 As Point2D

Set point2D1 = geometricElements1.Item("Point.1")

point2D1.SetData 900#, 400# (adsbygoogle = window.adsbygoogle || []).push({});

Dim point2D2 As Point2D

Set point2D2 = geometricElements1.Item("Point.2") point2D2.SetData 900#, -400#

Dim line2D1 As Line2D

Set line2D1 = geometricElements1.Item("Line.1")

line2D1.SetData 900#, 56.124901, 0#, -1#

Dim point2D3 As Point2D

Phụ lục A

point2D3.SetData -900#, -400#

Dim line2D2 As Line2D

Set line2D2 = geometricElements1.Item("Line.2")

line2D2.SetData -729.926147, -400#, -1#, 0#

Dim point2D4 As Point2D

Set point2D4 = geometricElements1.Item("Point.4")

point2D4.SetData -900#, 400#

Dim line2D3 As Line2D

Set line2D3 = geometricElements1.Item("Line.3")

line2D3.SetData -900#, -400#, 0#, 1#

Dim line2D4 As Line2D

Set line2D4 = geometricElements1.Item("Line.4") line2D4.SetData -85.036926, 400#, 1#, 0#

Dim constraints1 As Constraints Set constraints1 = sketch1.Constraints

Dim constraint1 As Constraint

Set constraint1 = constraints1.Item("Length.7")

Phụ lục A

Set length1 = constraint1.Dimension

length1.Value = dai + 400

Dim constraint2 As Constraint

Set constraint2 = constraints1.Item("Length.8")

Dim length2 As Length

Set length2 = constraint2.Dimension

length2.Value = rong / 2 (adsbygoogle = window.adsbygoogle || []).push({});

sketch1.CloseEdition

Dim pad2 As Pad

Set pad2 = shapes1.Item("Pad.6")

part1.InWorkObject = pad2

part1.UpdateObject sketch1 Dim limit1 As Limit

Set limit1 = pad1.FirstLimit

Dim length3 As Length

Set length3 = limit1.Dimension

length3.Value = cao / 2 - 50

Phụ lục A

part1.Update

Dim pad3 As Pad

Set pad3 = shapes1.Item("Pad.3")

Dim sketch2 As Sketch Set sketch2 = pad3.Sketch

part1.InWorkObject = sketch2

Dim factory2D2 As Factory2D

Set factory2D2 = sketch2.OpenEdition()

Dim geometricElements2 As GeometricElements Set geometricElements2 = sketch2.GeometricElements

Dim point2D5 As Point2D

Set point2D5 = geometricElements2.Item("Point.1")

point2D5.SetData 900#, 400#

Dim point2D6 As Point2D

Set point2D6 = geometricElements2.Item("Point.2")

point2D6.SetData 900#, -400#

Dim line2D5 As Line2D

Phụ lục A

line2D5.SetData 900#, 572.861633, 0#, -1#

Dim point2D7 As Point2D

Set point2D7 = geometricElements2.Item("Point.3")

point2D7.SetData -900#, -400# (adsbygoogle = window.adsbygoogle || []).push({});

Dim line2D6 As Line2D

Set line2D6 = geometricElements2.Item("Line.2")

line2D6.SetData 1716.160156, -400#, -1#, 0#

Dim point2D8 As Point2D

Set point2D8 = geometricElements2.Item("Point.4")

point2D8.SetData -900#, 400#

Dim line2D7 As Line2D

Set line2D7 = geometricElements2.Item("Line.3") line2D7.SetData -900#, -400#, 0#, 1#

Dim line2D8 As Line2D

Set line2D8 = geometricElements2.Item("Line.4")

line2D8.SetData -1308.080078, 400#, 1#, 0#

Dim constraints2 As Constraints Set constraints2 = sketch2.Constraints

Phụ lục A

Dim constraint3 As Constraint

Set constraint3 = constraints2.Item("Length.23")

Dim length4 As Length

Set length4 = constraint3.Dimension

length4.Value = dai + 400

Dim constraint4 As Constraint

Set constraint4 = constraints2.Item("Length.24")

Dim length5 As Length

Set length5 = constraint4.Dimension

length5.Value = rong / 2

sketch2.CloseEdition

part1.InWorkObject = pad2 part1.UpdateObject sketch2

Dim limit2 As Limit

Set limit2 = pad3.FirstLimit

Dim length6 As Length

Set length6 = limit2.Dimension

Phụ lục A (adsbygoogle = window.adsbygoogle || []).push({});

part1.UpdateObject pad3

part1.Update

Dim sketch3 As Sketch Set sketch3 = pad2.Sketch

part1.InWorkObject = sketch3

Dim factory2D3 As Factory2D

Set factory2D3 = sketch3.OpenEdition()

Dim geometricElements3 As GeometricElements Set geometricElements3 = sketch3.GeometricElements

Dim point2D9 As Point2D

Set point2D9 = geometricElements3.Item("Point.1")

point2D9.SetData 1450#, 850# Dim point2D10 As Point2D

Set point2D10 = geometricElements3.Item("Point.2")

point2D10.SetData 1450#, -850#

Dim line2D9 As Line2D

Set line2D9 = geometricElements3.Item("Line.1")

Phụ lục A

Dim point2D11 As Point2D

Set point2D11 = geometricElements3.Item("Point.3")

point2D11.SetData -1450#, -850#

Dim line2D10 As Line2D

Set line2D10 = geometricElements3.Item("Line.2")

line2D10.SetData 1869.412109, -850#, -1#, 0#

Dim point2D12 As Point2D

Set point2D12 = geometricElements3.Item("Point.4")

point2D12.SetData -1450#, 850#

Dim line2D11 As Line2D

Set line2D11 = geometricElements3.Item("Line.3")

line2D11.SetData -1450#, -850#, 0#, 1#

Dim line2D12 As Line2D

Set line2D12 = geometricElements3.Item("Line.4")

line2D12.SetData -1659.706055, 850#, 1#, 0# (adsbygoogle = window.adsbygoogle || []).push({});

Dim constraints3 As Constraints Set constraints3 = sketch3.Constraints

Phụ lục A

Dim constraint5 As Constraint

Set constraint5 = constraints3.Item("Length.63")

Dim length7 As Length

Set length7 = constraint5.Dimension

length7.Value = dai * 2 + 100

Dim constraint6 As Constraint

Set constraint6 = constraints3.Item("Length.64")

Dim length8 As Length

Set length8 = constraint6.Dimension

length8.Value = rong + 100

Dim point2D13 As Point2D

Set point2D13 = geometricElements3.Item("Point.5")

point2D13.SetData 880#, 380# Dim point2D14 As Point2D

Set point2D14 = geometricElements3.Item("Point.6")

point2D14.SetData 880#, -380#

Dim line2D13 As Line2D

Set line2D13 = geometricElements3.Item("Line.5")

Phụ lục A

Dim point2D15 As Point2D

Set point2D15 = geometricElements3.Item("Point.7")

point2D15.SetData -880#, -380#

Dim line2D14 As Line2D

Set line2D14 = geometricElements3.Item("Line.6")

line2D14.SetData 986.794434, -380#, -1#, 0#

Dim point2D16 As Point2D

Set point2D16 = geometricElements3.Item("Point.8")

point2D16.SetData -880#, 380#

Dim line2D15 As Line2D (adsbygoogle = window.adsbygoogle || []).push({});

Set line2D15 = geometricElements3.Item("Line.7")

line2D15.SetData -880#, -380#, 0#, 1# Dim line2D16 As Line2D

Set line2D16 = geometricElements3.Item("Line.8")

line2D16.SetData -933.397217, 380#, 1#, 0#

Dim constraint7 As Constraint

Set constraint7 = constraints3.Item("Length.71")

Phụ lục A

Set length9 = constraint7.Dimension

length9.Value = dai + 360

Dim constraint8 As Constraint

Set constraint8 = constraints3.Item("Length.72")

Dim length10 As Length

Set length10 = constraint8.Dimension

length10.Value = rong / 2 - 40

sketch3.CloseEdition

part1.InWorkObject = pad2

part1.UpdateObject sketch3

part1.Update

Set partDocument1 = CATIA.ActiveDocument

partDocument1.SaveAs "E:\Do Van Hieu\Pheu cap.CATPart"

End Sub

4. Truyền tham số vào chi tiết trục 1:

Sub Vetruc1(dai)

Phụ lục A

Set documents1 = CATIA.Documents Dim partDocument1 As PartDocument

Set partDocument1 = documents1.Open("E:\Do Van Hieu\Truc 1.CATPart") Dim part1 As Part

Set part1 = partDocument1.Part Dim bodies1 As Bodies

Set bodies1 = part1.Bodies Dim body1 As Body

Set body1 = bodies1.Item("PartBody") Dim shapes1 As Shapes

Set shapes1 = body1.Shapes Dim pad1 As Pad (adsbygoogle = window.adsbygoogle || []).push({});

Set pad1 = shapes1.Item("Pad.1") Dim sketch1 As Sketch

Set sketch1 = pad1.Sketch part1.InWorkObject = sketch1 Dim factory2D1 As Factory2D

Set factory2D1 = sketch1.OpenEdition()

Dim geometricElements1 As GeometricElements Set geometricElements1 = sketch1.GeometricElements Dim circle2D1 As Circle2D

Set circle2D1 = geometricElements1.Item("Circle.1") circle2D1.SetData 0#, 0#, 150#

Dim constraints1 As Constraints Set constraints1 = sketch1.Constraints Dim constraint1 As Constraint

Set constraint1 = constraints1.Item("Radius.1") Dim length1 As Length

Phụ lục A

length1.Value = 150# sketch1.CloseEdition Dim pocket1 As Pocket

Set pocket1 = shapes1.Item("Pocket.3") part1.InWorkObject = pocket1

part1.UpdateObject sketch1 part1.Update

Dim limit1 As Limit

Set limit1 = pad1.FirstLimit Dim length2 As Length

Set length2 = limit1.Dimension

length2.Value = (dai + 100) * 2 + 40

part1.UpdateObject pad1 part1.Update

Dim pocket2 As Pocket

Set pocket2 = shapes1.Item("Pocket.1") Dim sketch2 As Sketch

Set sketch2 = pocket2.Sketch part1.InWorkObject = sketch2 Dim factory2D2 As Factory2D

Set factory2D2 = sketch2.OpenEdition()

Dim geometricElements2 As GeometricElements Set geometricElements2 = sketch2.GeometricElements Dim circle2D2 As Circle2D

Phụ lục A

circle2D2.SetData 0#, 0#, 150# Dim constraints2 As Constraints Set constraints2 = sketch2.Constraints Dim constraint2 As Constraint

Set constraint2 = constraints2.Item("Radius.4") Dim length3 As Length

Set length3 = constraint2.Dimension length3.Value = 150#

sketch2.CloseEdition

part1.InWorkObject = pocket1 part1.UpdateObject sketch2 part1.Update

Dim sketch3 As Sketch Set sketch3 = pocket1.Sketch part1.InWorkObject = sketch3 Dim factory2D3 As Factory2D

Set factory2D3 = sketch3.OpenEdition()

Dim geometricElements3 As GeometricElements Set geometricElements3 = sketch3.GeometricElements Dim circle2D3 As Circle2D (adsbygoogle = window.adsbygoogle || []).push({});

Set circle2D3 = geometricElements3.Item("Circle.1") circle2D3.SetData 0#, 0#, 150#

Dim constraints3 As Constraints Set constraints3 = sketch3.Constraints Dim constraint3 As Constraint

Set constraint3 = constraints3.Item("Radius.3") Dim length4 As Length

Phụ lục A

Set length4 = constraint3.Dimension length4.Value = 150#

sketch3.CloseEdition

part1.InWorkObject = pocket1 part1.UpdateObject sketch3 part1.Update

Set partDocument1 = CATIA.ActiveDocument

partDocument1.SaveAs "E:\Do Van Hieu\Truc 1.CATPart"

End Sub

5. Truyền tham số vào chi tiết trục 2:

Sub Vetruc2(dai)

Dim documents1 As Documents Set documents1 = CATIA.Documents

Dim partDocument1 As PartDocument

Set partDocument1 = documents1.Open("E:\Do Van Hieu\Truc 2.CATPart")

Dim part1 As Part

Set part1 = partDocument1.Part

Dim bodies1 As Bodies Set bodies1 = part1.Bodies

Dim body1 As Body

Phụ lục A

Dim shapes1 As Shapes Set shapes1 = body1.Shapes

Dim pad1 As Pad

Set pad1 = shapes1.Item("Pad.1")

Dim limit1 As Limit

Set limit1 = pad1.FirstLimit

Dim length1 As Length

Set length1 = limit1.Dimension

length1.Value = (dai + 100) * 2 + 90

part1.UpdateObject pad1

part1.UpdateObject pad1 (adsbygoogle = window.adsbygoogle || []).push({});

part1.Update

Set partDocument1 = CATIA.ActiveDocument

partDocument1.SaveAs "E:\Do Van Hieu\Truc 2.CATPart"

Phụ lục B

PHỤ LỤC B: KẾT CẤU CỦA MỘT SỐ CHI TIẾT

- Chi tiết dao băm:

- Chi tiết trục:

Phụ lục B

- Chi tiết dây đai :

Phụ lục B

- Chi tiết phễu cấp:

Một phần của tài liệu Đồ án tính toán thiết kế và mô phỏng tham số máy băm sắn bằng CATIA (Trang 68)