如何使用vba更改CATIA中的草图支持? [英] How to change sketch support in CATIA using vba?

查看:397
本文介绍了如何使用vba更改CATIA中的草图支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在宏中将草图支撑从一个平面更改为另一个平面。
我尝试使用StartCommand,但是没有用。没有用户输入怎么办?

I want to Change a sketch Support from one plane to another in macro. I tried with StartCommand but that did not work. How can this be done without user Input?

我尝试了以下代码,但没有用。

I have tried the following code but it did not work.

 CATIA.StartCommand "Change Sketch Support"
 selection1.Add sketch3
 SendKeys "{ENTER}", True
 selection1.Add Plane_a
 SendKeys "{ENTER}", True
 part1.Update


推荐答案

此链接显示选择草图,然后选择平面并运行StartCommand更改草图支持

This link says to select the sketch then select the plane and run StartCommand "Change Sketch Support"

'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"

https://v5vb.wordpress.com/2010/01/20/startcommand/

这篇关于如何使用vba更改CATIA中的草图支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