河伯
发表于 2010-10-26 10:56:00
<p><font face="Verdana">第一个例子中,以下两句编译错误,请明示:</font></p>
<p><font face="Verdana"><br/>var line = ls2d.ToCurve(Matrix3d.Identity)<br/>var arc = ca2d.ToCurve(Matrix3d.Identity)</font></p>
雪山飞狐_lzh
发表于 2010-10-26 15:05:00
<p>这里是调用曲线转换类</p>
<p><font face="Verdana">http://bbs.mjtd.com/forum.php?mod=viewthread&tid=77565&star=1#26703</font></p>
河伯
发表于 2010-10-26 16:34:00
本帖最后由 作者 于 2010-11-2 22:23:41 编辑
你那些Ge曲线类文章都是很好的参考,我用VB.NET转换了第一个例子,缺少ToCurve,无法编译。
''' <summary>
''' 使用Ge曲线的简单例子
''' 对直线和圆求交点,并返回交点分隔的部分
''' </summary>
<CommandMethod("t9")> Public Sub t9()
'Ge直线
Dim l2d As New Line2d(Point2d.Origin, Vector2d.XAxis)
'Ge圆
Dim ca2d As New CircularArc2d(New Point2d(5, 5), 15)
'交点集合
Dim pnts As New List(Of Point2d)
'交点处的参数集合
Dim pars1 = New List(Of Double)
Dim pars2 = New List(Of Double)
'求交
Using cci2d As New CurveCurveIntersector2d(l2d, ca2d)
Dim i As Integer = 0
Do While i < cci2d.NumberOfIntersectionPoints
pnts.Add(cci2d.GetIntersectionPoint(i))
Dim k = cci2d.GetIntersectionParameters(i)
pars1.Add(k(0))
pars2.Add(k(1))
i += 1
Loop
End Using
Dim Ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim Db As Database = HostApplicationServices.WorkingDatabase
Dim j As Integer = 1
pnts.ForEach(Sub(p)
Ed.WriteMessage(vbLf & "第{0}个交点为:{1}", j, p)
j += 1
End Sub)
'转换结果为Db曲线()
Using tr = Db.TransactionManager.StartTransaction
Dim btr As BlockTableRecord = Db.CurrentSpaceId.GetObject(OpenMode.ForWrite)
pars1.Sort()
Dim ls2d As New LineSegment2d(l2d.EvaluatePoint(pars1(0)), l2d.EvaluatePoint(pars1(1)))
Dim line = ls2d.ToCurve(Matrix3d.Identity)
btr.AppendEntity(line)
tr.AddNewlyCreatedDBObject(line, True)
pars2.Sort()
ca2d.SetInterval(New Interval(pars2(0), pars2(1), 0))
Dim arc = ca2d.ToCurve(Matrix3d.Identity)
btr.AppendEntity(arc)
tr.AddNewlyCreatedDBObject(arc, True)
tr.Commit()
End Using
End Sub
雪山飞狐_lzh
发表于 2010-10-26 21:56:00
有时间我直接把C#的dll最新版贴上吧
chpmould
发表于 2010-10-30 19:34:00
学习了,这样的贴一顶要顶!!!
cdinten
发表于 2010-12-24 20:24:03
嗯,看看学习学习
yanglin112
发表于 2011-11-8 09:58:26
学习啊!
ctgu123
发表于 2012-6-12 09:38:55
支持,初学多看看程序
lzz0517
发表于 2012-6-21 17:16:08
楼主,你是如何确定你想要返回什么样的弧就返回什么样的弧呢?比如说,相交后我只想要劣弧,或只想要优弧,通过什么条件可以得到想要的结果?
雪山飞狐_lzh
发表于 2012-6-21 23:48:06
这个判断不难吧 首尾的角度