明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2958|回复: 4

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

[复制链接]
发表于 2010-5-8 08:56:00 | 显示全部楼层 |阅读模式
我想通过两个截面放样得到一个实体,用什么方法呢。在对象浏览器中查找loft,查找到的都是loft surface,我用的是cad2008。困惑中……
发表于 2010-5-9 06:48:00 | 显示全部楼层
确实没有,CAD2009就有了。
 楼主| 发表于 2010-5-9 11:01:00 | 显示全部楼层

看来真的要用高版本的cad了。呵呵。

谢谢ahlzl告知。:)

 楼主| 发表于 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)要这么多参数,我只要仅横截面放样生成三维实体就可以了,不需要导向线和路径,该怎么写代码呢?我不得已加入导向线和路径参数。但是总有错误生成。不知道怎么回事。代码是这样的。你可以发个放样三维实体的代码样例给我看看吗?不甚感激!

<CommandMethod("vv")> 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

发表于 2010-5-11 19:01:00 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-29 13:41 , Processed in 0.242675 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表