拉伸曲线

ptList=List[Point]() #定义一个点的列表

ptList.Add(Point.Create(MM(11),MM(-14),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(22),MM(2),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(20), MM(25),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(24), MM(41),MM(0))) #创建点,并放入列表当中

ncurve = NurbsCurve.CreateThroughPoints(False, ptList, 0.0001) #创建一个样条曲线穿过所有创建的点

curveSegment = CurveSegment.Create(ncurve) #创建一个有限线段对象

designCurve = DesignCurve.Create(GetRootPart(),curveSegment) #创建DesignCurve对象

selection = Selection.Create(designCurve) #将DesignCurve对象选入

options = ExtrudeEdgeOptions() #定义一个拉伸曲线的选项,后面传入拉伸选项当中

options.PullSymmetric = False #是否双向拉伸

options.Copy = False #是否拷贝拉伸的曲线到最终位置

options.ExtrudeType = ExtrudeType.None #拉伸的类型

result = ExtrudeEdges.Execute(selection, Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 0, 1), MM(20), options) #拉伸,该函数一共有两个重载函数

导圆角(导直角还无法实现)

result=BlockBody.Create(Point.Create(MM(-10), MM(-10), MM(-10)), Point.Create(MM(10), MM(10), MM(10))) #创建一个正方体

selection = Selection.Create(result.CreatedBody.Edges) #选中正方体的所有边

result = ConstantRound.Execute(selection, MM(2)) #倒角,该函数一共有两个重载函数,这里用到的函数,第一个参数为倒角的边,第二个参数为倒角的半径,第三个参数为默认参数,默认参数为null

偏移边

ptList=List[Point]() #定义一个点的列表

ptList.Add(Point.Create(MM(11),MM(-14),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(22),MM(2),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(20), MM(25),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(24), MM(41),MM(0))) #创建点,并放入列表当中

ncurve = NurbsCurve.CreateThroughPoints(False, ptList, 0.0001) #创建一个样条曲线穿过所有创建的点

curveSegment = CurveSegment.Create(ncurve) #创建一个有限线段对象

designCurve = DesignCurve.Create(GetRootPart(),curveSegment) #创建DesignCurve对象

selection = Selection.Create(designCurve) #将DesignCurve对象选入

options = ExtrudeEdgeOptions() #定义一个拉伸曲线的选项,后面传入拉伸选项当中

options.PullSymmetric = False #是否双向拉伸

options.Copy = False #是否拷贝拉伸的曲线到最终位置

options.ExtrudeType = ExtrudeType.None #拉伸的类型

result = ExtrudeEdges.Execute(selection, Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 0, 1), MM(20), options) #拉伸,该函数一共有两个重载函数

selection = Selection.Create(GetRootPart().Bodies[0].Faces[0].Edges[3])

result = OffsetEdges.Execute(selection, MM(-9.82))

拉伸一个面

ptList=List[Point]() #定义一个点的列表

ptList.Add(Point.Create(MM(11),MM(-14),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(22),MM(2),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(20), MM(25),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(24), MM(41),MM(0))) #创建点,并放入列表当中

ncurve = NurbsCurve.CreateThroughPoints(False, ptList, 0.0001) #创建一个样条曲线穿过所有创建的点

curveSegment = CurveSegment.Create(ncurve) #创建一个有限线段对象

designCurve = DesignCurve.Create(GetRootPart(),curveSegment) #创建DesignCurve对象

selection_curve = Selection.Create(designCurve) #将DesignCurve对象选入

option_one = ExtrudeEdgeOptions() #定义一个拉伸曲线的选项,后面传入拉伸选项当中

option_one.PullSymmetric = False #是否双向拉伸

option_one.Copy = False #是否拷贝拉伸的曲线到最终位置

option_one.ExtrudeType = ExtrudeType.None #拉伸的类型

ExtrudeEdges.Execute(selection_curve, Point.Create(MM(0), MM(0), MM(0)), Direction.Create(0, 0, 1), MM(20), option_one) #拉伸,该函数一共有两个重载函数

selection_face = Selection.Create(GetRootPart().Bodies[0].Faces[0]) #选中对应的面

ThickenFaces.Execute(selection_face, Direction.Create(1, 1, 0), MM(60), ThickenFaceOptions()) #拉伸,第一个参数为拉伸的面,第二个参数为拉伸的方向,第三个参数为拉伸的长度,第四个参数为拉伸的相关设置,如果需要更进一步设置拉伸的相关参数,需要更详细的设置第四个参数

沿路径扫掠

CircularSurface.Create(MM(10), Direction.Create(0, 1, 0),Point.Create(MM(11),MM(-14),MM(0)))

selection=Selection.Create(GetRootPart().Bodies[0].Faces[0])

