- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need a LISP program which can break both ends of the selected lines at. 15mm distance and put them into another layer.
I've created an LISP program and it is working. But sometimes at certain polylines the break is not in one ponint but a small distance is missing if more polyline is selected at once. However if I select these polylines but only one and let the program run one by one the break is in one point in each polyline. What can be the problem, has someone any idea?
If I click on the same lines on by one the result is great.
(defun C:BRAKE_15 (/ selection name data end15 start15 counter lastCreatedObject listOfCreatedObjects)
(vl-load-com)
(setq selection (ssget)) ;(list (cons 0 "LWPOLYLIN"))))
(setq numberOfSelected (sslength selection))
(setq counter 0)
(repeat numberOfSelected
(setq name (ssname selection counter))
(setq data (entget name))
(setq end15 (vlax-curve-getPointAtDist name (- (vlax-curve-getDistAtPoint name (vlax-curve-getEndPoint name) ) 15 ) )
)
(COMMAND "BREAK" name end15 end15)
(setq lastCreatedObject (entlast))
(command "chprop" lastCreatedObject "" "Layer" "text" "layer" "1_mm_none" "color" "bylayer" "")
(setq start15 (vlax-curve-getPointAtDist name 15))
(COMMAND "BREAK" name start15 start15)
(setq lastCreatedObject (entlast))
(setq counter (+ 1 counter))
) ;end repeat
----------------------------------------------------------------------------------------
;here we change the layer of the selected polylines because after breack of the start 15mm line it get the name of the original polyline
(setq counter 0)
(repeat numberOfSelected
(setq name (ssname selection counter))
(setq data (entget name))
(command "chprop" name "" "Layer" "text" "layer" "1_mm_none" "color" "bylayer" "")
(setq counter (1+ counter))
) ;end repeat
(princ)
) ;end defun
Solved! Go to Solution.