У нас: 141825 рефератів
Щойно додані Реферати Тор 100
Скористайтеся пошуком, наприклад Реферат        Грубий пошук Точний пошук
Вхід в абонемент



Курсова робота - Програма AutoCad
49
18 Кнопка команди Разрез (Slice)

Рис. 15 Побудова області у формі кільця

Рис. 16 Побудова труби за допомогою видавлювання

Розглянемо цю команду на прикладі побудованої нами труби (мал. 17). За допомогою команди ПСК (UCS) перейдіть у МСК. Клацніть мишею по кнопці Разрез (Slice) і на запит про об‘єкти виберіть трубу. Такий запит:

(Specify first point on slicing plane by [Object/Zaxis/View/XY/YZ/ZX/3points] <3points>:)

Натисніть клавішу Enter, пітверджуючи вибір площини розтину трьома точками. Далі послідовно відповідаючи на запити, введіть такі точки: (0,80,0), (0,-80,0), (100,0,300). Тепер системі необхідно повідомити, які тіла залишити:

(Specify a point on the desired side of the plane or [keep Both sides]: )

Виберіть опцію Обе стороны (keep Both sides). Труба розділиться на два тіла. Відсуньте одне тіло ліворуч. Результат виконаних перетворень наведено на рис. 19.

Рис. 19 Розрізування тіла площиною

3. Текст програми мовою Visual Basic

Dim boxObj As Acad3DSolid

Dim box2Obj As Acad3DSolid

Dim box3Obj As Acad3DSolid

Dim cylinderObj As Acad3DSolid

Dim cylinder2Obj As Acad3DSolid

Dim cylinder3Obj As Acad3DSolid

Dim cylinder4Obj As Acad3DSolid

Dim Part As Acad3DSolid

Dim Part1 As Acad3DSolid

Dim Part2 As Acad3DSolid

Sub AddSliceBox()

' This code creates a box in model space.

Dim length As Double, width As Double, height As Double

Dim center(0 To 2) As Double

 

' Define the box

center(0) = 100#: center(1) = 40#: center(2) = 80#

length = 200#: width = 80: height = 160#

 

' Create the box (3DSolid) object in model space

Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

End Sub

Sub AddBox2()

' This code creates a box in model space.

 

Dim length As Double, width As Double, height As Double

Dim center(0 To 2) As Double

 

' Define the box

center(0) = 100: center(1) = 85: center(2) = 80

length = 200#: width = 10: height = 160#

 

' Create the box (3DSolid) object in model space

Set box2Obj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

 

End Sub

Sub AddBox3()

' This code creates a box in model space.

 

Dim length As Double, width As Double, height As Double

Dim center(0 To 2) As Double

 

' Define the box

center(0) = 100: center(1) = 25: center(2) = 170

length = 60#: width = 50: height = 20#

 

' Create the box (3DSolid) object in model space

Set box3Obj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

End Sub

Sub AddCylinderRotate()

' This code creates a cylinder in model space.

 

Dim radius As Double

Dim center(0 To 2) As Double

Dim height As Double

 

' Define the cylinder

center(0) = 60: center(1) = 40: center(2) = -100#

radius = 30#

height = 200#

 

' Create the Cylinder (3DSolid) object in model space

Set cylinderObj = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)

 

' Define the rotation axis with two points

Dim rotatePt1(0 To 2) As Double

Dim rotatePt2(0 To 2) As Double

Dim rotateAngle As Double

Dim rotateAngl As Double

rotatePt1(0) = 0: rotatePt1(1) = 4: rotatePt1(2) = 0

rotatePt2(0) = 0: rotatePt2(1) = 0: rotatePt2(2) = 0

rotateAngle = 90: rotateAngl = -90: rotateAng = 180:

rotateAngle = rotateAngle * 3.141592 / 180#

rotateAngl = rotateAngl * 3.141592 / 180#

rotateAng = rotateAng * 3.141592 / 180#

'rotate the Cylinder (3DSolid) object in model space

cylinderObj.Rotate3D rotatePt1, rotatePt2, rotateAngle

boxObj.Boolean acSubtraction, cylinderObj

End Sub

Sub AddCylinderRotate2()

' This code creates a cylinder in model space.

 

Dim radius As Double

Dim center(0 To 2) As Double

Dim height As Double

 

' Define the cylinder

center(0) = -100: center(1) = 25: center(2) = -155#

radius = 10#

height = 130#

 

' Create the Cylinder (3DSolid) object in model space

Set cylinder2Obj = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)

 

Dim rotatePt1(0 To 2) As Double

Dim rotatePt2(0 To 2) As Double

Dim rotateAngle As Double

rotatePt1(0) = 0: rotatePt1(1) = 4: rotatePt1(2) = 0

rotatePt2(0) = 0: rotatePt2(1) = 0: rotatePt2(2) = 0

rotateAngle = 180

rotateAngle = rotateAngle * 3.141592 / 180#

'rotate the Cylinder (3DSolid) object in model space

cylinder2Obj.Rotate3D rotatePt1, rotatePt2, rotateAngle

 

End Sub

Sub AddCylinderRotate3()

' This code creates a cylinder in model space.

 

Dim radius As Double

Dim center(0 To 2) As Double

Dim height As Double

 

' Define the cylinder

center(0) = 215: center(1) = 300: center(2) = -20

radius = 5#

height = 50#

 

' Create the Cylinder (3DSolid) object in model space

Set cylinder3Obj = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)

 

' Define the rotation axis with two points

Dim rotatePt1(0 To 2) As Double

Dim rotatePt2(0 To 2) As Double

Dim rotateAngle As Double

rotatePt1(0) = 0: rotatePt1(1) = 0: rotatePt1(2) = 4

rotatePt2(0) = 4: rotatePt2(1) = 0: rotatePt2(2) = 4

rotateAngle = 90

rotateAngle = rotateAngle * 3.141592 / 180#

 

'rotate the Cylinder (3DSolid) object in model space

cylinder3Obj.Rotate3D rotatePt1, rotatePt2, rotateAngle

End Sub

Sub AddCylinderRotate4()

' This code creates a cylinder in model space.

 

Dim radius As Double

Dim center(0 To 2) As Double

Dim height As Double

 

' Define the cylinder

center(0) = 215: center(1) = 300: center(2) = -20#

radius = 40#

height = 30#

 

' Create the Cylinder (3DSolid) object in model space

Set cylinder4Obj = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)

 

' Define the rotation axis with two points

Dim rotatePt1(0 To 2) As Double

Dim rotatePt2(0 To 2) As Double

Dim rotateAngle As Double

rotatePt1(0) = 0: rotatePt1(1) = 0: rotatePt1(2) = 4

rotatePt2(0) = 4: rotatePt2(1) = 0: rotatePt2(2) = 4

rotateAngle = 90

rotateAngle = rotateAngle * 3.141592 / 180#

'rotate the Cylinder (3DSolid) object in model space

cylinder4Obj.Rotate3D rotatePt1, rotatePt2, rotateAngle

End Sub

 

Sub AddCylinder()

Dim center(0 To 2) As Double

Dim radius As Double

Dim height As Double

center(0) = -20#: center(1) = 300#: center(2) = 215#

radius = 40#

height = 30

' Create the Cylinder (3DSolid) object in model space

Set Part = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)

'cylinderObj.color = acBlue

End Sub

Sub AddExtrudedSolid()

' This


Сторінки: 1 2 3 4 5 6 7 8