akgbmb Posted February 2, 2014 Posted February 2, 2014 Is there any lisp to do the following condition? Divide lines into equal intervals but end side should be half of between intervals and add cross vertex also Quote
Lee Mac Posted February 2, 2014 Posted February 2, 2014 This will get you part way there: http://lee-mac.com/centeredmeasure.html Quote
akgbmb Posted February 2, 2014 Author Posted February 2, 2014 sir i need to enter "Enter the number of segments" and also cross point "x" with point size 5 Quote
marko_ribar Posted February 2, 2014 Posted February 2, 2014 (edited) Use "divide" command with twice large number of segments and then take every odd point 1,3,5,... Make sure you set "PDMODE" to 3 before "DIVIDE"... M.R. (defun c:divtest ( / pdm pds e ss c n ) (setq pdm (getvar 'pdmode) pds (getvar 'pdsize) ) (setq e (entlast)) (if (null e) (progn (alert "No entities in active document... Please create and restart routine...") (exit) ) (progn (while (not ss) (prompt "\nPick curve for division with points on equal spaces and half spaces at start/end of curve") (if (setq ss (ssget "_+.:E:S" '((0 . "*POLYLINE,LINE,SPLINE,HELIX,CIRCLE,ARC,ELLIPSE")))) (progn (setq c (ssname ss 0)) (initget 7) (setq n (getint "\nSpecify number of division spaces : ")) (setvar 'pdmode 3) (setvar 'pdsize 5) (command "_.divide" c (* (1- n) 2)) (setq e (entnext e)) (repeat (- n 2) (setq e (entnext e)) (entdel e) (setq e (entnext e)) ) ) (alert "Empty sel. set... Please, select again...") ) ) ) ) (setvar 'pdmode pdm) (setvar 'pdsize pds) (princ) ) Edited February 2, 2014 by marko_ribar added code Quote
pBe Posted February 3, 2014 Posted February 3, 2014 (defun c:dib (/ point e div d mark1 pd) ;;; pBeFeb2014 ;;; (defun Point (pt) (entmakex (list (cons 0 "POINT") (cons 10 pt) ) ) ) (if (and (setq ss (setq ss (ssget '((0 . "LWPOLYLINE,LINE,SPLINE,ARC" ) ) ) ) ) (setq div (getint "\nEnter the number of segments : ")) ) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (setq d (vlax-curve-getdistatpoint e (vlax-curve-getEndPoint e))) (setq mark1 (/ d div) hlf (* 0.5 mark1) ) (point (setq pd (vlax-curve-getpointatdist e hlf))) (repeat (1- div) (point (setq pd (vlax-curve-getpointatdist e (+ (vlax-curve-getdistatpoint e pd) mark1) ) ) ) ) ) ) (princ) ) Quote
akgbmb Posted February 4, 2014 Author Posted February 4, 2014 It’s working but I have to ensure "PDMODE=3", "PDSIZE = -5" before using lisp Quote
MSasu Posted February 4, 2014 Posted February 4, 2014 Then just add those statements to the code: (setvar "PDMODE" 3) (setvar "PDSIZE" -5) Quote
akgbmb Posted February 4, 2014 Author Posted February 4, 2014 yes its working thank for your valuable support Quote
pBe Posted February 4, 2014 Posted February 4, 2014 yes its workingthank for your valuable support Good for you akgbmb, Glad i could help Then just add those statements to the code: Yup, Thank you for that. @Marko Did not realize that you set & re-set the pdmode and pdsize variable, which i find really odd. Guys, is there a lisp code out there that converts point entity to a series of objects (almost sure there would be) ? or is better to use a block equivalent of the point style instead? Any thoughts? Quote
marko_ribar Posted February 4, 2014 Posted February 4, 2014 Good for you akgbmb, Glad i could help @Marko Did not realize that you set & re-set the pdmode and pdsize variable, which i find really odd. pBe, I've set pdmode to 35 and pdsize to -1.5 in my acaddoc.lsp and maybe that's also the case with OP's settings of ACAD... I've set and re-set these variables as OP wanted these values for this specific task... Only didn't know wheather OP thought on relative % size of points in relation to current viewport display or he wanted 5 dwg units size... Quote
eldon Posted February 4, 2014 Posted February 4, 2014 Guys, is there a lisp code out there that converts point entity to a series of objects (almost sure there would be) ? or is better to use a block equivalent of the point style instead? Any thoughts? Have you tried NodeSert lisp on the Jeffrey P Sanders website? It might be a start. 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.