请问,我用vba创建了用户坐标系ucs,但是为什么画出来的圆柱体还在世界坐标系里wcs,谢谢大家。代码如下:
- '定义用户坐标系ucs
- Dim ucsObj1 As AcadUCS
- Dim origin1(0 To 2) As Double
- Dim xAxisPnt1(0 To 2) As Double
- Dim yAxisPnt1(0 To 2) As Double
- origin1(0) = X
- origin1(1) = Y
- origin1(2) = Z
-
- xAxisPnt1(0) = l1 + X
- xAxisPnt1(1) = m1 + Y
- xAxisPnt1(2) = n1 + Z
-
- yAxisPnt1(0) = l2 + X
- yAxisPnt1(1) = m2 + Y
- yAxisPnt1(2) = n2 + Z
-
- ' 添加UCS到 UserCoordinatesSystems 集合
- Set ucsObj1 = ThisDrawing.UserCoordinateSystems.Add(origin1, xAxisPnt1, yAxisPnt1, "New_UCS")
- ' 使新的UCS成为活动的UCS
- ThisDrawing.ActiveUCS = ucsObj1
-
- '绘制圆柱体
- Dim cylinderObj As Acad3DSolid
- Dim cylinderCenter(0 To 2) As Double
- Dim cylinderRadius As Double
- Dim cylinderHeight As Double
- cylinderCenter(0) = X
- cylinderCenter(1) = Y
- cylinderCenter(2) = Z
- cylinderRadius = excelSheet.Cells(j, 4).Value
- cylinderHeight = excelSheet.Cells(j, 7).Value
- Set cylinderObj = ThisDrawing.ModelSpace.AddCylinder(cylinderCenter, cylinderRadius, cylinderHeight)
请问各位大侠哪里出了问题?
|