I try to divide POLYLINEs, LINEs, CIRCLEs, ELLIPSEs, SPLINEs and ARCs according to light poles distribution purposes. It's become possible if I draw dividing line (see my modification of Tharwat code)
;;; Divide POLYLINEs,LINEs,CIRCLEs,ELLIPSEs,SPLINEs and ARCs according to light poles distribution purposes ;;; Modified by Igal Averbuh 2018 (added optilon x/2 x x x/2 divide for lighting purposes) ;;; Created by ;;; Tharwat 02. Jan. 2013 ;;; ;;; Saved from: https://www.cadtutor.net/forum/topic/43505-help-modifying-a-modified-divide-lisp-from-cadalyst-website/ (defun c:AD (/ s n j sn d i l pt ang) (vl-load-com) (if (and (setq n (getint "\n Number of segments :")) (setq s (ssget '((0 . "*POLYLINE,LINE,CIRCLE,ELLIPSE,SPLINE,ARC")))) ) (if (not (eq n 0)) (repeat (setq j (sslength s)) (setq sn (ssname s (setq j (1- j)))) (setq d (/ (vlax-curve-getdistatparam sn (vlax-curve-getendparam sn)) n) i (* d 0.5) l (/ d 10.) ) (repeat n (setq pt (vlax-curve-getpointatdist sn i)) (setq ang (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv sn (vlax-curve-getparamatpoint sn pt)))) (entmake (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 (polar pt (+ ang (/ pi 2.)) l)) (cons 11 (polar pt (- ang (/ pi 2.)) l)) ) ) ;(entmakex (list '(0 . "LINE") ;(cons 10 (polar pt (+ ang (/ pi 2.)) l)) ;(cons 11 (polar pt (- ang (/ pi 2.)) l)) ;) ;) ;(command "_.XLINE" "_B") (setq i (+ d i)) ) ) (alert "Number of segments must be bigger than ZERO !!") ) ) (princ) ) (c:ad)
I did another step and now I need to divide it by xlines
It become possible if I use (command "_.XLINE" "_B")
when starting and direction vector points are:
(cons 10 (polar pt (+ ang (/ pi 2.)) l))
(cons 11 (polar pt (- ang (/ pi 2.)) l))
.. but my attempt to add it to lisp was unsuccessful
can somebody help me to do it?
The main goal is - to create xlines in division points..
Any help will be very appreciated
Try this one:
(defun :makexline (pt ang /) (entmakex (list (cons 0 "XLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbXline") (cons 10 pt) (cons 11 (polar '(0 0 0) ang 1)))))
Thanks to your attention to my post and your rapid answer
but unfortunately it nor work as I expected
see attached lisp:
Ok,
My guess: now all xlines have tangent direction to divided entity and we need to draw it perpendicular to it..
Difference between tangent and perpendicular line is 90 degree
Conclusion: need to change this string:
(cons 11 (polar '(0 0 0) ang 1)))))
in order to rotate xline to 90 degree..
How to do it?
Published here with respect to BeekeeCZ
One more note. See THIS list. These are names of C3D transparent commands, which cannot be redefined by LISP.
If the name of your routine is upon that list, it won't work for C3D users.
So if your (potential) end users are also C3D users, consider using more complex names for your routines.