MDT的VBA reference帮助文件中有一个例程:
- Sub CreateSketches()
- ......
- Dim feat As McadFeature
- Set feat = part.AddFeature(extrude)
- ' Get the cylindrical face
-
- Dim face As IMcadSurface
- Dim found As Boolean
- found = False
- Dim bounded As GeBoundedSurface
- For Each face In feat.faces
- Set bounded = face.Geometry
- If TypeOf bounded.BaseSurface Is GeCylinder Then
- found = True
- Exit For
- End If
- Next
- If Not found Then Exit Sub
-
- Dim dist As McadValue
- Set dist = util.CreateValue
- dist.value = 1
- Dim ang As McadValue
- Set ang = util.CreateValue
- ang.value = 30
- ' set the chamfer descriptor
- Dim chamferDescrip As McadChamferDescriptor
- Set chamferDescrip = util.CreateFeatureDescriptor(mcChamfer)
- chamferDescrip.ChamferType = mcDistanceAngle
- chamferDescrip.Distance1 = dist
- chamferDescrip.angle = ang
- chamferDescrip.face = face
-
- Dim chamferFeat As McadFeature
- Set chamferFeat = part.AddFeature(chamferDescrip)
- ......
我改动了以上的代码,想试一试已知距离和角度如何画出倒角,但程序运行到
- chamferDescrip.face = face
复制代码
时,显示 "类型不匹配" 的错误
请高手指点 |