ptList=List[Point]() #定义一个点的列表

ptList.Add(Point.Create(MM(11),MM(-14),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(22),MM(2),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(20), MM(25),MM(0))) #创建点,并放入列表当中

ptList.Add(Point.Create(MM(24), MM(41),MM(0))) #创建点,并放入列表当中

ncurve = NurbsCurve.CreateThroughPoints(False, ptList, 0.0001) #创建一个样条曲线穿过所有创建的点

curveSegment = CurveSegment.Create(ncurve) #创建一个有限线段对象

curve_lenghth=curveSegment.Length

designCurve = DesignCurve.Create(GetRootPart(),curveSegment) #创建DesignCurve对象

pathselection=Selection.Create(designCurve) #将DesignCurve对象选入

options = SweepFaceCommandOptions()

options.KeepMirror = True

options.KeepLayoutSurfaces = False

options.KeepCompositeFaceRelationships = True

options.ExtrudeType = ExtrudeType.Add

options.KeepLayoutSurfaces = False

result = SweepFaces.Execute(selection, pathselection,curve_lenghth, options)

生成一个圆环

circle = CircularSurface.Create(MM(2), Direction.DirY, Point.Create(MM(10), MM(0), MM(20))) #首先创建一个圆面

selection = Selection.Create(circle.CreatedBody.Faces[0]) #选中圆面

RevolveFaces.Execute(selection, Line.Create(Point.Origin, Direction.DirZ), DEG(360), RevolveFaceOptions()) #旋转函数有两个函数,这里应用的函数,第一个参数为旋转的面,第二个为旋转轴,这里通过原点和z轴确定,注意Line是矢量,第三个参数为旋转的角度,第四个参数为更进一步设置旋转的参数选项

放样

loft_face=List[DesignFace]() #创建一个DesignFace的列表

CircularSurface.Create(MM(10), Direction.Create(0, 0, 1)) #创建第一个圆面

loft_face.Add(GetRootPart().Bodies[0].Faces[0]) #将第一个圆面添加到列表当中

CircularSurface.Create(MM(20), Direction.Create(0, 0, 1),Point.Create(MM(0),MM(0),MM(30))) #创建第二个圆面

loft_face.Add(GetRootPart().Bodies[1].Faces[0]) #将第二个圆面添加到列表当中

selection = Selection.Create(loft_face) #通过列表,选中圆面

result = Loft.Create(selection) #放样

更加详细的设置可参考下面的设置:

loft_face=List[DesignFace]() #创建一个DesignFace的列表

CircularSurface.Create(MM(10), Direction.Create(0, 0, 1)) #创建第一个圆面

loft_face.Add(GetRootPart().Bodies[0].Faces[0]) #将第一个圆面添加到列表当中

CircularSurface.Create(MM(20), Direction.Create(0, 0, 1),Point.Create(MM(0),MM(0),MM(30))) #创建第二个圆面

loft_face.Add(GetRootPart().Bodies[1].Faces[0]) #将第二个圆面添加到列表当中

selection = Selection.Create(loft_face) #通过列表,选中圆面

options = LoftOptions() #创建一个放样选项类的对象

options.GeometryCommandOptions = GeometryCommandOptions() #设置放样的几何

options.GeometryCommandOptions.KeepMirror = True options.GeometryCommandOptions.KeepLayoutSurfaces = True

options.GeometryCommandOptions.KeepCompositeFaceRelationships = True

options.GeometryCommandOptions.Select = True

options.PeriodicBlend = False #是否是一个闭合的放样

options.RotationalBlend = False #是否是一个旋转的放样

options.SheetMetalBlend = False #是否是金属面板混合

options.ClockIt = False

options.IsRuled = False

options.IsLocalGuide = False #是否使用本地导轨

options.ExtrudeType = ExtrudeType.Add #放样的方式为增加材料

result = Loft.Create(selection, None, options) #放样,本函数有三个参数,第一个参数选择放样的对象;第二个参数为可选参数,导轨的选择,默认为null;第三个参数也是可选参数,对放样的相关设置,默认为null

抽壳

#创建一个正方体

result = BlockBody.Create(Point.Create(MM(-10), MM(-10), MM(-10)), Point.Create(MM(10), MM(10), MM(10)))

selection = Selection.Create(result.CreatedBody) #选中生成的正方体

Shell.ShellBodies(selection, MM(-1)) #抽壳,该函数第一个参数为抽壳的对象,第二个参数为抽壳偏移的厚度

抽壳去掉某一面

result = BlockBody.Create(Point.Create(MM(-10), MM(-10), MM(-10)), Point.Create(MM(10), MM(10), MM(10))) #创建一个正方体

remove_face=result.CreatedBody.Faces[0] #选中删除的面

