拉伸曲线

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. Android Room 使用案例

    本内容主要介绍 Android 中使用 Room 保存数据到本地数据库的方法.  以下是 Android Room 的官方介绍文档: Room Persistence Library(Room 库的简 ...

  2. vs2017 官方下载地址 和 官方建立脱机安装包的方法

    vs2017 官方下载地址: https://docs.microsoft.com/zh-cn/visualstudio/releasenotes/vs2017-relnotes VS2017 官方建 ...

  3. ipsec][strongswan] ipsec SA创建失败后的错误处理分析

    〇 ike协商的过程最终是为了SA的建立, SA的建立后, 在底层中管理过程,也是相对比较复杂的. 这里边也经常会出现失败的情况. 我们以strongswan为例, 在strongswan的底层SA管 ...

  4. linux 查看 端口3306

    1,查看3306端口被什么程序占用 lsof -i :3306 2,查看3306端口是被哪个服务使用着 netstat -tunlp | grep :3306 3,查看3306端口的是否已在使用中,可 ...

  5. Navicat连接MySQL数据库出现 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded

    装了mysql 8之后因为mysql8采用了新的加密方式,很多软件还不支持, 解决方法如下: 1. 管理员权限运行命令提示符,登陆MySQL mysql -u root -p 2. 修改账户密码加密规 ...

  6. el-select remote 远程搜索 多个共享一个options,options改变时输入框值不显示名称的问题

    原因:el-select remote 远程搜索 多个共享一个options,当使用 remote-method 请求数据后,options被改变,value的值不包含在options中,value的 ...

  7. machine learning (4)---feature scaling

    feature scaling:缩小或扩大feature的值,使所有的feature处于类似的范围,这样进行gradient descnet时更快趋向最小值.因为不同的feature的范围相差很大时, ...

  8. 行为型模式(九) 访问者模式(Visitor)

    一.动机(Motivate) 在软件构建过程中,由于需求的改变,某些类层次结构中常常需要增加新的行为(方法),如果直接在基类中做这样的更改,将会给子类带来很繁重的变更负担,甚至破坏原有设计.如何在不更 ...

  9. Echarts地图合并提取

    Echarts简述 :一个纯 Javascript 的图表库. //参数配置 - 如果不熟悉请参考官网 - 此处以重庆地图为例 var options = { "title" : ...

  10. c99的新功能

    在ANSI的标准确立后,C语言的规范在一段时间内没有大的变动,然而C++在自己的标准化创建过程中继续发展壮大.<标准修正案一>在1994年为C语言创建了一个新标准,但是只修正了一些C89标 ...