我想在宏中将草图支持从一个平面更改为另一个平面。 我尝试使用StartCommand但是没有用。如果没有用户输入,怎么办呢?
我尝试了以下代码,但没有用。
CATIA.StartCommand "Change Sketch Support"
selection1.Add sketch3
SendKeys "{ENTER}", True
selection1.Add Plane_a
SendKeys "{ENTER}", True
part1.Update
答案 0 :(得分:1)
此链接表示选择草图然后选择平面并运行StartCommand“更改草图支持”
'Get the part object (Assume the part is open in it’s own window)
Set objPart = CATIA.ActiveDocument.Part
'Get the first sketch in the first geometrical set
Set objSketch = objPart.HybridBodies.Item(1).HybridSketches.Item(1)
'Get the plane called Plane.1 in the first geometrical set
Set objPlane = objPart.HybridBodies.Item(1).HybridShapes.Item(“Plane.1”)
'Select the sketch first then the new support plane
Set objSel = CATIA.ActiveDocument.Selection
objSel.Clear
objSel.Add objSketch
objSel.Add objPlane
'Call the Change Sketch Support command
CATIA.StartCommand “Change Sketch Support”