kili Posted December 16, 2010 Posted December 16, 2010 (edited) Is there a lisp like MEASURE and DIVIDE where you can align blocks to the polyline? Kind of like executing the MEASURE or DIVIDE command and forgeting to apply "YES" when it prompts to "Align block with object?" The reason is that we are using a third party software, LandF/X, and its blocks hold some kind of smart data. simply inserting them as a BLOCK will not access the blocks data. Even the COPY command gets things screwy. So what I do is draw a pline along where i need my irrigation head to border a permiter. Then I DIVIDE or MEASURE the line according to the irrigation heads spray radius, then place the heads down along the nodes. Then I rotate them to align them to the center point of a curve or along the pline itself. Seem pretty easy for just a few blocks, but doing this over +10000 individual blocks for a large site will drive you nuts. Thanks Edited December 17, 2010 by kili Quote
BIGAL Posted December 19, 2010 Posted December 19, 2010 Search here for "pline chainages" this is used to write the running chainage along a pline at a given spacing its probabbly a good starting point, change the add text to add block pretty sure later versions autorotate the text. Theres at least two versions here. Quote
alanjt Posted December 20, 2010 Posted December 20, 2010 http://www.cadtutor.net/forum/showthread.php?46309-CopyAlongCurve.LSP-Divide-Measure-Dynamic Quote
kili Posted December 21, 2010 Author Posted December 21, 2010 @alanjt: the sequence is very close, except is that im not copying but simply rotating to align, the blocks are already in place but need a lisp to align each block to the pline. my sequence is that i would draw PLINE, then MEASURE according to the irrigatino head spray radius, then insert per LAND F/X their blocks at each node, 0 rotation. then I'd have to go back at each one to rotate along the pline. the catch is that i cannot copy or use the block option in measure and divide because of the data each block. each block has data to do it's sizing and psi calcs. simply copying the object removes the data. Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 I wrote a rotation one, but forgot to post. I'll post when I get in the office, in the morning. Quote
Lee Mac Posted December 21, 2010 Posted December 21, 2010 @alanjt: the sequence is very close, except is that im not copying but simply rotating to align, the blocks are already in place but need a lisp to align each block to the pline. This? http://www.cadtutor.net/forum/showthread.php?47495-Align-Block-to-Curve Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 (defun c:RAC (/ ss ent) ;; Rotate blocks Along Curve ;; Required subroutines: AT:GetSel, AT:AngleAtPoint ;; Alan J. Thompson, 12.20.10 (vl-load-com) (if (and (setq ss (ssget "_:L" '((0 . "INSERT")))) (setq ent (car (AT:GetSel entsel "\nSelect curve to rotate objects along: " (lambda (x) (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getEndParam (list (car x)))) ) ) ) ) ) ) (progn (vlax-for x (setq ss (vla-get-activeselectionset (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object) ) ) ) ) ) ) (vl-catch-all-apply (function (lambda (/) (vla-put-rotation x (AT:AngleAtPoint ent (vlax-curve-getClosestPointToProjection ent (vlax-get x 'InsertionPoint) '(0 0 1)) ) ) ) ) ) ) (vla-delete ss) ) ) (princ) ) (defun AT:GetSel (meth msg fnc / ent good) ;; meth - selection method (entsel, nentsel, nentselp) ;; msg - message to display (nil for default) ;; fnc - optional function to apply to selected object ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC"))) ;; Alan J. Thompson, 05.25.10 (setvar 'errno 0) (while (not good) (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((vl-consp ent) (setq good (cond ((or (not fnc) (fnc ent)) ent) ((prompt "\nInvalid object!")) ) ) ) ((eq (type ent) 'STR) (setq good ent)) ((setq good (eq 52 (getvar 'errno))) nil) ((eq 7 (getvar 'errno)) (setq good (prompt "\nMissed, try again."))) ) ) ) (defun AT:AngleAtPoint (e p) ;; Return angle along curve, at specified point (on curve) ;; e - valid curve (ENAME or VLA-OBJECT) ;; p - point on curve ;; Alan J. Thompson, 11.04.10 (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv e (vlax-curve-getParamAtPoint e p))) ) Quote
kili Posted December 22, 2010 Author Posted December 22, 2010 (edited) I will try both and see what happens. stay tuned. cheers. update: both work really well! RAC and Object align. For RAC, i noticed that no matter what angle the object is, it aligns the object perpendicular to the pline. is it how my direction control is setup?, it's always default to east. Edited December 22, 2010 by kili 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.