vbnet删除SolidWorks中选中的点
时间: 2023-07-16 15:13:21 浏览: 217
可以使用以下代码删除 SolidWorks 中选中的点:
```vbnet
Dim swApp As Object
Dim swModel As Object
Dim swSelMgr As Object
Dim swFeat As Object
Dim swSubFeat As Object
Dim swSketchMgr As Object
Dim swSketch As Object
Dim swSelData As Object
Dim swPoint As Object
Set swApp = GetObject(, "SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
Set swSubFeat = swFeat.GetSpecificFeature2
Set swSketchMgr = swSubFeat.GetSketch.GetSketchManager
Set swSketch = swSubFeat.GetSketch
'获取选中的点
Set swSelData = swSelMgr.GetSelectedObject6(1, -1)
Set swPoint = swSelData
'删除选中的点
swSketchMgr.DeletePoint swPoint.GetID
swModel.ClearSelection2 True
```
注意,这段代码是基于 SolidWorks API 编写的,需要在 SolidWorks 中运行。另外,删除点会影响线和面等几何体的拓扑关系,需谨慎操作。
阅读全文