PDA

View Full Version : Break and Divide Question


sschwartz
2006-06-29, 06:54 PM
OK, Can anyone help me with this? I thought I had seen a break into equal segments (similar to divide, only not with nodes) in some version of autocad. We just recently upgraded to 2006, and I had this request. I have looked on the inet, and have found SOME help, like 'break at point', and am wondering if you could use this inbetween a divide command.

This is what the break at point looks like:

(defun c:BRP()
(setq ENTITY (getpoint "\nSpecify break point ON object:"))
(if (= (ssget ENTITY) nil)
(progn
(prompt "\nSelected Point is not on any object. Use
OSNAP and try
again.")
(c:brp)
)
(command "BREAK" ENTITY "@")
)
(princ)
)

[ Moderator Action = ON ] How to use [ CODE ] tags? (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

rkmcswain
2006-06-29, 07:17 PM
I'm not aware of any built-in routine.

FYI: Toolpac [ http://www.dotsoft.com/toolpac.htm ] includes this functionality.

intergrupocr
2006-06-29, 08:04 PM
Try this one:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Makes a line between two points
(defun drline (p1 p2 layer)
(entmake (list (CONS 0 "LINE")
(CONS 8 layer)
(CONS 10 p1)
(CONS 11 p2)
) ;_ fin de list
) ;_ fin de entmake
) ;_ fin de defun

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Gets the value of an association
(defun get-as (aso lis /)
(cdr (assoc aso lis))
) ;_ end of defun

(defun c:brline (/ line-length space-b line-ent line-or line-end line-lay line-ang total-length dist-v pt2)
(setq line-ent (entget (car (entsel "\nSelect line: "))))
(setq line-or (get-as 10 line-ent))
(setq line-end (get-as 11 line-ent))
(setq line-lay (get-as 8 line-ent))
(setq line-ang (angle line-or line-end))
(setq total-length (distance line-or line-end))
(initget 7)
(setq line-length (/ total-length (getint "\nNumber of segments: ")))
(setq dist-v 0)
(while (< dist-v total-length)
(setq pt2 (polar line-or line-ang line-length))
(drline line-or pt2 line-lay)
(setq line-or pt2)
(setq dist-v (+ dist-v line-length))
) ;_ end of while
(entdel (get-as -1 line-ent))
(princ)
) ;_ end of defun

I hope this help you!!

sschwartz
2006-06-30, 03:00 PM
I hope this help you!!

am in awe.... now I get to test it out! sweet thanks

You are the AutoLisp God!

intergrupocr
2006-06-30, 03:44 PM
I'm glad to help!!
Let me know if you need something else.

Julio.