Thanks for your c# example. I see most people here are using c#. I found this c# to VB.net convertor at
http://www.kamalpatel.net that does a nice job so I just translate it over and its always at least 95% or perfect.
I took your example the broke it into 3 subs. The addSomething one is the one that get's plugged in everywhere and the other 2 just do their jobs.
I changed the poly to a 3D poly so solids can be extruded from a known 3D point. Everything I do is in the WCS. I have seen some posts over in the acad.net group mentioning that there is no 3DRotate in .net. I don't see anything in the object browser except in Interop. Although there is a method in DOTNETARX for it. The same thing holds true for MOVE
If it can't be done then maybe this would be the place to do the rotation and move before the solid gets made.
Public Sub addSomething()
'some hard coded stuff for testing
Dim elevation As Double = 33.25
Dim length As Double = 1.5
Dim width As Double = 5.5
Dim height As Double = 92.25
Dim a As New Point3d(0, 0, elevation)
Dim b As New Point3d(length, 0, elevation)
Dim c As New Point3d(length, width, elevation)
Dim d As New Point3d(0, width, elevation)
drawPoly(a, b, c, d, height)
End Sub
Public Sub drawPoly(ByVal a As Point3d, _
ByVal b As Point3d, _
ByVal c As Point3d, _
ByVal d As Point3d, _
ByVal height As Double)
Dim bb As New DBObjectCollection
Dim pntCol As New Point3dCollection
pntCol.Add(a)
pntCol.Add(b)
pntCol.Add(c)
pntCol.Add(d)
Dim plBox = New Polyline3d(Poly3dType.SimplePoly, pntCol, True)
extrudePoly(plBox, height)
plBox.dispose()
End Sub
Public Sub extrudePoly(ByVal poly As Polyline3d, _
ByVal height As Double)
Dim colregion As DBObjectCollection = New DBObjectCollection()
Dim colPoly As DBObjectCollection = New DBObjectCollection()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim region As Region = New Region()
Dim tm As DatabaseServices.TransactionManager = db.TransactionManager
Dim tr As Transaction = tm.StartTransaction
Try
'get the block table record to add our new solid to
Dim bt As BlockTable = tm.GetObject(db.BlockTableId, DatabaseServices.OpenMode.ForRead, False)
If bt Is Nothing Then Return
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), DatabaseServices.OpenMode.ForWrite, False)
If btr Is Nothing Then Return
'create a region from the polyline
colPoly.Add(poly)
colregion = region.CreateFromCurves(colPoly)
region = CType(colregion(0), Region)
'create the solid
Dim solid As Solid3d = New Solid3d()
solid.Extrude(region, height, 0)
'add it to the db
btr.AppendEntity(solid)
tr.AddNewlyCreatedDBObject(solid, True)
tr.Commit()
Catch
ed.WriteMessage("\nError creating Solid")
Finally
tr.Dispose()
End Try
End Sub