[求助]关于.net实现不了的功能,怎么办?
我开发一些功能,.net实现不了,但是LIsp可以实现,那我该怎么办?可以在.net中调用LISP么?请教各位大侠! <p>哪些功能?</p><p></p> <p>版主,你就帮帮我吧,我是在cad06下搞的东西,但是有一个建属性块的时候,就出现致命错误,其他版本的CAD呢,我们这里没有人用</p><p>我想弄个.NET中,用LISP把这个功能实现了,我做的程序就缺这一步了!唉!苦恼呀!</p> <p>我想着用COM来创建属性块,但是总是搞不好,飞狐版主,你的VBA好,能否教教我呢!</p><p>所有点的数据都用.NET得到了,怎么能利用这些数据为每个点创建一个属性块?</p><p>能写一段,用COM创建的属性块么?谢了!</p> <p>Cad06建属性快应该没什么问题的,以前做过的</p><p>看看你的代码?</p><p>另外,代码在其他版本有没问题?</p><p>。net调lisp前面的帖子我不是贴过方法了么</p> Public Class Class1<CommandMethod("CBWA")> Public Sub CreateBlockWithAttributes()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim blockId As ObjectId = ObjectId.Null
Dim record As New BlockTableRecord
record.Name = "RmNum"
Using trans As Transaction = db.TransactionManager.StartTransaction
Dim points As New Point3dCollection
points.Add(New Point3d(-18, -6, 0))
points.Add(New Point3d(18, -6, 0))
points.Add(New Point3d(18, 6, 0))
points.Add(New Point3d(-18, 6, 0))
Dim pline As New Polyline2d(Poly2dType.SimplePoly, points, 0, True, 0, 0, Nothing)
record.Origin = points(3)
record.AppendEntity(pline)
Dim attdef As New AttributeDefinition
attdef.Position = New Point3d(100, 200, 0)
attdef.Height = 8
attdef.Rotation = 0
attdef.HorizontalMode = TextHorizontalMode.TextMid
attdef.VerticalMode = TextVerticalMode.TextVerticalMid
attdef.Prompt = "Room Number;"
attdef.TextString = "0000"
attdef.Tag = "Number"
attdef.Invisible = False
attdef.Verifiable = False
attdef.Preset = False
attdef.Constant = False
record.Origin = points(3)
record.AppendEntity(attdef)
Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)
If bt.Has("RmNum") = False Then
blockId = bt.Add(record)
trans.AddNewlyCreatedDBObject(record, True)
trans.Commit()
End If
End Using
End Sub
End Class平台是Autocad2006 VB.net2005
<p>Public Class Class1<br/> <CommandMethod("CBWA")> Public Sub CreateBlockWithAttributes()<br/> Dim db As Database = HostApplicationServices.WorkingDatabase<br/> Dim blockId As ObjectId = ObjectId.Null</p><p> Using trans As Transaction = db.TransactionManager.StartTransaction<br/> Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)<br/> If bt.Has("RmNum") Then<br/> Return<br/> End If</p><p> Dim record As New BlockTableRecord<br/> record.Name = "RmNum"<br/> blockId = bt.Add(record)<br/> trans.AddNewlyCreatedDBObject(record, True)</p><p> Dim points As New Point3dCollection<br/> points.Add(New Point3d(-18, -6, 0))<br/> points.Add(New Point3d(18, -6, 0))<br/> points.Add(New Point3d(18, 6, 0))<br/> points.Add(New Point3d(-18, 6, 0))</p><p> Dim pline As New Polyline2d(Poly2dType.SimplePoly, points, 0, True, 0, 0, Nothing)<br/> record.Origin = points(3)<br/> record.AppendEntity(pline)<br/> trans.AddNewlyCreatedDBObject(pline, True)</p><p> Dim attdef As New AttributeDefinition<br/> attdef.Position = New Point3d(100, 200, 0)<br/> attdef.Height = 8<br/> attdef.Rotation = 0<br/> attdef.HorizontalMode = TextHorizontalMode.TextMid<br/> attdef.VerticalMode = TextVerticalMode.TextVerticalMid<br/> attdef.Prompt = "Room Number;"<br/> attdef.TextString = "0000"<br/> attdef.Tag = "Number"<br/> attdef.Invisible = False<br/> attdef.Verifiable = False<br/> attdef.Preset = False<br/> attdef.Constant = False<br/> record.Origin = points(3)<br/> record.AppendEntity(attdef)<br/> trans.AddNewlyCreatedDBObject(attdef, True)</p><p> trans.Commit()</p><p> End Using<br/> End Sub<br/>End Class</p> 还是有错误,这是怎么回事呢? <p>逐步调试下,是那句代码的问题看看</p><p>不过代码在2008下没有任何问题</p><p>要么是2006下要用特殊的代码顺序写,要么是Bug</p>
页:
[1]
2