lzhyi 发表于 2015-10-18 19:21:26

移动复制体,如何把要复制的体加代码里去

      'NXOPEN创建方块体的方法
      Dim block1 As Features.BlockFeatureBuilder
      Dim point1 As Double = 6
      block1 = workpart.Features.CreateBlockFeatureBuilder(Nothing)
      block1.SetOriginAndLengths(New Point3d(-6, point1, 0), "12", "12", "6")
      Dim feature1 As Features.Feature
      feature1 = block1.CommitFeature()


      '以下是移动体
      Dim block2 As Features.MoveObjectBuilder
      block2 = workpart.BaseFeatures.CreateMoveObjectBuilder(Nothing)

      block2.TransformMotion.Option = GeometricUtilities.ModlMotion.Options.Distance
      block2.TransformMotion.DistanceValue.RightHandSide = "50"   '移动距离
      block2.MoveObjectResult = Features.MoveObjectBuilder.MoveObjectResultOptions.CopyOriginal

      block2.ObjectToMoveObject = Add(block1)'要移动的体

      Dim origin1 As Point3d = New Point3d(0.0, 0.0, 0.0)
      Dim vector1 As Vector3d = New Vector3d(0.0, 1.0, 0.0)
      Dim direction1 As Direction
      direction1 = workpart.Directions.CreateDirection(origin1, vector1, SmartObject.UpdateOption.WithinModeling)
      block2.TransformMotion.DistanceVector = direction1'移动方向

      block2.NumberOfCopies = "3"   '移动数量

      Dim nXObject1 As NXObject
      nXObject1 = block2.Commit()

上面红色那段代码怎么改写。请指教。(这是用JA录制的VB代码)

页: [1]
查看完整版本: 移动复制体,如何把要复制的体加代码里去