vb。net需要帮助
我在vb中绘制xline时遇到问题。网它似乎在说,我如何设置xline的起始点存在问题。
谁能给我一个例子,如何在vb中绘制一个xline。网
这是我的一些
Dim PEO1 As PromptEntityOptions = New PromptEntityOptions(VBCR & "Select top of batter: ")
peo1.SetRejectMessage(" Invalid entity! Select LWPoly, 2DPoly, 3DPoly, Line, Arc or Spline only!")
peo1.AddAllowedClass(GetType(polyline),True)
peo1.AddAllowedClass(GetType(polyline2d),True)
peo1.AddAllowedClass(GetType(polyline3d),True)
peo1.AddAllowedClass(GetType(Line),True)
peo1.AddAllowedClass(GetType(spline),True)
peo1.AddAllowedClass(GetType(arc),True)
Dim PER1 As PromptEntityResult = ED.GetEntity(PEO1)
If PER1.Status <> PROMPTSTATUS.OK Then Exit Function
TopCurve = trans.GetObject(per1.ObjectId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)
Dim PEO2 As PromptEntityOptions = New PromptEntityOptions(VBCR & "Select bottom of batter: ")
peo2.SetRejectMessage(" Invalid entity! Select LWPoly, 2DPoly, 3DPoly, Line, Arc or Spline only!")
peo2.AddAllowedClass(GetType(polyline),True)
peo2.AddAllowedClass(GetType(polyline2d),True)
peo2.AddAllowedClass(GetType(polyline3d),True)
peo2.AddAllowedClass(GetType(Line),True)
peo2.AddAllowedClass(GetType(spline),True)
peo2.AddAllowedClass(GetType(arc),True)
Dim PER2 As PromptEntityResult = ED.GetEntity(PEO2)
If PER2.Status <> PROMPTSTATUS.OK Then Exit Function
BottomCurve = trans.GetObject(per2.ObjectId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)
Dim PDO As PromptDoubleOptions = new PromptDoubleOptions(vbcr & "Specify distance between batter ticks: ")
PDO.AllowNegative = False
PDO.AllowZero = False
PDO.AllowArbitraryInput = False
PDO.AllowNone = False
PDO.DefaultValue = 5
Dim PDR As PromptDoubleResult = ed.GetDouble(PDO)
If PDR.Status <> Promptstatus.OK Then Exit Function
Dim TopCurveLen As Long = topcurve.GetDistanceAtParameter(topcurve.EndParam)
Dim DistBetween as Integer = PDR.Value
Dim StepLength1 As double = DistBetween
Dim StepLength2 As double = (steplength1 / 2)
Dim StartPt1 As Point3d = New Point3d()
StartPt1 = topCurve.GetPointAtDist(StepLength1)
''msgbox (startpt1.ToString)
Dim StartPt2 As Point3d = New Point3d()
StartPt2 = topcurve.GetPointAtDist(StepLength2)
Dim EndPt1 As Point3d = New Point3D()
EndPt1 = bottomcurve.GetClosestPointTo(StartPt1, True)
''msgbox (endpt1.ToString)
Dim EndPt2 As Point3d = BottomCurve.GetClosestPointTo(StartPt2, true)
Dim Xline1 As Xline = New Xline()
xline1.StartPoint = startpt1'PROBLEM HERE
xline1.EndPoint = ENDPT1'PROBLEM HERE
Xline1.Visible = True
AcadBTR.AppendEntity(xLINE1)
Trans.AddNewlyCreatedDBObject(Xline1, True)
Trans.Commit()
我是vb新手。所以请友善一点。
任何示例材料或网站也会有所帮助 您是否尝试过:
xline1.BasePoint=startpt1
xline1.SecondPoint=ENDPT1 它表示“Secondpoint-不是AutoDesk.Autocad.DatabaseServices.XLINE的成员”
还有其他想法吗??
至少它跳过了StartPt1作为一个错误
到达那里
这很奇怪。它列在文档中,我可以让它与我现有的一些C代码一起工作。
你从哪里得到帮助指南的??
它是否随autocad 2009一起提供??
那真的很有帮助。我只是在网上学习,反复尝试 去:http://usa.autodesk.com/adsk/servlet/index?id=773204&siteID=123112
然后单击许可证和下载链接。
该链接要求您提供一些信息,但反过来允许下载ObjectARX SDK。在那里,您可以找到的帮助文件。NET以及ObjectARX,以及一些可视化类映射和许多托管和非托管代码的代码示例。 非常感谢
我认为有了那个帮助指南会有所帮助。
嘿,我还是没有算出xline。vb中的第二点。网
如果你发现了,请告诉我-谢谢,伙计
我必须同意这一点。
如果包括这些进口:
导入Autodesk。AutoCAD。运行时
导入Autodesk。AutoCAD。几何学
导入Autodesk。AutoCAD。应用程序服务
导入Autodesk。AutoCAD。编辑输入
导入Autodesk。AutoCAD。数据库服务
此示例如何为您工作:
<CommandMethod("QA")> _
Public Sub Asdkcmd1()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim ppo As PromptPointOptions = New PromptPointOptions("Select Base Point :")
Dim ppr As PromptPointResult = ed.GetPoint(ppo)
If ppr.Status <> PromptStatus.OK Then Exit Sub
Dim base As Point3d = ppr.Value
ppo.Message = "Select Second Point :"
ppo.BasePoint = base
ppo.UseBasePoint = True
ppr = ed.GetPoint(ppo)
If ppr.Status <> PromptStatus.OK Then Exit Sub
Dim second As Point3d = ppr.Value
If base <> second Then
Dim entXline As Xline = New Xline()
entXline.BasePoint = base
entXline.SecondPoint = second
Dim btr As BlockTableRecord = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)
btr.AppendEntity(entXline)
trans.AddNewlyCreatedDBObject(entXline, True)
End If
trans.Commit()
End Using
End Sub 我不知道为什么它不起作用-但我不能在xline中添加“secondpoint”。
附上图片。
我正在使用这些导入
Imports System
Imports System.Type
Imports System.CLSCompliantAttribute
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.DatabaseServices
imports Autodesk.AutoCAD.GraphicsInterface
Imports AcadApp = autodesk.AutoCAD.ApplicationServices.Application
我的Acad参考文献还有:;
acdbmgd。dll
acmdg。dll
有什么想法吗??
12345678910
页:
[1]
2