转换面(Face)为平面草图(PlanarSketch)
2015-10-22 10:43
507 查看
原文地址:
http://adndevblog.typepad.com/manufacturing/2015/10/face-to-planarsketch.html
有时我们可能需要得到某个面Face的一些物理属性,例如转动惯量,这些由RegionProperties提供,但这个属性是Profile对象特有的。通过代码,可以由Face转换成一个 平面草图(PlanarSketch),通过草图的Profile拿到RegionProperties。
例如,假设有个矩形面,以下代码先通过该Face创建草图,接着把Face上的边一一投影到草图,形成Profile,最后拿到Profile的RegionProperties。
Sub SketchFromFace()
' Before running this code, select the face
' you want to create a sketch from
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oFace As Face
Set oFace = oDoc.SelectSet(1)
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oDef.Sketches.Add(oFace)
Dim oEdge As Edge
For Each oEdge In oFace.Edges
Call oSketch.AddByProjectingEntity(oEdge)
Next
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid()
Debug.Print "Area = " + Str(oProfile.RegionProperties.Area)
End Sub
http://adndevblog.typepad.com/manufacturing/2015/10/face-to-planarsketch.html
有时我们可能需要得到某个面Face的一些物理属性,例如转动惯量,这些由RegionProperties提供,但这个属性是Profile对象特有的。通过代码,可以由Face转换成一个 平面草图(PlanarSketch),通过草图的Profile拿到RegionProperties。
例如,假设有个矩形面,以下代码先通过该Face创建草图,接着把Face上的边一一投影到草图,形成Profile,最后拿到Profile的RegionProperties。
Sub SketchFromFace()
' Before running this code, select the face
' you want to create a sketch from
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oFace As Face
Set oFace = oDoc.SelectSet(1)
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oDef.Sketches.Add(oFace)
Dim oEdge As Edge
For Each oEdge In oFace.Edges
Call oSketch.AddByProjectingEntity(oEdge)
Next
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid()
Debug.Print "Area = " + Str(oProfile.RegionProperties.Area)
End Sub
相关文章推荐
- SSRS 2014 User Domain\User does not have required permissions.
- VS 制作程序安装包
- 前台接收的数据在后台乱码
- 【SCOI 2009】生日礼物
- AI倒影制作
- AI常用快捷键
- loadrunner关联数组后拼凑字符串
- HTTP cookies 详解(国外一位大牛的文章)
- js基础 - 兼容代码
- 站内信设计(群发+私信)实践
- Android Studio 错误: 非法字符: '\ufeff' 及 Gradle不能自动查找xml自定义属性
- 【读书笔记】程序员的自我修养总结(二)
- vtable
- 关于使用DrawerLayout建立侧滑菜单时,下层布局依然可响应点击事件的解决方法
- newinstance()和new有什么区别?
- soapUI笔记
- AI字体处理
- oracle 序列初始化的plsql块脚本
- 各种"居中"
- java中的数组