selection = Selection.Create(remove_face) #创建一个删除面的选择对象

result = Shell.RemoveFaces(selection, MM(-1)) #抽壳删除面,第一个参数为删除的面,第二个参数为抽壳偏移的厚度

常用spaceclaim脚本(三)的更多相关文章

  1. 常用spaceclaim脚本(二)

    #创建一个草图 #第一个参数传入一个Frame对象 #通过一个点和两个向量创建Frame #Frame的类成员函数Create被重载 #重载函数1:Frame.Create(Point, Direct ...

  2. 常用spaceclaim脚本

    #创建一个长方体,通过两点来确定一个立方体 #MM表示的是以毫米作为单位 #返回的是一个BlockBody的对象 #本函数还有第三个参数可选,分别代表增加材料,切除材料等等 #默认值为增加材料 注:第 ...

  3. jQuery中的常用内容总结(三)

    jQuery中的常用内容总结(三) 转载请注明地址:http://www.cnblogs.com/funnyzpc/p/7571998.html 内容提要 选择器(第一节) 选择器的扩展方法(第一节) ...

  4. linux 常用命令(三)ssh

    linux 常用命令(三)SSH 一.SSH 安装及免密登陆 (1) SSH 安装并配置 CentOS 默认已安装了 SSH client.SSH server,打开终端执行如下命令进行检验 rpm ...

  5. 8个DBA最常用的监控Oracle数据库的常用shell脚本

    本文介绍了8个常用的监控数据shell脚本.首先回顾了一些DBA常用的Unix命令,以及解释了如何通过Unix Cron来定时执行DBA脚本.网上也有好多类似的文章,但基本上都不能正常运行,花点时间重 ...

  6. 常用shell脚本命令

    常用shell脚本命令 1.显示包含文字aaa的下一行的内容: sed -n '/aaa/{n;p;}' filename 2.删除当前行与下一行的内容: sed -i '/aaa/{N;d;}' f ...

  7. Linux常用Shell脚本珍藏【转载】

    我们在运维中,尤其是linux运维,都知道脚本的重要性,脚本会让我们的 运维事半功倍,所以学会写脚本是我们每个linux运维必须学会的一门功课,这里收藏linux运维常用的脚本.如何学好脚本,最关键的 ...

  8. Python学习 :常用模块(三)----- 日志记录

    常用模块(三) 七.logging模块 日志中包含的信息应有正常的程序访问日志,还可能有错误.警告等信息输出 python的 logging 模块提供了标准的日志接口,你可以通过它存储各种格式的日志, ...

  9. windows常用bat脚本

    windows常用bat脚本 https://blog.csdn.net/longyan_csc/article/details/78737722 Windows_批处理+任务计划实现文件夹定时备份 ...

随机推荐

  1. JS中的函数与对象

    创建函数的三种方式 1.函数声明 function calSum1(num1, num2) { return num1 + num2; } console.log(calSum1(10, 10)); ...

  2. thinkphp5 使用PHPExcel 导入导出

    首先下载PHPExcel类.网上很多,自行下载. 然后把文件放到vendor文件里面. 一般引用vendor里面的类或者插件用vendor(); 里面加载的就是vendor文件,然后想要加载哪个文件, ...

  3. PHP7预编译mysqli查询操作

    //连接数据库 $mysqli = new mysqli("localhost", "root", "root", "mobile ...

  4. there is no route defined for key Agreement(react native bug记录)

    调试react native的项目有一个报错: there is no route defined for key XXXX 它发生在我调试TabNavigator选项卡路由器的时候,我把如下代码的A ...

  5. Qt环境搭建

    下载 qtcreator:http://download.qt.io/official_releases/qtcreator/ 编译器(mingw):http://download.qt.io/dev ...

  6. mysql审计插件-记录所有sql语句

    https://www.58jb.com/html/160.html https://www.jianshu.com/p/a0e0aec3cb6f MySQL审计工具Audit Plugin安装使用 ...

  7. error 106: Can't Access ASP.NET\ClientFiles\

    Error 1606 Can’t access ASP.NET\ClientFiles\ when installing Crystal Reports Support Pack 10     Sea ...

  8. mysqldump 全备

    [root@db01 b]#mysqldump -uroot -poldboy123 -A -R --triggers --master-data=2 --single-transaction | g ...

  9. unity 之协程返回值

    yield return null; // 下一帧再执行后续代码yield return 6;//(任意数字) 下一帧再执行后续代码yield break; //直接结束该协程的后续操作yield r ...

  10. Golang : Forwarding a local port to a remote server example

    原文:https://socketloop.com/tutorials/golang-forwarding-a-local-port-to-a-remote-server-example 端口转发, ...