[求助]通过loft放样得到实体用什么方法呢?
我想通过两个截面放样得到一个实体,用什么方法呢。在对象浏览器中查找loft,查找到的都是loft surface,我用的是cad2008。困惑中…… 确实没有,CAD2009就有了。 <p>看来真的要用高版本的cad了。呵呵。</p><p>谢谢ahlzl告知。:)</p> <p>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)要这么多参数,我只要仅横截面放样生成三维实体就可以了,不需要导向线和路径,该怎么写代码呢?我不得已加入导向线和路径参数。但是总有错误生成。不知道怎么回事。代码是这样的。你可以发个放样三维实体的代码样例给我看看吗?不甚感激!</p><p><CommandMethod("vv")> Sub nnn()<br/> Dim Db As Database = HostApplicationServices.WorkingDatabase<br/> Dim Ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor</p><p> Using Trans As Transaction = Db.TransactionManager.StartTransaction()<br/> Try</p><p> Dim Bt As BlockTable = Trans.GetObject(Db.BlockTableId, OpenMode.ForRead)<br/> Dim Btr As BlockTableRecord = Trans.GetObject(Bt.Item(BlockTableRecord.ModelSpace), OpenMode.ForWrite)</p><p> Dim PL1, PL2 As Polyline</p><p> Dim Res1 As PromptEntityResult = Ed.GetEntity("选择截面1")<br/> If Res1.Status = PromptStatus.OK Then<br/> PL1 = CType(Trans.GetObject(Res1.ObjectId, OpenMode.ForWrite), Polyline)<br/> End If<br/> Dim Res2 As PromptEntityResult = Ed.GetEntity("选择截面2")<br/> If Res2.Status = PromptStatus.OK Then<br/> PL2 = CType(Trans.GetObject(Res2.ObjectId, OpenMode.ForWrite), Polyline)<br/> End If</p><p> Dim PL3 As Polyline<br/> Dim Res3 As PromptEntityResult = Ed.GetEntity("选择路径")<br/> If Res3.Status = PromptStatus.OK Then<br/> PL3 = CType(Trans.GetObject(Res3.ObjectId, OpenMode.ForWrite), Polyline)<br/> End If</p><p> Dim Guidecur() As Entity '选择导向线<br/> Dim k As Integer = 0<br/> Dim Result As PromptSelectionResult = Ed.GetSelection()<br/> If Result.Status = PromptStatus.OK Then<br/> Dim sset1 As SelectionSet = Result.Value<br/> For Each elem As SelectedObject In sset1<br/> Dim ent As Entity<br/> ent = Trans.GetObject(elem.ObjectId, OpenMode.ForWrite, False)<br/> If TypeOf ent Is Line Then<br/> ReDim Preserve Guidecur(k)<br/> Guidecur(k) = CType(ent, Line)<br/> k = k + 1<br/> End If<br/> Next<br/> End If</p><p><br/> Dim Ents(1) As Entity<br/> Ents(0) = PL1<br/> Ents(1) = PL2<br/> Dim LOptB As LoftOptionsBuilder = New LoftOptionsBuilder()<br/> Dim LoftSld As Solid3d = New Solid3d()</p><p> LoftSld.CreateLoftedSolid(Ents, Guidecur, PL3, LOptB.ToLoftOptions())</p><p><br/> Btr.AppendEntity(LoftSld)<br/> Trans.AddNewlyCreatedDBObject(LoftSld, True)</p><p> Trans.Commit()</p><p> Catch ex As System.Exception<br/> MsgBox("Error: " + ex.Message)<br/> Finally</p><p> End Try<br/> End Using<br/> End Sub</p> <a href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=75745&replyID=&skin=1">http://bbs.mjtd.com/forum.php?mod=viewthread&tid=75745&replyID=&skin=1</a>
页:
[1]