找回密码
 成为会员
Greetings!CATIA 模型下载CATIA V5安装包下载合集CATIA常用基本命令视频教程
CATIA V5-6R2018下载查看高版本CATIA文件CATIA V5-6R2015下载CATIA V5-6R2014下载
CATIA V5R21 64位下载CATIA V5R21 32位下载CATIA V5R20下载CATIA 基础视频教程
查看: 5783|回复: 3

[已解决] 关于CATIA二次开发中一些函数的问题

[复制链接]
  • TA的每日心情
    开心
    2020-5-19 20:12
  • 签到天数: 126 天

    [LV.7]常住居民III

    发表于 2017-7-18 18:05:19 | 显示全部楼层 |阅读模式
    新手如何挣金币,提高权限         catia新手群:37932140欢迎大家加入!
    简述:
    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












    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?成为会员

    x
    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    3 小时前
  • 签到天数: 663 天

    [LV.9]以坛为家II

    发表于 2017-7-19 10:37:33 | 显示全部楼层
    新手如何挣金币,提高权限         catia新手群:37932140欢迎大家加入!
    CreateCircle( double iCenterX,double iCenterY,double iRadius,double iStartParam,double iEndParam ) As CATIACircle2D
    参数说明:
    iCenterX,iCenterY:圆弧中心坐标;
    iRadius:圆弧半径
    iStartParam:圆弧起始圆心角,以弧度表示。
    iEndParam:圆弧终点圆心角,以弧度表示。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    慵懒
    3 小时前
  • 签到天数: 663 天

    [LV.9]以坛为家II

    发表于 2017-7-19 10:40:21 | 显示全部楼层
    新手如何挣金币,提高权限         catia新手群:37932140欢迎大家加入!
    如下代码将创建以(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)
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2020-5-19 20:12
  • 签到天数: 126 天

    [LV.7]常住居民III

     楼主| 发表于 2017-7-19 14:26:47 | 显示全部楼层
    新手如何挣金币,提高权限         catia新手群:37932140欢迎大家加入!
    catia8 发表于 2017-7-19 10:40
    如下代码将创建以(5,15)为圆心,从-90到+90,半径为30mm的半圆:
    Dim PI as Double
    PI=3.14159

    谢谢。
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 成为会员

    本版积分规则

    Archiver|手机版|小黑屋|Catia8.com

    GMT+8, 2024-11-23 16:05 , Processed in 0.049562 second(s), 19 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2013 Comsenz Inc. Design CATIA8

    快速回复 返回顶部 返回列表