乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 81|回复: 3

[求助]通过loft放样得到实体用什么方法呢?

[复制链接]

5

主题

13

帖子

2

银币

初来乍到

Rank: 1

铜币
33
发表于 2010-5-8 08:56:00 | 显示全部楼层 |阅读模式
我想通过两个截面放样得到一个实体,用什么方法呢。在对象浏览器中查找loft,查找到的都是loft surface,我用的是cad2008。困惑中……
回复

使用道具 举报

46

主题

261

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
445
发表于 2010-5-9 06:48:00 | 显示全部楼层
确实没有,CAD2009就有了。
回复

使用道具 举报

5

主题

13

帖子

2

银币

初来乍到

Rank: 1

铜币
33
发表于 2010-5-9 11:01:00 | 显示全部楼层
看来真的要用高版本的cad了。呵呵。
谢谢ahlzl告知。:)
回复

使用道具 举报

5

主题

13

帖子

2

银币

初来乍到

Rank: 1

铜币
33
发表于 2010-5-11 11:17:00 | 显示全部楼层
ahlzl大侠,我装了2010,但是Public Overridable Sub CreateLoftedSolid(ByVal crossSectionCurves() As Autodesk.AutoCAD.DatabaseServices.Entity, ByVal guideCurves() As Autodesk.AutoCAD.DatabaseServices.Entity, ByVal pathCurve As Autodesk.AutoCAD.DatabaseServices.Entity, ByVal loftOptions As Autodesk.AutoCAD.DatabaseServices.LoftOptions)要这么多参数,我只要仅横截面放样生成三维实体就可以了,不需要导向线和路径,该怎么写代码呢?我不得已加入导向线和路径参数。但是总有错误生成。不知道怎么回事。代码是这样的。你可以发个放样三维实体的代码样例给我看看吗?不甚感激!
Sub nnn()
        Dim Db As Database = HostApplicationServices.WorkingDatabase
        Dim Ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Using Trans As Transaction = Db.TransactionManager.StartTransaction()
            Try
                Dim Bt As BlockTable = Trans.GetObject(Db.BlockTableId, OpenMode.ForRead)
                Dim Btr As BlockTableRecord = Trans.GetObject(Bt.Item(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
                Dim PL1, PL2 As Polyline
                Dim Res1 As PromptEntityResult = Ed.GetEntity("选择截面1")
                If Res1.Status = PromptStatus.OK Then
                    PL1 = CType(Trans.GetObject(Res1.ObjectId, OpenMode.ForWrite), Polyline)
                End If
                Dim Res2 As PromptEntityResult = Ed.GetEntity("选择截面2")
                If Res2.Status = PromptStatus.OK Then
                    PL2 = CType(Trans.GetObject(Res2.ObjectId, OpenMode.ForWrite), Polyline)
                End If
                Dim PL3 As Polyline
                Dim Res3 As PromptEntityResult = Ed.GetEntity("选择路径")
                If Res3.Status = PromptStatus.OK Then
                    PL3 = CType(Trans.GetObject(Res3.ObjectId, OpenMode.ForWrite), Polyline)
                End If
                Dim Guidecur() As Entity   '选择导向线
                Dim k As Integer = 0
                Dim Result As PromptSelectionResult = Ed.GetSelection()
                If Result.Status = PromptStatus.OK Then
                    Dim sset1 As SelectionSet = Result.Value
                    For Each elem As SelectedObject In sset1
                        Dim ent As Entity
                        ent = Trans.GetObject(elem.ObjectId, OpenMode.ForWrite, False)
                        If TypeOf ent Is Line Then
                            ReDim Preserve Guidecur(k)
                            Guidecur(k) = CType(ent, Line)
                            k = k + 1
                        End If
                    Next
                End If
                Dim Ents(1) As Entity
                Ents(0) = PL1
                Ents(1) = PL2
                Dim LOptB As LoftOptionsBuilder = New LoftOptionsBuilder()
                Dim LoftSld As Solid3d = New Solid3d()
                LoftSld.CreateLoftedSolid(Ents, Guidecur, PL3, LOptB.ToLoftOptions())
                Btr.AppendEntity(LoftSld)
                Trans.AddNewlyCreatedDBObject(LoftSld, True)
                Trans.Commit()
            Catch ex As System.Exception
                MsgBox("Error: " + ex.Message)
            Finally
            End Try
        End Using
    End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-6-29 00:43 , Processed in 0.487476 second(s), 71 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表