乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 83|回复: 4

aeccpoint插入

[复制链接]

14

主题

57

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
113
发表于 2011-9-9 13:21:15 | 显示全部楼层 |阅读模式
试图在所选屏幕位置插入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),则&nbsp&nbsp 退出Sub 结束IfDim-basePnt作为变量,Dim-oPoints作为AeccPoints,Dim oPoint1作为AeccPoint,Dim dLocation(0到2)作为Double&nbsp
basePnt=ThisDrawing.Utility。GetPoint(,“Select Location to Label”)
&nbsp&nbsp&nbsp&nbsp
位置(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
回复

使用道具 举报

71

主题

928

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1230
发表于 2011-9-9 14:09:33 | 显示全部楼层
那个错误是什么?此外,g_oDocument是否设置正确?当试图设置Points对象时,它是有效对象吗?
回复

使用道具 举报

14

主题

57

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
113
发表于 2011-9-10 15:22:32 | 显示全部楼层

Jeff,
我得到一个错误,说块变量未设置在set oPoint=g\u oDocument.Points.Add(dLoc)处。我在家测试了它,去掉了公共设置,效果很好。本人'我不知道为什么在模块1中设置后删除公共设置会这样做,但我的示例现在运行良好
您是否碰巧有一个示例与下面的示例相同,但在vb dot net中,还是一个绘制简单直线对齐的示例
一如既往地感谢你帮我想清楚这件事
约翰
私有子命令按钮20\u Click()
隐藏&nbsp' 检查以确保Civil 3D正在运行并获取Civil对象 如果(GetBaseCvilObjects=False),则&nbsp&nbsp 退出Sub 如果结束&nbsp
 Dim dLoc(0到2)为双精度 将OPOINT设置为AeccPoints 将oPoint设置为AeccPoint&nbsp
&nbsp&nbsp&nbsp
dLoc(0)=100:dLoc(1)=100:dLoc(2)=100#
设置oPoint=g#u oDocument.Points.Add(dLoc)
oPoint.Update
回复

使用道具 举报

71

主题

928

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1230
发表于 2011-9-10 22:03:42 | 显示全部楼层
嗨,约翰,如果公共物体也很暗#039;在另一个模块中,VBA不#039;我不喜欢那样
以下是3个示例:使用COM设置点,使用COM将路线添加到无站点路线,另一个用于.NET
  1. Imports Autodesk.AutoCAD.ApplicationServices
  2. Imports Autodesk.AutoCAD.DatabaseServices
  3. Imports Autodesk.AutoCAD.Runtime
  4. Imports Autodesk.AutoCAD.Geometry
  5. Imports Autodesk.Civil
  6. Imports Autodesk.Civil.ApplicationServices
  7. Imports Autodesk.Civil.Land.DatabaseServices
  8. Imports Autodesk.AECC.Interop.Land
  9. Imports Autodesk.AECC.Interop.UiLand
  10. Imports Autodesk.Civil.Land.DatabaseServices.Styles
  11. Public Class Class1
  12.      _
  13.     Public Sub MySetPoint()
  14.         Dim aeccapp As AeccApplication = New AeccApplicationClass()
  15.         aeccapp.Init(Application.AcadApplication)
  16.         Dim aeccdoc As AeccDocument = aeccapp.ActiveDocument
  17.         Dim pt As Point3d = New Point3d(100.0, 100.0, 100.0)
  18.         Dim aeccpt As AeccPoint = aeccdoc.Points.Add(pt.ToArray())
  19.         aeccapp = Nothing
  20.     End Sub
  21.      _
  22.     Public Sub MyAddAlignCOM()
  23.         Dim aeccapp As AeccApplication = New AeccApplicationClass()
  24.         aeccapp.Init(Application.AcadApplication)
  25.         Dim aeccdoc As AeccDocument = aeccapp.ActiveDocument
  26.         Dim alignstyle As AeccAlignmentStyle = aeccdoc.AlignmentStyles(0) ''get the first style in the collection
  27.         Dim alignlblstyle As AeccAlignmentLabelStyleSet = aeccdoc.AlignmentLabelStyleSets(0) ''get the first label style set in the collection
  28.         Dim layer As String = aeccdoc.Settings.DrawingSettings.ObjectLayerSettings.AlignmentLayer.Layer
  29.         Dim aeccalign As AeccAlignment = aeccdoc.AlignmentsSiteless.Add("MyFirstAlign", "0", alignstyle, alignlblstyle)
  30.         Dim pt1 As Point3d = New Point3d(100.0, 100.0, 100.0)
  31.         Dim pt2 As Point3d = New Point3d(300.0, 100.0, 100.0)
  32.         aeccalign.Entities.AddFixedLine1(pt1.ToArray(), pt2.ToArray())
  33.         aeccapp = Nothing
  34.     End Sub
  35.      _
  36.     Public Sub MyAddALignNET()
  37.         Dim civdoc As CivilDocument = CivilApplication.ActiveDocument
  38.         Dim alignstyle As ObjectId = civdoc.Styles.AlignmentStyles(0)
  39.         Dim alignlblstyle As ObjectId = civdoc.Styles.LabelSetStyles.AlignmentLabelSetStyles(0)
  40.         Dim layer As ObjectId = civdoc.Settings.DrawingSettings.ObjectLayerSettings.GetObjectLayerSetting(Autodesk.Civil.Settings.SettingsObjectLayerType.Alignment).LayerId
  41.         Dim alignid As ObjectId = Alignment.Create(civdoc, "MyFirstNETAlign", ObjectId.Null, layer, alignstyle, alignlblstyle)
  42.         Using tr As Transaction = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()
  43.             Dim pt1 As Point3d = New Point3d(100.0, 100.0, 100.0)
  44.             Dim pt2 As Point3d = New Point3d(300.0, 100.0, 100.0)
  45.             Dim align As Alignment = tr.GetObject(alignid, OpenMode.ForWrite)
  46.             align.Entities.AddFixedLine(pt1, pt2)
  47.             tr.Commit()
  48.         End Using
  49.     End Sub
  50. End Class

回复

使用道具 举报

14

主题

57

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
113
发表于 2011-9-12 07:55:44 | 显示全部楼层
杰夫,我没有'我不知道VBA没有#039;我不喜欢IIRC。我只是复制了一些旧的代码,使这一次成为惯例,从来没有想过公共DIM
我想我'我很幸运,因为我以前从未遇到过它
非常感谢您提供的dot net示例 本人'我试过几次找时间把我的日常工作转移到网络上,但当我'我在学习点网的中间,然后它#039;一个月后,我'我忘记了我上个月所做的一切&nbsp
I'我一直在努力调试,当我试图在点网络上调试时,我崩溃了,所以我的时间,因为我不'不理解如何捕捉点网络错误#039;是的,当我的系统崩溃时,不得不一次又一次地启动autocad,这让人感到沮丧……。最终我&35;039;我会到达那里的
一如既往,感谢您的帮助和理解。我知道'总是要处理初学者的问题并不容易
约翰&nbsp 
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-6-30 17:53 , Processed in 2.097631 second(s), 63 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表