Rhayes Posted October 14, 2008 Posted October 14, 2008 Is there a way to copy an object along a p-line path.??? Quote
lpseifert Posted October 14, 2008 Posted October 14, 2008 Make the object a block, then use the Measure (or Divide) command with the block option. Quote
Rhayes Posted October 14, 2008 Author Posted October 14, 2008 Thanks. I did that. However I want to have my block spaced out exactly 1' apart.??? How do I do that.??? Quote
kapsel Posted December 1, 2008 Posted December 1, 2008 how i could copy object along p line with uneven distance? Quote
rkent Posted December 1, 2008 Posted December 1, 2008 kapsel said: how i could copy object along p line with uneven distance? search on-line for PUT.LSP Quote
rustysilo Posted December 1, 2008 Posted December 1, 2008 Someone, I think lpseifert, posted one here some time ago called measureplinepts.lsp, but it might take some searching. Quote
lpseifert Posted December 1, 2008 Posted December 1, 2008 Here's one similar to the one Rusty referred to. You could modify it to insert blocks instead of points. ;places point at specified station along a polyline, measured from start LPS 2008 (defun c:pop () (vl-load-com) (setq oldosnap (getvar "osmode")) (setvar "osmode" 0) (command "ucs" "w") (if (/= (getvar "pdmode") 3)(setvar "pdmode" 3)) (setq ob (entsel "Select curve: ")) (setq p2 (getreal "\n Specify Distance : ")) (setq obj (vlax-ename->vla-object (car ob))) (setq pt1 (vlax-curve-getPointAtDist Obj p2)) (command "Point" pt1) (command "ucs" "p") (setvar "osmode" oldosnap) (princ) ) >>edit never mind, here is the PUT.lsp, seems to be what you want Quote
BIGAL Posted December 2, 2008 Posted December 2, 2008 Here is some code for inserting blocks along a pline based on number required per segment rather than distance. Also rotates block you may want to remove that part. Block name is holden A good oppurtunity to say thanks for others helping me with this code. Sub draw_vehicle() Dim CAR As String Dim arcobj As AcadArc Dim oPoly As AcadEntity Dim blkobj As AcadEntity Dim retVal As Variant Dim snapPt As Variant Dim oCoords As Variant Dim blpnt1() As Variant ReDim blpnt1(100) Dim blpnt2() As Variant ReDim blpnt2(100) Dim vertPt(0 To 2) As Double Dim Pt1(0 To 2) As Double Dim Pt2(0 To 2) As Double Dim newPt(0 To 2) As Double Dim iCnt, w, x, y, z As Integer Dim cRad, interval, blkangle As Double Dim circObj As AcadCircle Dim lineObj As AcadLine On Error GoTo Something_Wrong For Each Item In ThisDrawing.Blocks If Item.Name = "holden" Then GoTo continue_on Next Item ' exits out of program GoTo Exit_out continue_on: w = 1 ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :" If oPoly.ObjectName = "AcDbPolyline" Then oCoords = oPoly.Coordinates Else: MsgBox "This object is not a polyline!" Exit Sub End If interval = CDbl(InputBox("Enter interval:", , 1#)) If interval < 1 Then interval = 1 End If For iCnt = 0 To UBound(oCoords) - 2 Step 2 Pt1(0) = oCoords(iCnt): Pt1(1) = oCoords(iCnt + 1): Pt1(2) = 0# newPt(0) = Pt1(0) newPt(1) = Pt1(1) newPt(2) = 0# iCnt = iCnt + 2 Pt2(0) = oCoords(iCnt): Pt2(1) = oCoords(iCnt + 1): Pt2(2) = 0# x = (Pt1(0) - Pt2(0)) / interval y = (Pt1(1) - Pt2(1)) / interval 'reset back 2 values iCnt = iCnt - 2 cRad = 2.8 startang = 4.712 endang = 1.57 CAR = "HOLDEN" For z = 1 To interval vertPt(0) = newPt(0) - x vertPt(1) = newPt(1) - y vertPt(2) = 0# 'blpnt1(w) = vertPt Set arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang) retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity) arcobj.Delete Set arcobj = Nothing blkangle = ThisDrawing.Utility.AngleFromXAxis(retval2, vertPt) Set blkobj = ThisDrawing.ModelSpace.InsertBlock(vertPt, CAR, 1#, 1#, 1#, blkangle) Set blkobj = Nothing w = w + 1 newPt(0) = newPt(0) - x newPt(1) = newPt(1) - y Next z Next iCnt Something_Wrong: MsgBox Err.Description Exit_out: End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.