Are you wanting to put a tick instead of a point on the interval? or both?
Why not use DIVIDE/MEASURE command and use block for intervals? or am i missing something?
Registered forum members do not see this ad.
Dear ...
big bros
I need Little Help to Fix My Lisp file ...
i am Trying to create Chainage Lisp file and i succeed to Put "_POINT" to Polyline with given Interval
But here i have one Problem how to insert Tick Mark Means PERPENDICULAR LINE to Every Point ....i tried lots of time ...but its fails ......please help to learn how to insert lines ....Explain me bit wise please
i used render man Sub function i dnt know where i want to use this
My Code :Code:(defun _GetPerpAng (startPoint endPoint add) (+ (* (if add 0.50 -0.50) pi) (angle startPoint endPoint)) )
Code:;;Chainge Distance (defun *error* (msg) (if (not (member msg '("Function cancelled" "quit / exit abort")) ) (princ (strcat "\nError: " msg)) ) (setvar "CMDECHO" old_cmh) (setvar "osmode" old_osm) (setvar "clayer" old_lay) (princ) ) (defun c:Chainage() (vl-load-com) (setq old_cmh(getvar "cmdecho")) (setq old_osm(getvar "osmode")) (setq old_lay(getvar "clayer")) (setvar "cmdecho" 0) (setvar "osmode" 0) (if (setq ss(car(entsel "\nPick Polyline >>"))) (progn (setq interval(getreal "\nEnter Chainage Interval:")) (setq Nxt_dist interval) (setq pl_len(vlax-curve-getdistatparam ss(vlax-curve-getendparam ss))) (setq spt(vlax-curve-getstartpoint ss)) (setq ept(vlax-curve-getendpoint ss)) (command "_POINT" spt)(command "_POINT" ept) (repeat (fix(/ pl_len interval)) (setq M_point(vlax-curve-getpointatdist ss interval)) (command "_POINT" M_point) (setq interval(+ nxt_dist interval)) ) ) (princ "\nNo Polyline Selected:") ) (setvar "cmdecho" old_cmd) (setvar "osmode" old_osm) (setvar "clayer" old_lay) (princ) )
waiting for your answers .......
Find my attachment
CHAINAGE.dwg
Last edited by gS7; 20th Oct 2012 at 03:54 pm.
Are you wanting to put a tick instead of a point on the interval? or both?
Why not use DIVIDE/MEASURE command and use block for intervals? or am i missing something?
Dear pBe i dont want to use Pint For Example i used that object ...but my requirement is i want to insert Line tick mark and also i need to put distance text to each points .........
Pardon for my ignorance. what will the final drawing look like? Chainage is all greek to me.
-A picture is worth a thousand words-
EDIT: oops... i did not see your post there gs7
A chainage line (the Pline) is always straight? Then a block with attributes is the way to go in this case.
Except the first and last point that is.
Hang on... guess you can use your lisp then.... but i'm more inclined to use an attribute block
My attachment
CHAINAGE.dwg
Hang in there, i will help you fix your lisp, we will still use your original approach so you may understand it better.
oh! tank u pbe ...i will wait for reply![]()
Insert this block om your drawingCode:(defun c:Chainage (/ *error* _GetPerpAng ss interval Nxt_dist pl_len scale_ points spt ept mpoint M_point cur ) (defun *error* (msg) (command "._undo" "_end") (if (not (member msg '("Function cancelled" "quit / exit abort")) ) (princ msg) ) (setvar "CMDECHO" old_cmh) (setvar "osmode" old_osm) (setvar "clayer" old_lay) (setvar "attreq" old_atq) (princ) ) (defun _GetPerpAng (startPoint endPoint add) (+ (* (if add 0.50 -0.50) pi) (angle startPoint endPoint)) ) (defun rtd (a) (/ (* a 180.0) pi) ) (vl-load-com) (setq old_cmh (getvar "cmdecho")) (setq old_osm (getvar "osmode")) (setq old_lay (getvar "clayer")) (setq old_atq (getvar "attreq")) (setvar "cmdecho" 0) (command "._undo" "_begin") (setvar "osmode" 0) (setvar "attreq" 1) (if (and (setq ss (car(entsel "\nPick Polyline >>"))) (setq interval (getdist "\nEnter Chainage Interval: ")) (setq scale_ (getreal "\nEnter Block Scale: ")) ) (progn (setq points (mapcar 'cdr (vl-remove-if-not '(lambda (j) ( = (car j) 10)) (setq ent (entget ss))))) (setq Nxt_dist interval) (setq pl_len (vlax-curve-getdistatparam ss (vlax-curve-getendparam ss) ) Interval (- Interval) spt (car points) ept (cadr points) ) (repeat (+ (fix (/ pl_len (abs interval))) 2) (setq interval (+ nxt_dist interval) interval (if (> interval pl_len) pl_len interval)) (setq M_point (vlax-curve-getpointatdist ss interval)) (if (> (vlax-curve-getDistAtPoint ss M_point)(vlax-curve-getDistAtPoint ss ept)) (setq points (cdr points) spt (car points) ept (cadr points))) (command "_insert" "label" M_point scale_ (rtd (_GETPERPANG spt ept nil)) (setq cur (strcat "Ch:" (rtos interval 2 0) "m"))) (print cur) ) C ) (princ "\nNo Polyline Selected:") ) (*error* "") (princ) )
label.dwg
CODE UPDATED:
Last edited by pBe; 21st Oct 2012 at 01:38 am.
dear pbe the code u posted its working perfectly when the chainage line is straightA chainage line (the Pline) is always straight?
Sorry pBe i did not Notice what u have asked , the chainage line straight or not
and also i have made a mistake i.e i attached straight line drawing ....
sorry for ignorance .......
actually i am using Road Center line as my chainage line ....... so that line is having so many curve points ........
please find my another attachment .........
Chainage-2.dwg
Registered forum members do not see this ad.
See updated code gS7,
The placement of the labels ( blocks ) will depend on the direction of the polyline.
Keep on coding![]()
Bookmarks