📄 01-fullcode.txt
字号:
'始初化
InitCATIAPart
'创建草绘特征
Dim oPlaneYZ As Plane, oSketch As Sketch
Set oPlaneYZ = oPart.OriginElements.PlaneYZ
Set oSketch = oBody.Sketches.Add(oPlaneYZ)
'编辑草绘特征
Dim oFactory2D As Factory2D
Set oFactory2D = oSketch.OpenEdition
'创建直线
Dim oLine As Line2D
Set oLine = oFactory2D.CreateLine(0, 0, 10, 20)
Dim oLineH As Line2D
Set oLineH = oSketch.AbsoluteAxis.HorizontalReference
Dim oRef1 As Reference, oRef2 As Reference
Set oRef1 = oPart.CreateReferenceFromObject(oLine)
Set oRef2 = oPart.CreateReferenceFromObject(oLineH)
'创建约束
Dim oConstraints As Constraints, oConstraint As Constraint
Set oConstraints = oSketch.Constraints
Set oConstraint = oConstraints.AddBiEltCst(catCstTypeAngle, oRef1, oRef2)
oConstraint.Dimension.Value = 30
oSketch.CloseEdition
'创建Pad特征
Dim oSF As ShapeFactory, oPad As Pad
Set oSF = oPart.ShapeFactory
Set oPad = oSF.AddNewPad(oSketch, 20)
oPad.IsThin = True
'更新零件
oPart.Update
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -