#创建一个草图

#第一个参数传入一个Frame对象

#通过一个点和两个向量创建Frame

#Frame的类成员函数Create被重载

#重载函数1:Frame.Create(Point, Direction)

#第一个参数为一个点

#第二个参数为面法向向量

#重载函数2:Frame. Create(Point, Direction, Direction)

#第一个参数为面上的一个点

#第二个和第三个参数为面上的向量

#调用ViewHelper.SetSketchPlane函数在选中对象的基础上创建一个草图

#该函数也重载了两个函数

#重载函数1:SetSketchPlane(ISelection)

#参数为一个Selection的对象

#重载函数2:SetSketchPlane(Plane, ScriptObject)

#第一个参数为前面创建的平面

#第二个参数为可选参数,默认为null

#返回一个SetViewModeCommandResult对象

plane = Plane.Create(Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 0, 1), Direction.Create(1, 0, 0)))

result = ViewHelper.SetSketchPlane(plane)

#旋转草图

rotationAxis = Line.Create(

Point.Create(MM(0), MM(0), MM(0)),

Direction.Create(1, 0, 0)) #定义旋转轴

matrix = Matrix.Identity #定义一个矩阵

matrix = matrix * Matrix.CreateRotation(rotationAxis, DEG(90)) #创建一个旋转矩阵

ViewHelper.TransformSketchPlane(matrix) #将草图旋转一个角度

#平移草图

plane = Plane.Create(Frame.Create(Point.Create(MM(0), MM(20), MM(0)), Direction.Create(0, 0, 1), Direction.Create(1, 0, 0)))

result = ViewHelper.SetSketchPlane(plane)

matrix = Matrix.Identity

matrix = matrix * Matrix.CreateTranslation(Vector.Create(MM(0), MM(20), MM(0)))

ViewHelper.TransformSketchPlane(matrix)

#草图转换为三维模式

#转换函数重载了两个函数

#重载函数1 :ViewHelper.SetViewMode(InteractionMode, IScriptObject)

#第一个参数为交互模式,分别为草图模式,剖面模式,三维模式

#第二个参数为可选参数,附加参数,默认值为null

#重载函数2:ViewHelper.SetViewMode(InteractionMode, Plane, IScriptObject)

#第一个参数为交互模式,分别为草图模式,剖面模式,三维模式

#第二个参数为草图平面

#第三个参数为可选参数,附加参数,默认值为null

#返回值为一个SetViewModeCommandResult对象

交互模式可选参数

名称

描述

Sketch

0

草图模式

Section

1

剖面模式

Solid

2

三维模式

result = ViewHelper.SetViewMode(InteractionMode.Solid)

#草图当中创建一条直线

#创建直线函数重载了三个函数

#重载函数1:SketchLine.Create(Point2D, Point2D)

#第一个参数为直线的起点

#第二个参数为直线的终点,起点和终点的坐标皆为激活平面上的二维坐标

#重载函数2:SketchLine. Create(Point, Point, Plane)

#第一个参数为起点坐标

#第二个参数为终点坐标

#第三个参数为可选参数,默认为null,即当前草图

#返回一个SketchCurveResult对象

重载函数1示例:

frame= Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0))

plane= Plane.Create(frame)

ViewHelper.SetSketchPlane(plane)

start = Point2D.Create(MM(-8), MM(17))

end = Point2D.Create(MM(-8), MM(-21))

result = SketchLine.Create(start, end)

重载函数2示例:

start = Point.Create(MM(-8), MM(17),MM(0))

end = Point.Create(MM(-8), MM(-21) ,MM(0))

result = SketchLine.Create(start, end)

#草图当中创建一个矩形

#创建矩形的函数重载了三个函数

#重载函数1:SketchRectangle. Create(Point, Point, Point)

#三个参数分别为矩形的三个角上的坐标,从而确定矩形

#重载函数2:SketchRectangle.Create(Point2D, Point2D, Point2D)

#三个参数为矩形的三个角上的坐标,但这个坐标为当前激活平面上的二维坐标

#重载函数3:SketchRectangle. Create(IRectangle)

#参数为IRectangle对象

#返回一个SketchCurveResult对象

重载函数1示例:

point1 = Point.Create(MM(15),MM(-15),MM(0))

point2 = Point.Create(MM(-15),MM(-15),MM(0))

point3 = Point.Create(MM(-15),MM(15),MM(0))

result = SketchRectangle.Create(point1, point2, point3)

重载函数2示例:

plane = Plane.Create(Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0)))

result = ViewHelper.SetSketchPlane(plane)

point1 = Point2D.Create(MM(15),MM(-15))

point2 = Point2D.Create(MM(-15),MM(-15))

point3 = Point2D.Create(MM(-15),MM(15))

result = SketchRectangle.Create(point1, point2, point3)

#草图当中创建一个圆形

#创建矩形的函数重载了三个函数

#重载函数1:SketchCircle.Create(Point2D, Double)

#第一个参数为圆心坐标,该坐标位于当前激活的平面上

#第二个参数为半径

#重载函数2:SketchCircle. Create(Point, Double, Plane)

#第一个参数为圆心

#第二个参数为半径

#第三个参数为可选参数,用来指定圆所在平面,默认为null,为当前平面

#重载函数3:SketchCircle.Create(Circle, Plane)

#第一个参数为Circle对象

#第二个参数为可选参数,用来指定圆所在平面,默认为null,为当前平面

#返回一个SketchCurveResult对象

重载函数1示例:

plane = Plane.Create(Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0)))

result = ViewHelper.SetSketchPlane(plane)

circlepoint= Point2D.Create(MM(0),MM(0))

SketchCircle.Create(circlepoint, MM(10))

重载函数2示例:

plane = Plane.Create(Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0)))

result = ViewHelper.SetSketchPlane(plane)

circlepoint= Point.Create(MM(0),MM(0),MM(0))

SketchCircle.Create(circlepoint, MM(10),plane)

重载函数3示例:

frame= Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0))

plane= Plane.Create(frame)

radius= MM(10)

circle= Circle.Create(frame,radius)

SketchCircle.Create(circle,plane)

#草图当中创建一个多边形

#只有一个参数,用Polygon对象在草图上创建一个多边形

#返回一个SketchCurveResult对象

frame= Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0))

innerRadius = MM(18) #内接圆的半径

numSides = 6 #多边形的边数

#创建一个多边形的对象

polygon = Polygon.Create(frame, innerRadius, numSides)

result = SketchPolygon.Create(polygon)

#草图当中创建一段圆弧

#创建圆弧的函数重载了三个函数

#重载函数1:SketchArc.Create(Point, Point, Point)

#第一个参数是圆弧的圆心坐标

#第二个参数是圆弧的起点坐标

#第三个参数是圆弧的终点坐标

#重载函数2:SketchArc.Create(Point2D, Point2D, Point2D)

#三个参数与上面同,但这个坐标为当前激活平面上的二维坐标

#重载函数3:SketchArc.Create(Circle, Interval)

#第一个参数为Circle的对象

#第二个参数为Interval的对象

#返回一个SketchCurveResult对象

重载函数1示例:

origin = Point.Create(MM(0), MM(0), MM(0))

start = Point.Create(MM(15), MM(0), MM(0))

end = Point.Create(MM(0), MM(15), MM(0))

SketchArc.Create(origin, start, end)

重载函数2示例:

frame= Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0))

plane= Plane.Create(frame)

ViewHelper.SetSketchPlane(plane)

origin = Point2D.Create(MM(0), MM(0))

start = Point2D.Create(MM(15), MM(0))

end = Point2D.Create(MM(0), MM(15))

result = SketchArc.Create(origin, start, end)

#草图当中创建样条曲线

#第一个参数设置样条曲线是否是周期性,也就是样条曲线是否闭合

#第二个参数传入一个点坐标的列表

#返回一个SketchCurveResult的对象

frame= Frame.Create(Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 1, 0), Direction.Create(1, 0, 0))

plane= Plane.Create(frame)

ViewHelper.SetSketchPlane(plane)

points = List[Point2D]()

points.Add(Point2D.Create(MM(-17), MM(-14)))

points.Add(Point2D.Create(MM(-1), MM(-7)))

points.Add(Point2D.Create(MM(6), MM(11)))

points.Add(Point2D.Create(MM(23), MM(19)))

points.Add(Point2D.Create(MM(29), MM(27)))

result = SketchNurbs.CreateFrom2DPoints(False, points)

#移动一个选中的对象

#MM表示的是以毫米作为单位

#该函数共有三个重载函数

#重载函数1:Move.Execute(ISelection, Vector, MoveOptions)

#第一个参数为选中的对象,可通过Selection.GetActive()获取

#第二个参数为移动的向量

#第三个参数为移动选项

#重载函数2:Move.Execute(ISelection, Frame, TransformType, Vector, MoveOptions)

#第一个参数为选中的对象,可通过Selection.GetActive()获取

#第二个为框架坐标系

#第三个为移动的类型

#第四个参数为移动的向量

#第五个为移动的选项

#重载函数3:Move.Execute(ISelection, Frame, TransformType, Double, MoveOptions)

#第一个参数为选中的对象,可通过Selection.GetActive()获取

#第二个为框架坐标系

#第三个为移动的类型

#第四个参数为移动距离

#第五个为移动的选项

#返回的是一个MoveResult的对象

注:

TransformType参数的取值如下:

名称

描述

TranslateX

0

沿x轴移动

TranslateY

1

沿y轴移动

TranslateZ

2

沿z轴移动

RotateX

3

绕x轴旋转

RotateY

4

绕y轴旋转

RotateZ

5

绕z轴旋转

TranslateXY

6

沿x,y平面移动

TranslateXZ

7

沿x,z平面移动

TranslateYZ

8

沿y,z平面移动

重载函数1:

Move.Execute(Selection.GetActive(),Vector.Create(MM(40),MM(0),MM(0)), MoveOptions())

重载函数2:

Move.Execute(Selection.GetActive(), Frame.World, TransformType.TranslateX, Vector.Create(MM(40),MM(0),MM(0)), MoveOptions())

重载函数3:

Move.Execute(Selection.GetActive(), Frame.World, TransformType.TranslateX, MM(40), MoveOptions())

#填充一个选中的对象

#第一个参数为填充的对象

#第二个参数为可选参数,默认值为null

#第三个参数为可选参数,填充选项,默认值为null

#第四个参数为可选参数,填充模式,默认值为null

#第五个参数为可选参数,默认值为null

#返回一个CommandResult的对象

第四个参数的取值如下:

名称

描述

Sketch

0

Sketch mode

Section

1

Section mode

Layout

2

Layout mode

ThreeD

3

3D mode

result = Fill.Execute(Selection.GetActive())

最新文章

  1. HTML div 滚动条样式设计
  2. C#字符串(截取)
  3. 【转】推荐介绍几款小巧的Web Server程序
  4. Oracle过程及函数的参数模式,In、out、in out模式
  5. 【leetcode】Search in Rotated Sorted Array II
  6. new Date()时间对象
  7. Qt的QTabelWidget
  8. ios下划线变量:为什么变量前要加下划线才有用?
  9. 一个简单的ORM制作(SQL帮助类)
  10. 几种RAID技术比较
  11. 学习python的第二天
  12. C# virtual、abstract
  13. 34对MyBatis的博客的整理心得
  14. 聊聊ReentrantLock的内部实现
  15. [Algorithm] Good Fibonacci
  16. Java生成8位随机邀请码,不重复
  17. CorelDRAW中如何复制对象属性详解
  18. C++中成员初始化列表的使用
  19. Java中的各种加密算法
  20. HandlerThread使用

热门文章

  1. Vue中v-model解析、sync修饰符解析
  2. aapt&adb笔记
  3. Apache Commons FileUpload实现文件上传
  4. keepalived实现nginx反向代理的高可用
  5. php工具、拓展下载地址
  6. Scrum会议博客以及测试报告(β阶段)
  7. Type mismatch: cannot convert from element type Object to String 解决办法
  8. Kotlin星投影与泛型约束详解
  9. pycharm flask debug调试接口
  10. Java编译器的优化