Offset 3dpoly
i just want to know how to offset 3Dpoly programmatically using vb.net.
i tried using the GetOffsetCurves but it did not work, it only works on 2D polyline
below are the codes i tried.
please let me adjustments needed on my code.
thank you very much.
"Offset3DObject")> _
Public Sub Offset3DObject()
' Get the current document and database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database ' Start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() ' Open the Block table for read Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) ' Open the Block table record Model space for write Dim acBlkTblRec As BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) ' Create a 3d polyline Dim p3d As New Point3dCollection p3d.Add(New Point3d(0, 0, 5)) p3d.Add(New Point3d(10, 0, 5)) p3d.Add(New Point3d(10, 10, 5)) Dim acPoly As New Polyline3d(Poly3dType.SimplePoly, p3d, False) ' Offset the polyline a given distance Dim acDbObjColl As DBObjectCollection = acPoly.GetOffsetCurves(1.0) acutPrintf(acDbObjColl.Count) 'it returns 0 ' Step through the new objects created For Each acEnt As Entity In acDbObjColl ' Add each offset object acBlkTblRec.AppendEntity(acEnt) acTrans.AddNewlyCreatedDBObject(acEnt, True) Next ' Save the new objects to the database acTrans.Commit() End Using End Sub0
Comments
-
Hi Marlon,
Offsetting a 3D poly you would need to specify a direction vector that is normal to your polyline. It wouldn't work to just specify a distance, as that doesn't provide a an direction. Applying this offset vector to each of the coordinates in your collection also wouldn't work, its more involved than that. 3Dpoly doesn't have an offset method. Maybe try TransformBy ?
You can visualise this by creating a 3D poly, create a 2D profile normal to one end, then Use the EXTRUDE command to generate a solid along your path. See attach dwg as an example.
Regards,Jason Bourhill
0
This discussion has been closed.