Double
Dim slicePt3(0 To 2) As Double
' зріз
slicePt1(0) = -23: slicePt1(1) = 23: slicePt1(2) = 40
slicePt2(0) = 23: slicePt2(1) = 23: slicePt2(2) = 40
slicePt3(0) = 0: slicePt3(1) = 26: slicePt3(2) = 38
Set Part4 = boxObj.SliceSolid(slicePt1, slicePt2, slicePt3, False)
End Sub
Sub AddBox0()
' 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) = 17.5: center(1) = 17.5: center(2) = -13.5
length = 15#: width = 15: height = 15#
' Create the box (3DSolid) object in model space
Set box2Obj = 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) = -13.5: center(1) = 17.5: center(2) = 0#
radius = 3#: height = 50#
' 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
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) = -13.5: center(1) = -17.5: center(2) = 0#
radius = 3#: height = 50#
' Create the Cylinder (3DSolid) object in model space
Set cylinder2Obj = 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) = 4: rotatePt1(2) = 0
rotatePt2(0) = 0: rotatePt2(1) = 0: rotatePt2(2) = 0
rotateAngle = 90
rotateAngle = rotateAngle * 3.141592 / 180#
'rotate the Cylinder (3DSolid) object in model space
cylinder2Obj.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) = 0#: center(1) = 0#: center(2) = -60#
radius = 15#: height = 8
' Create the Cylinder (3DSolid) object in model space
Set Part = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)
End Sub
Sub AddExtrudedSolid()
' This example extrudes a solid from a region.
' The region is created from a line.
Dim curves(0 To 11) As AcadEntity
Dim Pt1(0 To 2) As Double
Dim Pt2(0 To 2) As Double
' Start point
Pt1(0) = -18.2: Pt1(1) = 6.3: Pt1(2) = -74#
Pt2(0) = -6.7: Pt2(1) = 18.2: Pt2(2) = -74#
Set curves(0) = ThisDrawing.ModelSpace.AddLine(Pt1, Pt2)
Pt1(0) = -3.6: Pt1(1) = 18.9' next point
Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).EndPoint, Pt1)
Pt1(0) = 12.4: Pt1(1) = 14.9' next point
Set curves(2) = ThisDrawing.ModelSpace.AddLine(curves(1).EndPoint, Pt1)
Pt1(0) = 14.5: Pt1(1) = 12.6'next point
Dim regionObj As Variant ' Create the region
regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
' Define the extrusion
Dim height As Double
Dim taperAngle As Double
height = 10: taperAngle = 0
' Create the solid
Set Part1 = ThisDrawing.ModelSpace.AddExtrudedSolid(regionObj(0), height, taperAngle)
End Sub
Sub AddCylinder2()
' This example 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) = 0: center(1) = 0: center(2) = -76
radius = 10#: height = 4#
' Create the Cylinder (3DSolid) object in model space
Set Part2 = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)
End Sub
Sub AddExtrudedSolid2()
' This code extrudes a solid from a region.
' The region is created from a line.
Dim curves(0 To 11) As AcadEntity
Dim Pt1(0 To 2) As Double
Dim Pt2(0 To 2) As Double
' Start point
Pt1(0) = -18.2: Pt1(1) = 6.3: Pt1(2) = -94#
Pt2(0) = -6.7: Pt2(1) = 18.2: Pt2(2) = -94#
Set curves(0) = ThisDrawing.ModelSpace.AddLine(Pt1, Pt2)
Pt1(0) = -3.6: Pt1(1) = 18.9' next point
Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).EndPoint, Pt1)
Pt1(0) = 12.4: Pt1(1) = 14.9' next point
Set curves(2) = ThisDrawing.ModelSpace.AddLine(curves(1).EndPoint, Pt1)
Pt1(0) = 14.5: Pt1(1) = 12.6'next point
' Create the region
Dim regionObj As Variant
regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
' Define the extrusion
Dim height As Double
Dim taperAngle As Double
height = 16: taperAngle = 0
' Create the solid
Set Part3 = ThisDrawing.ModelSpace.AddExtrudedSolid(regionObj(0), height, taperAngle)
End Sub
Sub AddRevolvedSolid()
' This part extrudes a solid from a region.
' The region is created from a line.
Dim curves(0 To 3) As AcadEntity
Dim P1(0 To 2) As Double
Dim P2(0 To 2) As Double
' Start point
P1(0) = 0.01: P1(1) = 0: P1(2) = -97#
P2(0) = 18: P2(1) = 0: P2(2) = -97#
Set curves(0) = ThisDrawing.ModelSpace.AddLine(P1, P2)
P1(0) = 13: P1(1) = 0: P1(2) = -102#' next point
Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).EndPoint, P1)
P1(0) = 0.01: P1(1) = 0: P1(2) = -102#' next point
Set curves(2) = ThisDrawing.ModelSpace.AddLine(curves(1).EndPoint, P1)
P1(0) = 0.01: P1(1) = 0: P1(2) = -97#'End point
' Create the region
Dim regionObj As Variant
regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
'задаємо вісь навколо якої будемо обертати створений регіон на 360 градусів (6.28 радіан)
Dim axisPt(0 To 2) As Double
Dim axisDir(0 To 2) As Double
Dim angle As Double
axisPt(0) = 0: axisPt(1) = -1: axisPt(2) = 0
axisDir(0) = 0: axisDir(1) = 0: axisDir(2) = 1
angle = 6.3
' створення твердотілого обєкта методом обертання навкошо вісі
Set Part5 = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), axisPt, axisDir, angle)
End Sub
Sub Object()
' створення відповідного слою для