CompuServe Thread

#Multiple Divide Routine

9 messages in this thread
#28566From: Robert DowneyJan 14, 1992 10:21 AM
Below is a multiple divide routine I hacked from Tip 389, But I have not been able to get it to work. Can anyone offer suggestions. (DeFun C:MDIV (/ SS EN) (PrinC "DIVIDE multiple objects") (SetQ SS (SSGet)) (While (> (SSLength SS) 0) (ProgN (SetQ EN (SSName SS 0)) (Command "DIVIDE" EN "10") (SSDel EN SS) ) ) ) Thanks, Bob.
#28579From: Craig Sharp [Mem TM]Jan 14, 1992 11:58 AM
Robert: You don't need the (progn and the associated ')'. I also presume that you have the pdmode and pdsize variables set such that you can see that the entity division has occurred. I would also recommend that you include a test for objects that can't be divided (e.g. inserts). C#
#28653From: Tony Tanzillo [LISP TM]Jan 14, 1992 7:05 PM
Sheesh, good thing you're not that far off the mark when you're playing horse shoes… You could kill someone<g>. The DIVIDE and MEASURE commands require an (<ename> <point>) list. -TonyT.
#28707From: Craig Sharp [Mem TM]Jan 15, 1992 8:10 AM
Tony: Well, I didn't reply that I knew what the problem was… what I said was accurate, and I plead innocence (a faint excuse designed to disguise what others would call stupidity <g>). I've never used Divide or Measure in a LISP routine…<g>. C#
#28632From: Anil GupteJan 14, 1992 4:43 PM
Bob, wow! that's one heckuva way to capitalize! Boggles the eyes! When passing an entity to commands such as DIVIDE (and BREAK etc.), you want to provide both an entity and a point pick (like what ENTSEL gives you). So do this: (command "DIVIDE" (list en (cdr (assoc 10 d))) "10") Of course this will only work for line and polylines. Also, the PROGN is superflous. Anil
#28918From: Robert DowneyJan 16, 1992 9:06 AM
Thanks for the help. I'II revise my use of capitals. Bob
#28655From: Tony Tanzillo [LISP TM]Jan 14, 1992 7:07 PM
Robert – The DIVIDE and MEASURE commands require a list containing both the entity name, and the selection point. You could kluge it like this: (command "divide" (list en '(0 0 0)) "10") -TonyT.
#28919From: Robert DowneyJan 16, 1992 9:06 AM
Thank you. Your suggestion (kluge) works just fine. Bob
#28745From: Carl Bethea [Adesk]Jan 15, 1992 12:33 PM
Robert – Hey, nice job of hacking; I like the way you handle the multiple entities. The reason that it fails is that DIVIDE rquires a list of the entity name and an a pick point (see entsel for an example). I used (list en (cdr(assoc 10 (entget en)))) as the input to the DIVIDE command. I made a few other changes, too, just for grins: (defun c:mdiv (/ ss en pt) (while (setq ss (ssget)) (while (setq en (ssname ss 0)) (setq pt (cdr (assoc 10 (entget en)))) (command ".divide" (list en pt) 10) (ssdel en ss) ) ) (princ) )