MessatsuX Posted September 9, 2022 Posted September 9, 2022 I want to know if it's possible to make a block/note that uses the distance from beginning of the polyline to where the note arrow intercepts the line, to generate a station in a single field on a block by block basis. This note would need to the ability to be copied and its field(populated by a station number) would pertain only to the interception point of the arrow accompanied by it in the block. I imagine this would be a pretty complicated lisp routine. I've only used LISP to generate macros essentially. What I imagine this procedure looking like is: Please pick polyline Select start point of polyline ( one of the ends or vertices) Select End point of poly line Enter station start Number ( 00+00 for example) ... Then you would Cntrl+C/V your note and start poking different points on the line and it would station automatically. Anyone who works in the permitting of underground utilities would greatly benefit from this. Something like this. https://drive.google.com/file/d/1iup52EhCTsFsBgseBCJW4LL2Qnjil2hD/view?usp=sharing Quote
BIGAL Posted September 9, 2022 Posted September 9, 2022 This has been asked many times about getting a point along a pline from a programming point of view its easy Vla-getpointatdist. You would not use ctrl+V rather use entsel and pick the object. Then place along the pline as pick points. If you google the question "label pick points along pline" should get some results. Or "add leader to pline at distance" The other example is Chainage.lsp which is a chainage increment labeller program, inside it is all the code needed for your request but it must be changed to suit your request. Do you know anything about Lisp. chainage on PL.lsp Quote
MessatsuX Posted September 11, 2022 Author Posted September 11, 2022 On 9/9/2022 at 7:24 PM, BIGAL said: Do you know anything about Lisp. Hey first, thanks for your help, I almost didn't expect a reply. Trying to figure out a way to fly through my jobs faster, I spend a lot of time stationing manually due to the nature of my work I can't just create alignments etc. I know a little, but like I said I have a bunch of shortcut commands using defun c : () (command " random command" I also swithct layers with SSGet, but I don't know much else. I have some time today to brush up on commands and syntax. I'll give it a try. Quote
SLW210 Posted September 12, 2022 Posted September 12, 2022 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Quote
Tsuky Posted September 12, 2022 Posted September 12, 2022 From your example image, this would seem to match. (vl-load-com) (defun make_mlead (pt str / tmp ptlst arr nw_obj) (initget 9) (setq tmp (getpoint (trans pt 0 1) "\nLeader position: ") ptlst (append pt (polar pt (angle pt (trans tmp 1 0)) (distance pt (trans tmp 1 0)))) arr (vlax-make-safearray vlax-vbdouble (cons 0 (- (length ptlst) 1))) ) (vlax-safearray-fill arr ptlst) (setq nw_obj (vla-addMLeader Space (vlax-make-variant arr) 0)) (vla-put-contenttype nw_obj acMTextContent) (vla-put-textstring nw_obj (strcat "{\\fArial|b0|i0|c0|p34;" "STATION BLOCK" "\\P" str "}" ) ) (vla-put-layer nw_obj (getvar "CLAYER")) (vla-put-ArrowheadSize nw_obj (* (getvar "TEXTSIZE") 0.5)) (vla-put-TextHeight nw_obj (getvar "TEXTSIZE")) (if (> (car pt) (car (trans tmp 1 0))) (progn (vla-SetDogLegDirection nw_obj 0 (vlax-3D-point '(-1.0 0.0 0.0))) (vla-put-TextJustify nw_obj acAttachmentPointMiddleRight) (vla-setLeaderLineVertices nw_obj 0 (vlax-make-variant arr)) ) (vla-put-TextJustify nw_obj acAttachmentPointMiddleLeft) ) (vla-update nw_obj) ) (defun draw_pt (pt col / rap) (setq rap (/ (getvar "viewsize") 50)) (foreach n (mapcar '(lambda (x) (list ((eval (car x)) (car pt) rap) ((eval (cadr x)) (cadr pt) rap) (caddr pt) ) ) '((+ +) (+ -) (- +) (- -)) ) (grdraw pt n col) ) ) (defun c:chainage&leader ( / js htx AcDoc Space ent perim_obj pt_ref dist_ref nw_pt dist_pt len_vtx pk) (vl-load-com) (princ "\nSelect a curve object where you want make a chainage.") (while (not (setq js (ssget "_+.:E:S" (list (cons -4 "<OR") (cons -4 "<AND") (cons 0 "*POLYLINE,LINE,ARC,CIRCLE,ELLIPSE") (cons -4 "<NOT") (cons -4 "&") (cons 70 112) (cons -4 "NOT>") (cons -4 "AND>") (cons 0 "SPLINE") (cons -4 "OR>") ) ) ) ) ) (initget 6) (setq htx (getdist (getvar "VIEWCTR") (strcat "\nGive text size <" (rtos (getvar "TEXTSIZE")) ">: "))) (if htx (setvar "TEXTSIZE" htx)) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (= 1 (getvar "CVPORT")) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) ) (vla-startundomark AcDoc) (setq ent (ssname js 0) perim_obj (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)) ) (redraw ent 3) (initget 1) (setq pt_ref (getpoint "\nReference point of measure: ") pt_ref (vlax-curve-getClosestPointTo ent (trans pt_ref 1 0)) ) (draw_pt (trans pt_ref 0 1) 1) (setq dist_ref (vlax-curve-getDistAtPoint ent pt_ref)) (while (setq nw_pt (getpoint "\nGive a point on object: ")) (cond ((setq nw_pt (vlax-curve-getClosestPointTo ent (trans nw_pt 1 0))) (draw_pt (trans nw_pt 0 1) 3) (setq dist_pt (vlax-curve-getDistAtPoint ent nw_pt)) (if (> dist_pt dist_ref) (setq len_vtx (- dist_pt dist_ref)) (setq len_vtx (- dist_ref dist_pt)) ) (make_mlead nw_pt (vl-string-subst "+" "." (rtos (/ len_vtx 1000.0) 2 3))) ) ) ) (redraw ent 4) (vla-regen AcDoc acactiveviewport) (vla-endundomark AcDoc) (prin1) ) 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.