moodlee 发表于 2017-7-18 18:05:19

关于CATIA二次开发中一些函数的问题

简述:
CreateCircle(6.651160, -34.796144, 78.485461, 2.920640, 6.198346)
这是一个创建弧线的函数,对应的操作是三点弧。
共有五个参数,我能理解前三个参数,不能理解后两个参数,求助。
——————————
详情:

其中弧线的参数是:
中心点:
          直角:H:6.651mm V:-34.796mm
          极:半径:35.426mm 角度:-79.179deg
半径:78.485mm
————————————————————————————
其中录制的宏是:
Language="VBSCRIPT"
Sub CATMain()
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set bodies1 = part1.Bodies
Set body1 = bodies1.Item("零件几何体")
Set sketches1 = body1.Sketches
Set originElements1 = part1.OriginElements
Set reference1 = originElements1.PlaneXY
Set sketch1 = sketches1.Add(reference1)
Dim arrayOfVariantOfDouble1(8)
arrayOfVariantOfDouble1(0) = 0.000000
arrayOfVariantOfDouble1(1) = 0.000000
arrayOfVariantOfDouble1(2) = 0.000000
arrayOfVariantOfDouble1(3) = 1.000000
arrayOfVariantOfDouble1(4) = 0.000000
arrayOfVariantOfDouble1(5) = 0.000000
arrayOfVariantOfDouble1(6) = 0.000000
arrayOfVariantOfDouble1(7) = 1.000000
arrayOfVariantOfDouble1(8) = 0.000000
sketch1.SetAbsoluteAxisData arrayOfVariantOfDouble1
part1.InWorkObject = sketch1
Set factory2D1 = sketch1.OpenEdition()
Set geometricElements1 = sketch1.GeometricElements
Set axis2D1 = geometricElements1.Item("绝对轴")
Set line2D1 = axis2D1.GetItem("横向")
line2D1.ReportName = 1
Set line2D2 = axis2D1.GetItem("纵向")
line2D2.ReportName = 2
Set point2D1 = factory2D1.CreatePoint(-69.926254, -17.595348)
point2D1.ReportName = 3
Set point2D2 = factory2D1.CreatePoint(-41.248627, 63.734261)
point2D2.ReportName = 4
Set line2D3 = factory2D1.CreateLine(-69.926254, -17.595348, -41.248627, 63.734261)
line2D3.ReportName = 5
line2D3.StartPoint = point2D1
line2D3.EndPoint = point2D2
Set point2D3 = factory2D1.CreatePoint(91.532677, 19.941395)
point2D3.ReportName = 6
Set line2D4 = factory2D1.CreateLine(-41.248627, 63.734261, 91.532677, 19.941395)
line2D4.ReportName = 7
line2D4.StartPoint = point2D2
line2D4.EndPoint = point2D3
Set point2D4 = factory2D1.CreatePoint(84.854332, -41.446819)
point2D4.ReportName = 8
Set line2D5 = factory2D1.CreateLine(91.532677, 19.941395, 84.854332, -41.446819)
line2D5.ReportName = 9
line2D5.StartPoint = point2D3
line2D5.EndPoint = point2D4
Set point2D5 = factory2D1.CreatePoint(6.651160, -34.796144)
point2D5.ReportName = 10
Set point2D6 = factory2D1.CreatePoint(-69.926254, -17.595348)
point2D6.ReportName = 11
Set circle2D1 = factory2D1.CreateCircle(6.651160, -34.796144, 78.485461, 2.920640, 6.198346)
circle2D1.CenterPoint = point2D5
circle2D1.ReportName = 12
circle2D1.StartPoint = point2D6
circle2D1.EndPoint = point2D4
Set constraints1 = sketch1.Constraints
Set reference2 = part1.CreateReferenceFromObject(point2D6)
Set reference3 = part1.CreateReferenceFromObject(line2D3)
Set constraint1 = constraints1.AddBiEltCst(catCstTypeOn, reference2, reference3)
constraint1.Mode = catCstModeDrivingDimension
sketch1.CloseEdition
part1.InWorkObject = sketch1
part1.Update
Set shapeFactory1 = part1.ShapeFactory
Set pad1 = shapeFactory1.AddNewPad(sketch1, 20.000000)
part1.Update
End Sub
——————————————————————————————————————
我对代码的分析结果是:
创建点1
Set p1 = factory2D.CreatePoint(84.854332, -41.446819)
p1.ReportName = n
创建点2
Set p2 = factory2D.CreatePoint(6.651160, -34.796144)
p2.ReportName = n+1
创建点3
Set p3 = factory2D.CreatePoint(-69.926254, -17.595348)
p3.ReportName = n+2
创建弧线
Set cir = factory2D.CreateCircle(p2.X, p2.Y, R, 2.920640, 6.198346)---(中心点的横坐标,中心点的纵坐标,半径,?,?)
cir.CenterPoint = p2
cir.StartPoint = p3
cir.EndPoint = p1
cir.ReportName = n+3












catia8 发表于 2017-7-19 10:37:33

CreateCircle( double iCenterX,double iCenterY,double iRadius,double iStartParam,double iEndParam ) As CATIACircle2D
参数说明:
iCenterX,iCenterY:圆弧中心坐标;
iRadius:圆弧半径
iStartParam:圆弧起始圆心角,以弧度表示。
iEndParam:圆弧终点圆心角,以弧度表示。

catia8 发表于 2017-7-19 10:40:21

如下代码将创建以(5,15)为圆心,从-90到+90,半径为30mm的半圆:
Dim PI as Double
PI=3.14159
Dim Circle as Circle2D
Set Circle=Factory2D.CreateCircle(5,15,30,-PI/2,PI/2)

moodlee 发表于 2017-7-19 14:26:47

catia8 发表于 2017-7-19 10:40 static/image/common/back.gif
如下代码将创建以(5,15)为圆心,从-90到+90,半径为30mm的半圆:
Dim PI as Double
PI=3.14159


谢谢。
页: [1]
查看完整版本: 关于CATIA二次开发中一些函数的问题