aeccpoint插入
试图在所选屏幕位置插入aeccpoint,但我在Set oPoints=g\u oDocument处不断收到错误。点#039'''''''''''''''''此处出错。It#039;这是帮助文件的副本吗?那么为什么是desn#039;t it生成一个对象ThankjohnOption ExplicitPublic g\u oCivilApp As AeccApplicationPublic AeccApp As AecaApplication公共AeccDoc As Aecd DocumentPublic Aeccdobase As AecdBase文档专用子命令按钮19_Click()隐藏;由于支持MDI,因此始终再次获取对象
 ;如果(GetBaseCivilObjects()=False),则   ;退出Sub ;结束IfDim-basePnt作为变量,Dim-oPoints作为AeccPoints,Dim oPoint1作为AeccPoint,Dim dLocation(0到2)作为Double 
basePnt=ThisDrawing.Utility。GetPoint(,“Select Location to Label”)
    
位置(0)=basePnt(0)
位置(1)=basePnt(1)
dLocation(2)=0#
Set oPoints=g#oDocument。点#039'''''''''''''''''此处出错
设置oPoint1=oPoints.Add(dLocation)
&039;oPoint1.Number=1000000;oPoint1.Name=";第1点
&039;oPoint1.RawDescription=";点描述
&039;oPoint1.更新
opoint.update用户窗体1.Show
那个错误是什么?此外,g_oDocument是否设置正确?当试图设置Points对象时,它是有效对象吗?
Jeff,
我得到一个错误,说块变量未设置在set oPoint=g\u oDocument.Points.Add(dLoc)处。我在家测试了它,去掉了公共设置,效果很好。本人';我不知道为什么在模块1中设置后删除公共设置会这样做,但我的示例现在运行良好
您是否碰巧有一个示例与下面的示例相同,但在vb dot net中,还是一个绘制简单直线对齐的示例
一如既往地感谢你帮我想清楚这件事
约翰
私有子命令按钮20\u Click()
隐藏 ' 检查以确保Civil 3D正在运行并获取Civil对象 ;如果(GetBaseCvilObjects=False),则   ;退出Sub ;如果结束 
 ;Dim dLoc(0到2)为双精度 ;将OPOINT设置为AeccPoints ;将oPoint设置为AeccPoint 
   
dLoc(0)=100:dLoc(1)=100:dLoc(2)=100#
设置oPoint=g#u oDocument.Points.Add(dLoc)
oPoint.Update 嗨,约翰,如果公共物体也很暗#039;在另一个模块中,VBA不#039;我不喜欢那样
以下是3个示例:使用COM设置点,使用COM将路线添加到无站点路线,另一个用于.NET
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.Civil
Imports Autodesk.Civil.ApplicationServices
Imports Autodesk.Civil.Land.DatabaseServices
Imports Autodesk.AECC.Interop.Land
Imports Autodesk.AECC.Interop.UiLand
Imports Autodesk.Civil.Land.DatabaseServices.Styles
Public Class Class1
_
Public Sub MySetPoint()
Dim aeccapp As AeccApplication = New AeccApplicationClass()
aeccapp.Init(Application.AcadApplication)
Dim aeccdoc As AeccDocument = aeccapp.ActiveDocument
Dim pt As Point3d = New Point3d(100.0, 100.0, 100.0)
Dim aeccpt As AeccPoint = aeccdoc.Points.Add(pt.ToArray())
aeccapp = Nothing
End Sub
_
Public Sub MyAddAlignCOM()
Dim aeccapp As AeccApplication = New AeccApplicationClass()
aeccapp.Init(Application.AcadApplication)
Dim aeccdoc As AeccDocument = aeccapp.ActiveDocument
Dim alignstyle As AeccAlignmentStyle = aeccdoc.AlignmentStyles(0) ''get the first style in the collection
Dim alignlblstyle As AeccAlignmentLabelStyleSet = aeccdoc.AlignmentLabelStyleSets(0) ''get the first label style set in the collection
Dim layer As String = aeccdoc.Settings.DrawingSettings.ObjectLayerSettings.AlignmentLayer.Layer
Dim aeccalign As AeccAlignment = aeccdoc.AlignmentsSiteless.Add("MyFirstAlign", "0", alignstyle, alignlblstyle)
Dim pt1 As Point3d = New Point3d(100.0, 100.0, 100.0)
Dim pt2 As Point3d = New Point3d(300.0, 100.0, 100.0)
aeccalign.Entities.AddFixedLine1(pt1.ToArray(), pt2.ToArray())
aeccapp = Nothing
End Sub
_
Public Sub MyAddALignNET()
Dim civdoc As CivilDocument = CivilApplication.ActiveDocument
Dim alignstyle As ObjectId = civdoc.Styles.AlignmentStyles(0)
Dim alignlblstyle As ObjectId = civdoc.Styles.LabelSetStyles.AlignmentLabelSetStyles(0)
Dim layer As ObjectId = civdoc.Settings.DrawingSettings.ObjectLayerSettings.GetObjectLayerSetting(Autodesk.Civil.Settings.SettingsObjectLayerType.Alignment).LayerId
Dim alignid As ObjectId = Alignment.Create(civdoc, "MyFirstNETAlign", ObjectId.Null, layer, alignstyle, alignlblstyle)
Using tr As Transaction = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()
Dim pt1 As Point3d = New Point3d(100.0, 100.0, 100.0)
Dim pt2 As Point3d = New Point3d(300.0, 100.0, 100.0)
Dim align As Alignment = tr.GetObject(alignid, OpenMode.ForWrite)
align.Entities.AddFixedLine(pt1, pt2)
tr.Commit()
End Using
End Sub
End Class
杰夫,我没有';我不知道VBA没有#039;我不喜欢IIRC。我只是复制了一些旧的代码,使这一次成为惯例,从来没有想过公共DIM
我想我';我很幸运,因为我以前从未遇到过它
非常感谢您提供的dot net示例 ;本人';我试过几次找时间把我的日常工作转移到网络上,但当我';我在学习点网的中间,然后它#039;一个月后,我';我忘记了我上个月所做的一切 
I';我一直在努力调试,当我试图在点网络上调试时,我崩溃了,所以我的时间,因为我不';不理解如何捕捉点网络错误#039;是的,当我的系统崩溃时,不得不一次又一次地启动autocad,这让人感到沮丧……。最终我&35;039;我会到达那里的
一如既往,感谢您的帮助和理解。我知道';总是要处理初学者的问题并不容易
约翰  ;
页:
[1]